private void AddTemplates(ITextEditor editor, DefaultCompletionItemList list)
        {
            if (list == null)
            {
                return;
            }
            List <ICompletionItem> snippets = editor.GetSnippets().ToList();

            snippets.RemoveAll(item => !FitsToContext(item, list.Items));
            list.Items.RemoveAll(item => snippets.Exists(i => i.Text == item.Text));
            list.Items.AddRange(snippets);
            list.SortItems();
        }
Exemple #2
0
        protected override ICompletionItemList FilterList(ICompletionItemList itemList)
        {
            if (FilterStrategy == null)
            {
                return(itemList);
            }
            var defaultCompletionItemList = new DefaultCompletionItemList
            {
                SuggestedItem = itemList.SuggestedItem, PreselectionLength = itemList.PreselectionLength
            };

            defaultCompletionItemList.Items.AddRange(FilterStrategy.Filter(itemList.Items));
            return(defaultCompletionItemList);
        }
 protected override void InitializeCompletionItemList(DefaultCompletionItemList list)
 {
     base.InitializeCompletionItemList(list);
     list.PreselectionLength = preselectionLength;
 }