Archived
Fixing a null exception error when bound tables are null. (#1327)
* Fixing a null exception error when bound tables are null. * skipping star expansion when there is no active conn * Fixing a comment
This commit is contained in:
@@ -754,6 +754,15 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
starObjectIdentifier = (SqlObjectIdentifier)selectStarExpression.Children.ElementAt(0);
|
starObjectIdentifier = (SqlObjectIdentifier)selectStarExpression.Children.ElementAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Returning no suggestions when the bound tables are null.
|
||||||
|
This happens when there are no existing connections for the script.
|
||||||
|
*/
|
||||||
|
if (selectStarExpression.BoundTables == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
List<ITabular> boundedTableList = selectStarExpression.BoundTables.ToList();
|
List<ITabular> boundedTableList = selectStarExpression.BoundTables.ToList();
|
||||||
|
|
||||||
IList<string> columnNames = new List<string>();
|
IList<string> columnNames = new List<string>();
|
||||||
|
|||||||
@@ -1659,12 +1659,18 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
this.currentCompletionParseInfo = scriptParseInfo;
|
this.currentCompletionParseInfo = scriptParseInfo;
|
||||||
resultCompletionItems = result.CompletionItems;
|
resultCompletionItems = result.CompletionItems;
|
||||||
|
|
||||||
// Expanding star expressions in query
|
/*
|
||||||
|
Expanding star expressions in query only when the script is connected to a database
|
||||||
|
as the parser requires a connection to determine column names
|
||||||
|
*/
|
||||||
|
if (connInfo != null)
|
||||||
|
{
|
||||||
CompletionItem[] starExpansionSuggestion = AutoCompleteHelper.ExpandSqlStarExpression(scriptDocumentInfo);
|
CompletionItem[] starExpansionSuggestion = AutoCompleteHelper.ExpandSqlStarExpression(scriptDocumentInfo);
|
||||||
if (starExpansionSuggestion != null)
|
if (starExpansionSuggestion != null)
|
||||||
{
|
{
|
||||||
return starExpansionSuggestion;
|
return starExpansionSuggestion;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if there are no completions then provide the default list
|
// if there are no completions then provide the default list
|
||||||
if (resultCompletionItems == null)
|
if (resultCompletionItems == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user