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);
        }
Exemplo n.º 2
0
        protected override IntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            AlloyIntellisenseController controller = new AlloyIntellisenseController(textView, this);

            textView.Properties[typeof(AlloyIntellisenseController)] = controller;
            return(controller);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        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;
 }