public NTriplesCodeCompletionContext(
     CodeCompletionContext context, TextLookupRanges completionRanges, NTriplesReparsedCompletionContext reparsedContext)
     : base(context)
 {
     this.ReparsedContext = reparsedContext;
     this.Ranges = completionRanges;
 }
Esempio n. 2
0
 public PsiCodeCompletionContext(CodeCompletionContext context, TextLookupRanges completionRanges, PsiReparsedCompletionContext reparsedContext)
     :
     base(context)
 {
     ReparsedContext = reparsedContext;
     Ranges          = completionRanges;
 }
Esempio n. 3
0
 public NTriplesCodeCompletionContext(
     CodeCompletionContext context, TextLookupRanges completionRanges, NTriplesReparsedCompletionContext reparsedContext)
     : base(context)
 {
     this.ReparsedContext = reparsedContext;
     this.Ranges          = completionRanges;
 }
 public PsiCodeCompletionContext(CodeCompletionContext context, TextLookupRanges completionRanges, PsiReparsedCompletionContext reparsedContext)
   :
     base(context)
 {
   ReparsedContext = reparsedContext;
   Ranges = completionRanges;
 }
        public override ISpecificCodeCompletionContext GetCompletionContext(CodeCompletionContext context)
        {
            var unterminatedContext = new NTriplesReparsedCompletionContext(context.File, context.SelectedTreeRange, "aaa");

            unterminatedContext.Init();
            IReference referenceToComplete = unterminatedContext.Reference;
            ITreeNode  elementToComplete   = unterminatedContext.TreeNode;

            if (elementToComplete == null)
            {
                return(null);
            }

            TreeTextRange referenceRange = referenceToComplete != null
                                               ? referenceToComplete.GetTreeTextRange()
                                               : GetElementRange(elementToComplete);

            TextRange referenceDocumentRange = unterminatedContext.ToDocumentRange(referenceRange);

            if (!referenceDocumentRange.IsValid)
            {
                return(null);
            }

            if (!referenceDocumentRange.Contains(context.CaretDocumentRange.TextRange))
            {
                return(null);
            }

            TextLookupRanges ranges = GetTextLookupRanges(context, referenceDocumentRange);

            return(new NTriplesCodeCompletionContext(context, ranges, unterminatedContext));
        }
Esempio n. 6
0
        private ILookupItem CombineLookupItems(CodeCompletionContext basicContext, TextLookupRanges completionRanges, List <ILookupItem> items, ILookupItem sampleMatchItem)
        {
            var item = new CombinedLookupItem(items.ToArray(), items, sampleMatchItem, autocomplete: true, exactMatch: items.Count > 1);

            item.InitializeRanges(completionRanges, basicContext);
            return(item);
        }
        public override ISpecificCodeCompletionContext GetCompletionContext(CodeCompletionContext context)
        {
            var relatedText = string.Empty;
            var nodeUnderCursor = TextControlToPsi.GetElement<ITreeNode>(context.Solution, context.TextControl);

            var interestingNode = GetInterestingNode(nodeUnderCursor);
            if (interestingNode == null)
                return null;

            var ranges = GetTextLookupRanges(context, nodeUnderCursor.GetDocumentRange());

            if (interestingNode is GherkinStep step)
            {
                var stepTextRange = step.GetStepTextRange();
                if (IsCursorBeforeNode(context, stepTextRange))
                    return null;

                relatedText = step.GetStepTextBeforeCaret(context.CaretDocumentOffset);
                if (IsCursorAfterNode(context, stepTextRange))
                {
                    stepTextRange = stepTextRange.ExtendRight(context.CaretDocumentOffset.Offset - stepTextRange.EndOffset.Offset);
                    relatedText += " ";
                }

                var replaceRange = stepTextRange;
                var insertRange = stepTextRange.SetEndTo(context.SelectedRange.EndOffset);

                ranges = new TextLookupRanges(insertRange, replaceRange);
            }
            return new GherkinSpecificCodeCompletionContext(context, ranges, interestingNode, relatedText);
        }
 public ShaderLabCodeCompletionContext([NotNull] CodeCompletionContext context,
                                       ShaderLabReparsedCompletionContext unterminatedContext,
                                       TextLookupRanges ranges)
     : base(context)
 {
     UnterminatedContext = unterminatedContext;
     Ranges = ranges;
 }
Esempio n. 9
0
 public UnityEventFunctionTextualInfo(
     TextLookupRanges memberReplaceRanges,
     bool shouldGenerateMethod,
     [NotNull] string text,
     [NotNull] string identity)
     : base(text, identity)
 {
     MemberReplaceRanges  = memberReplaceRanges;
     ShouldGenerateMethod = shouldGenerateMethod;
 }
Esempio n. 10
0
 public PascalCodeCompletionContext(
     CodeCompletionContext context,
     TextLookupRanges referenceRanges,
     TextLookupRanges elementRanges,
     ReparsedCodeCompletionContext unterminatedContext
     ) : base(context)
 {
     ElementRanges       = elementRanges;
     ReferenceRanges     = referenceRanges;
     UnterminatedContext = unterminatedContext;
 }
