C# 在Visual Studio中使用扩展名更改完成列表的顺序

C# 在Visual Studio中使用扩展名更改完成列表的顺序,c#,visual-studio-2013,intellisense,C#,Visual Studio 2013,Intellisense,我正试图编写一个扩展来更改Visual Studio中完成项的顺序,特别是针对C#。然而,无论我如何尝试,我似乎总是走到了死胡同 我有以下代码: using System; using System.Collections.Generic; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; namespace CompletionTest { internal c

我正试图编写一个扩展来更改Visual Studio中完成项的顺序,特别是针对C#。然而,无论我如何尝试,我似乎总是走到了死胡同

我有以下代码:

using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;

namespace CompletionTest
{
    internal class TestCompletionSource : ICompletionSource
    {
        private static CompletionSet2 _completionSet;

        private readonly TestCompletionSourceProvider _sourceProvider;
        private readonly ITextBuffer _textBuffer;

        private bool _isDisposed;

        public TestCompletionSource(TestCompletionSourceProvider sourceProvider, ITextBuffer textBuffer)
        {
            _sourceProvider = sourceProvider;
            _textBuffer     = textBuffer;
        }

        void ICompletionSource.AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
        {
        }

        public void Dispose()
        {
            if (!_isDisposed)
            {
                GC.SuppressFinalize(this);
                _isDisposed = true;
            }
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用Microsoft.VisualStudio.Language.Intellisense;
使用Microsoft.VisualStudio.Text;
命名空间完成测试
{
内部类TestCompletionSource:ICompletionSource
{
私有静态CompletionSet2_completionSet;
私有只读TestCompletionSourceProvider\u sourceProvider;
私有只读ITextBuffer\u textBuffer;
私人住宅被出售;
公共TestCompletionSource(TestCompletionSourceProvider sourceProvider,ITextBuffer textBuffer)
{
_sourceProvider=sourceProvider;
_textBuffer=textBuffer;
}
void ICompletionSource.AugmentCompletionSession(ICompletionSession会话,IList completionSets)
{
}
公共空间处置()
{
如果(!\u已显示)
{
总干事(本);
_isDisposed=true;
}
}
}
}
AugmentCompletionSession方法被调用两次,第一次completionSets参数为空。第二次,completionSets参数将填充VisualStudio生成的所有完成。我想对这个列表重新排序,或者在顺序不同的地方添加另一个完成列表,这就是问题开始的地方

我可以使用VisualStudio提供的集合并对其重新排序,然后将其添加到completionSets参数中。然后我看到两个列表,可以使用intellisense下拉列表中的选项卡进行选择。但是,如果我选择自己的列表,然后按enter键将该项插入文本视图,则会插入正常无序列表中的选定项。我可以用鼠标插入,但显然这有点烦人

有没有人知道如何解决这个问题,或者有没有其他方法