提交 79ca4a4b 编写于 作者: C CyrusNajmabadi

Actually listen to completion options.

上级 e49822fd
......@@ -173,15 +173,14 @@ public PresentationItem GetPresentationItem(VSCompletion completion)
return null;
}
protected string GetLanguage()
protected Document GetDocument()
{
var document = SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
return document.Project.Language;
}
return SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
}
return "";
protected string GetLanguage()
{
return GetDocument()?.Project.Language ?? "";
}
}
}
\ No newline at end of file
......@@ -24,6 +24,9 @@ internal class Roslyn15CompletionSet : Roslyn14CompletionSet
private CompletionHelper _completionHelper;
public IReadOnlyList<IntellisenseFilter2> Filters;
private readonly bool _highlightMatchingPortions;
private readonly bool _showFilters;
public Roslyn15CompletionSet(
IVisualStudioCompletionSet vsCompletionSet,
CompletionPresenterSession completionPresenterSession,
......@@ -31,12 +34,20 @@ internal class Roslyn15CompletionSet : Roslyn14CompletionSet
ITextBuffer subjectBuffer)
: base(vsCompletionSet, completionPresenterSession, textView, subjectBuffer)
{
var document = GetDocument();
if (document != null)
{
var options = document.Options;
_highlightMatchingPortions = options.GetOption(CompletionOptions.HighlightMatchingPortionsOfCompletionListItems);
_showFilters = options.GetOption(CompletionOptions.ShowCompletionItemFilters);
}
}
protected override void SetupFilters(ImmutableArray<CompletionItemFilter> completionItemFilters)
{
// If more than one filter was provided, then present it to the user.
if (Filters == null && completionItemFilters.Length > 1)
if (_showFilters && Filters == null && completionItemFilters.Length > 1)
{
Filters = completionItemFilters.Select(f => new IntellisenseFilter2(this, f, GetLanguage()))
.ToArray();
......@@ -48,7 +59,7 @@ private CompletionHelper GetCompletionHelper()
this.AssertIsForeground();
if (_completionHelper == null)
{
var document = SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
var document = GetDocument();
if (document != null)
{
_completionHelper = CompletionHelper.GetHelper(document,
......@@ -61,7 +72,7 @@ private CompletionHelper GetCompletionHelper()
public IReadOnlyList<Span> GetHighlightedSpansInDisplayText(string displayText)
{
if (CompletionItemToFilterText != null)
if (_highlightMatchingPortions && CompletionItemToFilterText != null)
{
var completionHelper = this.GetCompletionHelper();
if (completionHelper != null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册