mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
fixed changes according to review
This commit is contained in:
@@ -332,7 +332,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a static instance of an empty completion list to avoid
|
/// Gets a static instance of an empty completion list to avoid
|
||||||
// unneeded memory allocations
|
/// unneeded memory allocations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static CompletionItem[] EmptyCompletionList
|
internal static CompletionItem[] EmptyCompletionList
|
||||||
{
|
{
|
||||||
@@ -345,9 +345,22 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the reserved word list
|
/// Retrieves the reserved word list
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion
|
|||||||
{
|
{
|
||||||
InsertText = GetCompletionItemInsertName();
|
InsertText = GetCompletionItemInsertName();
|
||||||
Label = DeclarationTitle;
|
Label = DeclarationTitle;
|
||||||
if (StartsWithBracket(TokenText) || IsReservedWord(InsertText))
|
if (StartsWithBracket(TokenText) || AutoCompleteHelper.IsReservedWord(InsertText))
|
||||||
{
|
{
|
||||||
Label = WithBracket(Label);
|
Label = WithBracket(Label);
|
||||||
InsertText = WithBracket(InsertText);
|
InsertText = WithBracket(InsertText);
|
||||||
@@ -203,12 +203,5 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion
|
|||||||
return text;
|
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