提交 4e8044e6 编写于 作者: R Ravi Chande

Properly compare prefix length

when triggering completion on backspace.
上级 db95b5a2
......@@ -465,7 +465,7 @@ public FilterResult(CompletionItem completionItem, string filterText, bool match
if (filterReason == CompletionFilterReason.BackspaceOrDelete &&
trigger.Kind == CompletionTriggerKind.Deletion)
{
return item.FilterText.GetCaseInsensitivePrefixLength(filterText) > 0;
return item.FilterText.GetCaseInsensitivePrefixLength(filterText) >= Math.Min(item.FilterText.Length, filterText.Length);
}
// If the user hasn't typed anything, and this item was preselected, or was in the
......
......@@ -2887,6 +2887,29 @@ class C
state.SendInvokeCompletionList()
Await state.AssertCompletionSession()
End Using
End Function
<WorkItem(14704, "https://github.com/dotnet/roslyn/issues/14704")>
<WpfFact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function BackspaceTriggerSubstringMatching() As Task
Using state = TestState.CreateCSharpTestState(
<Document>
using System;
class Program
{
static void Main(string[] args)
{
if (Environment$$
}
}
</Document>)
Dim key = New OptionKey(CompletionOptions.TriggerOnDeletion, LanguageNames.CSharp)
state.Workspace.Options = state.Workspace.Options.WithChangedOption(key, True)
state.SendBackspace()
Await state.AssertSelectedCompletionItem(displayText:="Environment", isHardSelected:=True)
End Using
End Function
End Class
End Namespace
End Namespace
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册