提交 b4453050 编写于 作者: D Dustin Campbell

Remove unused methods from C# and VB CompletionUtilities

上级 37a32f9c
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;
......@@ -30,19 +28,6 @@ public static bool IsTextChangeSpanStartCharacter(char ch)
return ch == '@' || IsWordCharacter(ch);
}
internal static bool IsCommitCharacter(CompletionItem completionItem, char ch, string textTypedSoFar)
{
// TODO(cyrusn): Don't hardcode this in. Suck this out of the user options.
var commitCharacters = new[]
{
' ', '{', '}', '[', ']', '(', ')', '.', ',', ':',
';', '+', '-', '*', '/', '%', '&', '|', '^', '!',
'~', '=', '<', '>', '?', '@', '#', '\'', '\"', '\\'
};
return commitCharacters.Contains(ch);
}
internal static bool IsTriggerCharacter(SourceText text, int characterPosition, OptionSet options)
{
var ch = text[characterPosition];
......@@ -95,29 +80,5 @@ public static bool IsStartingNewWord(SourceText text, int characterPosition)
return CommonCompletionUtilities.IsStartingNewWord(
text, characterPosition, IsWordStartCharacter, IsWordCharacter);
}
internal static bool SendEnterThroughToEditor(CompletionItem completionItem, string textTypedSoFar)
{
// If the text doesn't match, no reason to even check the options
if (completionItem.DisplayText != textTypedSoFar)
{
return false;
}
Workspace workspace = null;
var csharpCompletionItem = completionItem as CSharpCompletionItem;
if (csharpCompletionItem != null)
{
workspace = csharpCompletionItem.Workspace;
}
else
{
workspace = ((SymbolCompletionItem)completionItem).Context.Workspace;
}
var optionService = workspace.Services.GetService<IOptionService>();
return optionService.GetOption(CSharpCompletionOptions.AddNewLineOnEnterAfterFullyTypedWord);
}
}
}
......@@ -12,7 +12,6 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Friend Module CompletionUtilities
Private ReadOnly s_commitChars As Char() = {" "c, ";"c, "("c, ")"c, "["c, "]"c, "{"c, "}"c, "."c, ","c, ":"c, "+"c, "-"c, "*"c, "/"c, "\"c, "^"c, "<"c, ">"c, "'"c, "="c, "?"c}
Private ReadOnly s_defaultTriggerChars As Char() = {"."c, "["c, "#"c, " "c, "="c, "<"c, "{"c}
Public Function GetTextChangeSpan(text As SourceText, position As Integer) As TextSpan
......@@ -38,10 +37,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Return ch = "]"c OrElse IsWordCharacter(ch)
End Function
Public Function IsCommitCharacter(completionItem As CompletionItem, ch As Char, textTypedSoFar As String) As Boolean
Return s_commitChars.Contains(ch)
End Function
Public Function IsDefaultTriggerCharacter(text As SourceText, characterPosition As Integer, options As OptionSet) As Boolean
Dim ch = text(characterPosition)
If s_defaultTriggerChars.Contains(ch) Then
......@@ -67,11 +62,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Return ch = " "c OrElse IsStartingNewWord(text, characterPosition, options)
End Function
Public Function SendEnterThroughToEditor(completionItem As CompletionItem, textTypedSoFar As String) As Boolean
' In VB we always send enter through to the editor.
Return True
End Function
Private Function IsStartingNewWord(text As SourceText, characterPosition As Integer, options As OptionSet) As Boolean
If Not options.GetOption(CompletionOptions.TriggerOnTypingLetters, LanguageNames.VisualBasic) Then
Return False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册