mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Fix signature help test to run synchronously (#2186)
This commit is contained in:
@@ -986,12 +986,22 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the autocomplete metadata provider when the user connects to a database
|
/// Starts a Task to update the autocomplete metadata provider when the user connects to a database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <param name="info">Connection info</param>
|
||||||
public Task UpdateLanguageServiceOnConnection(ConnectionInfo info)
|
public Task UpdateLanguageServiceOnConnection(ConnectionInfo info)
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
|
{
|
||||||
|
DoUpdateLanguageServiceOnConnection(info);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the autocomplete metadata provider when the user connects to a database synchronously
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">Connection info</param>
|
||||||
|
public void DoUpdateLanguageServiceOnConnection(ConnectionInfo info)
|
||||||
{
|
{
|
||||||
if (ConnectionService.IsDedicatedAdminConnection(info.ConnectionDetails))
|
if (ConnectionService.IsDedicatedAdminConnection(info.ConnectionDetails))
|
||||||
{
|
{
|
||||||
@@ -1022,7 +1032,6 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
|||||||
|
|
||||||
// Send a notification to signal that autocomplete is ready
|
// Send a notification to signal that autocomplete is ready
|
||||||
ServiceHostInstance.SendEvent(IntelliSenseReadyNotification.Type, new IntelliSenseReadyParams() { OwnerUri = info.OwnerUri });
|
ServiceHostInstance.SendEvent(IntelliSenseReadyNotification.Type, new IntelliSenseReadyParams() { OwnerUri = info.OwnerUri });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
|
||||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||||
@@ -220,7 +219,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
|||||||
/// provide signature help.
|
/// provide signature help.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public async Task GetSignatureHelpReturnsNotNullIfParseInfoInitialized()
|
public void GetSignatureHelpReturnsNotNullIfParseInfoInitialized()
|
||||||
{
|
{
|
||||||
// When we make a connection to a live database
|
// When we make a connection to a live database
|
||||||
Hosting.ServiceHost.SendEventIgnoreExceptions = true;
|
Hosting.ServiceHost.SendEventIgnoreExceptions = true;
|
||||||
@@ -244,8 +243,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.LanguageServer
|
|||||||
|
|
||||||
// If the SQL has already been parsed
|
// If the SQL has already been parsed
|
||||||
var service = CreateLanguageService(result.ScriptFile);
|
var service = CreateLanguageService(result.ScriptFile);
|
||||||
await service.UpdateLanguageServiceOnConnection(result.ConnectionInfo);
|
service.DoUpdateLanguageServiceOnConnection(result.ConnectionInfo);
|
||||||
Thread.Sleep(2000);
|
|
||||||
|
|
||||||
// We should get back a non-null ScriptParseInfo
|
// We should get back a non-null ScriptParseInfo
|
||||||
ScriptParseInfo? parseInfo = service.GetScriptParseInfo(result.ScriptFile.ClientUri);
|
ScriptParseInfo? parseInfo = service.GetScriptParseInfo(result.ScriptFile.ClientUri);
|
||||||
|
|||||||
Reference in New Issue
Block a user