fixed changes according to review

This commit is contained in:
Aditya Bist
2016-12-15 13:59:34 -08:00
parent 6e746efad0
commit ac28d3b78f
2 changed files with 17 additions and 11 deletions

View File

@@ -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>

View File

@@ -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;
}
}
}