private List <Completion> GetContextCompletions(SnapshotPoint triggerPoint, AlloyIntellisenseController controller, ICompletionSession session)
        {
            // Alloy has the strange property that almost any globally visible token can be used throughout an expression (work out the subtle details later).
            Element element;

            if (!Provider.IntellisenseCache.TryResolveContext(AlloyIntellisenseCache.AlloyPositionReference.FromSnapshotPoint(triggerPoint), out element))
            {
                return(new List <Completion>());
            }

            List <Element>    scopedDeclarations = element.GetScopedDeclarations().ToList();
            List <Completion> completions        = new List <Completion>();

            foreach (var decl in scopedDeclarations)
            {
                if (decl == null)
                {
                    continue;
                }

                Completion completion = decl.CreateCompletion(controller, session);
                if (completion != null)
                {
                    completions.Add(completion);
                }
            }

            return(completions);
        }
Beispiel #2
0
        protected override IntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            AlloyIntellisenseController controller = new AlloyIntellisenseController(textView, this);

            textView.Properties[typeof(AlloyIntellisenseController)] = controller;
            return(controller);
        }
Beispiel #3
0
        protected override IntellisenseController TryCreateIntellisenseController([NotNull] ITextView textView, [NotNull] IList <ITextBuffer> subjectBuffers)
        {
            Requires.NotNull(textView, nameof(textView));
            Requires.NotNull(subjectBuffers, nameof(subjectBuffers));

            AlloyIntellisenseController controller = new AlloyIntellisenseController(textView, this);

            textView.Properties[typeof(AlloyIntellisenseController)] = controller;
            return(controller);
        }
        private List<Completion> GetContextCompletions(SnapshotPoint triggerPoint, AlloyIntellisenseController controller, ICompletionSession session)
        {
            // Alloy has the strange property that almost any globally visible token can be used throughout an expression (work out the subtle details later).
            Element element;
            if (!Provider.IntellisenseCache.TryResolveContext(AlloyIntellisenseCache.AlloyPositionReference.FromSnapshotPoint(triggerPoint), out element))
                return new List<Completion>();

            List<Element> scopedDeclarations = element.GetScopedDeclarations().ToList();
            List<Completion> completions = new List<Completion>();
            foreach (var decl in scopedDeclarations)
            {
                if (decl == null)
                    continue;

                Completion completion = decl.CreateCompletion(controller, session);
                if (completion != null)
                    completions.Add(completion);
            }

            return completions;
        }
 protected override IntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers)
 {
     AlloyIntellisenseController controller = new AlloyIntellisenseController(textView, this);
     textView.Properties[typeof(AlloyIntellisenseController)] = controller;
     return controller;
 }