mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-06 17:24:59 -05:00
Fixed null ref exception in GetSignatureHelp (#175)
- Fixed a few places where ScriptParseInfo was being used before it was verified to be non-null - Added 1 basic test for GetSignatureHelp scenario
This commit is contained in:
committed by
Kevin Cunnane
parent
431dfa4156
commit
40c1434745
@@ -847,6 +847,12 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
|
||||
ScriptParseInfo scriptParseInfo = GetScriptParseInfo(textDocumentPosition.TextDocument.Uri);
|
||||
|
||||
if (scriptParseInfo == null)
|
||||
{
|
||||
// Cache not set up yet - skip and wait until later
|
||||
return null;
|
||||
}
|
||||
|
||||
ConnectionInfo connInfo;
|
||||
LanguageService.ConnectionServiceInstance.TryFindConnection(
|
||||
scriptFile.ClientFilePath,
|
||||
@@ -858,7 +864,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
ParseAndBind(scriptFile, connInfo);
|
||||
}
|
||||
|
||||
if (scriptParseInfo != null && scriptParseInfo.ParseResult != null)
|
||||
if (scriptParseInfo.ParseResult != null)
|
||||
{
|
||||
if (Monitor.TryEnter(scriptParseInfo.BuildingMetadataLock))
|
||||
{
|
||||
@@ -928,13 +934,14 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
|
||||
// get the current script parse info object
|
||||
ScriptParseInfo scriptParseInfo = GetScriptParseInfo(textDocumentPosition.TextDocument.Uri);
|
||||
ScriptDocumentInfo scriptDocumentInfo = new ScriptDocumentInfo(textDocumentPosition, scriptFile, scriptParseInfo);
|
||||
|
||||
|
||||
if (scriptParseInfo == null)
|
||||
{
|
||||
return AutoCompleteHelper.GetDefaultCompletionItems(scriptDocumentInfo, useLowerCaseSuggestions);
|
||||
return AutoCompleteHelper.GetDefaultCompletionItems(ScriptDocumentInfo.CreateDefaultDocumentInfo(textDocumentPosition, scriptFile), useLowerCaseSuggestions);
|
||||
}
|
||||
|
||||
ScriptDocumentInfo scriptDocumentInfo = new ScriptDocumentInfo(textDocumentPosition, scriptFile, scriptParseInfo);
|
||||
|
||||
// reparse and bind the SQL statement if needed
|
||||
if (RequiresReparse(scriptParseInfo, scriptFile))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user