mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-18 17:23:52 -05:00
fixed changes according to review
This commit is contained in:
@@ -332,7 +332,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static instance of an empty completion list to avoid
|
||||
// unneeded memory allocations
|
||||
/// unneeded memory allocations
|
||||
/// </summary>
|
||||
internal static CompletionItem[] EmptyCompletionList
|
||||
{
|
||||
@@ -345,9 +345,22 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
/// <summary>
|
||||
/// Retrieves the reserved word list
|
||||
/// </summary>
|
||||
public static string[] GetReservedWordList()
|
||||
internal static string[] GetReservedWordList
|
||||
{
|
||||
return DefaultCompletionText;
|
||||
get
|
||||
{
|
||||
return AutoCompleteHelper.DefaultCompletionText;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a given word is in the reserved
|
||||
/// word list or not
|
||||
/// </summary>
|
||||
internal static bool IsReservedWord(string text)
|
||||
{
|
||||
int pos = Array.IndexOf(DefaultCompletionText, text.ToLower());
|
||||
return pos > -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion
|
||||
{
|
||||
InsertText = GetCompletionItemInsertName();
|
||||
Label = DeclarationTitle;
|
||||
if (StartsWithBracket(TokenText) || IsReservedWord(InsertText))
|
||||
if (StartsWithBracket(TokenText) || AutoCompleteHelper.IsReservedWord(InsertText))
|
||||
{
|
||||
Label = WithBracket(Label);
|
||||
InsertText = WithBracket(InsertText);
|
||||
@@ -203,12 +203,5 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsReservedWord(string text)
|
||||
{
|
||||
string[] ReservedWords = AutoCompleteHelper.GetReservedWordList();
|
||||
int pos = Array.IndexOf(ReservedWords, text.ToLower());
|
||||
return pos > -1 ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user