mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 17:24:07 -05:00
Feature/sqlcmd : Enable running scripts with SQLCMD variables - Part 1 (#839)
* Part1 : Changes to make cmdcmd script to work with parameters in script * Stop SQL intellisense for SQLCMD * Adding test for Intellisense handling of SQLCMD page * Removing unintentional spacing changes caused by formatting * Updating with smaller CR comments. Will discuss regarding script vs other options in batch info * Removing unintentional change * Adding latest PR comments
This commit is contained in:
@@ -58,12 +58,16 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private / internal instance fields and constructor
|
||||
private const int PrepopulateBindTimeout = 60000;
|
||||
#region Instance fields and constructor
|
||||
|
||||
public const string SQL_LANG = "SQL";
|
||||
|
||||
public const string SQL_CMD_LANG = "SQLCMD";
|
||||
|
||||
private const int OneSecond = 1000;
|
||||
|
||||
private const int PrepopulateBindTimeout = 60000;
|
||||
|
||||
internal const string DefaultBatchSeperator = "GO";
|
||||
|
||||
internal const int DiagnosticParseDelay = 750;
|
||||
@@ -80,6 +84,9 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
|
||||
internal const int CompletionExtTimeout = 200;
|
||||
|
||||
// For testability only
|
||||
internal Task DelayedDiagnosticsTask = null;
|
||||
|
||||
private ConnectionService connectionService = null;
|
||||
|
||||
private WorkspaceService<SqlToolsSettings> workspaceServiceInstance;
|
||||
@@ -836,7 +843,10 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
if (SQL_LANG.Equals(changeParams.Language, StringComparison.OrdinalIgnoreCase)) {
|
||||
shouldBlock = !ServiceHost.ProviderName.Equals(changeParams.Flavor, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (SQL_CMD_LANG.Equals(changeParams.Language, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
shouldBlock = true; // the provider will continue to be mssql
|
||||
}
|
||||
if (shouldBlock) {
|
||||
this.nonMssqlUriMap.AddOrUpdate(changeParams.Uri, true, (k, oldValue) => true);
|
||||
if (CurrentWorkspace.ContainsFile(changeParams.Uri))
|
||||
@@ -848,7 +858,10 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
bool value;
|
||||
this.nonMssqlUriMap.TryRemove(changeParams.Uri, out value);
|
||||
}
|
||||
// should rebuild intellisense when re-considering as sql
|
||||
RebuildIntelliSenseParams param = new RebuildIntelliSenseParams { OwnerUri = changeParams.Uri };
|
||||
await HandleRebuildIntelliSenseNotification(param, eventContext);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1733,7 +1746,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
existingRequestCancellation = new CancellationTokenSource();
|
||||
Task.Factory.StartNew(
|
||||
() =>
|
||||
DelayThenInvokeDiagnostics(
|
||||
this.DelayedDiagnosticsTask = DelayThenInvokeDiagnostics(
|
||||
LanguageService.DiagnosticParseDelay,
|
||||
filesToAnalyze,
|
||||
eventContext,
|
||||
|
||||
Reference in New Issue
Block a user