Move ParseBind out of locked block

This commit is contained in:
Karl Burtram
2016-09-18 23:20:43 -07:00
parent e74a392ca9
commit 44914aa8b9

View File

@@ -358,20 +358,20 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
// get or create the current parse info object // get or create the current parse info object
ScriptParseInfo parseInfo = GetScriptParseInfo(scriptFile.ClientFilePath, createIfNotExists: true); ScriptParseInfo parseInfo = GetScriptParseInfo(scriptFile.ClientFilePath, createIfNotExists: true);
// parse current SQL file contents to retrieve a list of errors
ParseResult parseResult = Parser.IncrementalParse(
scriptFile.Contents,
parseInfo.ParseResult,
parseInfo.ParseOptions);
parseInfo.ParseResult = parseResult;
if (parseInfo.BuildingMetadataEvent.WaitOne(LanguageService.FindCompletionsTimeout)) if (parseInfo.BuildingMetadataEvent.WaitOne(LanguageService.FindCompletionsTimeout))
{ {
try try
{ {
parseInfo.BuildingMetadataEvent.Reset(); parseInfo.BuildingMetadataEvent.Reset();
// parse current SQL file contents to retrieve a list of errors
ParseResult parseResult = Parser.IncrementalParse(
scriptFile.Contents,
parseInfo.ParseResult,
parseInfo.ParseOptions);
parseInfo.ParseResult = parseResult;
if (connInfo != null && parseInfo.IsConnected) if (connInfo != null && parseInfo.IsConnected)
{ {
try try
@@ -427,7 +427,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
scriptInfo.Binder = BinderProvider.CreateBinder(scriptInfo.MetadataProvider); scriptInfo.Binder = BinderProvider.CreateBinder(scriptInfo.MetadataProvider);
scriptInfo.ServerConnection = new ServerConnection(sqlConn.GetUnderlyingConnection()); scriptInfo.ServerConnection = new ServerConnection(sqlConn.GetUnderlyingConnection());
scriptInfo.IsConnected = true; scriptInfo.IsConnected = true;
AddOrUpdateScriptParseInfo(info.OwnerUri, scriptInfo); //AddOrUpdateScriptParseInfo(info.OwnerUri, scriptInfo);
} }
} }
catch (Exception) catch (Exception)