Add fix for SendEvent causing test to fail (#195)

Add flag in ServiceHost to ignore SendEvent errors
This commit is contained in:
Connor Quagliana
2016-12-19 14:01:03 -08:00
committed by GitHub
parent 1a2e802a5d
commit ba12a80fbf
2 changed files with 58 additions and 31 deletions

View File

@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.SqlParser.Parser;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
@@ -290,6 +289,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.LanguageServer
{
// When we make a connection to a live database
ScriptFile scriptFile;
Hosting.ServiceHost.SendEventIgnoreExceptions = true;
ConnectionInfo connInfo = TestObjects.InitLiveConnectionInfo(out scriptFile);
// And we place the cursor after a function that should prompt for signature help
@@ -308,12 +308,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.LanguageServer
}
};
// If we have a valid ScriptParseInfo and the SQL has already been parsed
// If the SQL has already been parsed
var service = LanguageService.Instance;
ScriptParseInfo parseInfo = service.GetScriptParseInfo(scriptFile.ClientFilePath);
await service.UpdateLanguageServiceOnConnection(connInfo);
// We should get back a non-null SignatureHelp
// We should get back a non-null ScriptParseInfo
ScriptParseInfo parseInfo = service.GetScriptParseInfo(scriptFile.ClientFilePath);
Assert.NotNull(parseInfo);
// And we should get back a non-null SignatureHelp
SignatureHelp signatureHelp = service.GetSignatureHelp(textDocument, scriptFile);
Assert.NotNull(signatureHelp);
}