Esempio n. 11
0
 public GherkinSpecificCodeCompletionContext(
     [NotNull] CodeCompletionContext context,
     TextLookupRanges ranges,
     ITreeNode nodeUnderCursor,
     string relatedText)
     : base(context)
 {
     Ranges          = ranges;
     NodeUnderCursor = nodeUnderCursor;
     RelatedText     = relatedText;
 }
        private ILookupItem CombineLookupItems(CodeCompletionContext basicContext, TextLookupRanges completionRanges, List <ILookupItem> displayItems, ILookupItem sampleMatchItem)
        {
            // Use a combined lookup item list to add "private " to the start of the display text.
            // We could probably get the same effect with a customised ILookupItemPresentation.
            // Make sure the completion lookup item list is different to the display lookup item
            // list or we get errors in highlighting matches - see RSRP-466980
            var matchingItems = new[] { sampleMatchItem };
            var item          = new CombinedLookupItem(matchingItems, displayItems);

            item.InitializeRanges(completionRanges, basicContext);
            return(item);
        }
Esempio n. 13
0
 public FSharpCodeCompletionContext([NotNull] CodeCompletionContext context,
                                    FSharpOption <CompletionContext> fsCompletionContext, TextLookupRanges ranges, DocumentCoords coords,
                                    PartialLongName partialLongName, ITreeNode tokenBeforeCaret = null, ITreeNode tokenAtCaret = null,
                                    string lineText = null) : base(context)
 {
     Ranges              = ranges;
     Coords              = coords;
     PartialLongName     = partialLongName;
     TokenBeforeCaret    = tokenBeforeCaret;
     TokenAtCaret        = tokenAtCaret;
     LineText            = lineText;
     FsCompletionContext = fsCompletionContext;
 }
        protected ILookupItem GetLookupElement(string replace, TextLookupRanges ranges)
        {
            var info = new TextualInfo(replace, replace)
            {
                ReplaceText = replace, Ranges = ranges
            };
            var item = LookupItemFactory.CreateLookupItem(info)
                       .WithPresentation(_ => new TextPresentation <TextualInfo>(info))
                       .WithBehavior(_ => new TextualBehavior <TextualInfo>(info))
                       .WithMatcher(_ => new TextualMatcher <TextualInfo>(info));

            return(item);
        }
Esempio n. 15
0
            public MemberGenerationContext(
                [NotNull] ITypeDeclaration typeDeclaration,
                [CanBeNull] IModifiersList modifiersList,
                [CanBeNull] ITypeUsage expectedReturnTypeUsage,
                [NotNull] TextLookupRanges memberReplaceRanges)
            {
                TypeDeclaration      = typeDeclaration;
                PsiModule            = typeDeclaration.GetPsiModule();
                ModifiersList        = modifiersList;
                MemberReplaceRanges  = memberReplaceRanges;
                ExpectedAccessRights = ModifiersUtil.GetAccessRightsModifiers(modifiersList);

                if (expectedReturnTypeUsage != null)
                {
                    ExpectedReturnType = CSharpTypeFactory.CreateType(expectedReturnTypeUsage);
                }
            }
Esempio n. 16
0
 public UnityEventFunctionTextualInfo(TextLookupRanges memberReplaceRanges, [NotNull] string text,
                                      [NotNull] string identity)
     : base(text, identity)
 {
     MemberReplaceRanges = memberReplaceRanges;
 }
Esempio n. 17
0
        private static AbbreviatedTextLookupItem CreateAbbreviatedLookupItem(string text, TextLookupRanges ranges, CodeCompletionContext context)
        {
            var item = new AbbreviatedTextLookupItem(text, context, LogoThemedIcons.Angularjs.Id);

            item.InitializeRanges(ranges, context);

            // We're a HTML item too, sort us in with the other HTML items
            item.Placement.Relevance  |= (long)HtmlLookupItemRelevance.Item;
            item.Placement.OrderString = text;
            return(item);
        }
 public NitraCodeCompletionContext(CodeCompletionContext context, IEnumerable <object> complationItems, TextLookupRanges completedElementRange)
 {
     CompletedElementRange = completedElementRange;
     ComplationItems       = complationItems;
     _context = context;
 }
Esempio n. 19
0
 public JsonNewCodeCompletionContext([NotNull] CodeCompletionContext context, TextLookupRanges ranges, IJsonNewCodeCompletionParseContext unterminatedContext)
     : base(context)
 {
     UnterminatedContext = unterminatedContext;
     Ranges = ranges;
 }
        private IdentifierMatcher GetIdentifierMatcher(CodeCompletionContext context, TextLookupRanges ranges)
        {
            var text = context.Document.GetText(ranges.InsertRange.TextRange);

            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            return(LookupUtil.CreateMatcher(text, context.IdentifierMatchingStyle));
        }
Esempio n. 21
0
        private static AbbreviatedTextLookupItem CreateAbbreviatedLookupItem(string text, TextLookupRanges ranges, CodeCompletionContext context)
        {
            var item = new AbbreviatedTextLookupItem(text, context);

            item.InitializeRanges(ranges, context);
            return(item);
        }