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:
Udeesha Gautam
2019-08-09 14:25:47 -07:00
committed by GitHub
parent d42e3626cb
commit 68145d5e7c
9 changed files with 177 additions and 24 deletions

View File

@@ -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,