Stubbing out query execution settings

Adding a setting for batch separator.
Very small refactor to WorkspaceService that will create the basic
settings upon construction of the object.
This commit is contained in:
benrr101
2016-08-17 18:24:20 -07:00
parent e9814435d8
commit dee490341d
4 changed files with 48 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.Hosting;
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
using Microsoft.SqlTools.ServiceLayer.SqlContext;
using Microsoft.SqlTools.ServiceLayer.Workspace;
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
@@ -60,6 +62,8 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
private readonly Lazy<ConcurrentDictionary<string, Query>> queries =
new Lazy<ConcurrentDictionary<string, Query>>(() => new ConcurrentDictionary<string, Query>());
private SqlToolsSettings Settings { get { return WorkspaceService<SqlToolsSettings>.Instance.CurrentSettings; } }
#endregion
/// <summary>
@@ -81,6 +85,13 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
Dispose();
return Task.FromResult(0);
});
// Register a handler for when the configuration changes
WorkspaceService<SqlToolsSettings>.Instance.RegisterConfigChangeCallback((oldSettings, newSettings, eventContext) =>
{
Settings.QueryExecutionSettings.Update(newSettings.QueryExecutionSettings);
return Task.FromResult(0);
});
}
#region Request Handlers
@@ -281,8 +292,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
return;
}
// Retrieve the current settings for executing the query with
QueryExecutionSettings settings = WorkspaceService<SqlToolsSettings>.Instance.CurrentSettings.QueryExecutionSettings;
// Launch the query and respond with successfully launching it
Task executeTask = query.Execute();
Task executeTask = query.Execute(/*settings*/);
await requestContext.SendResult(new QueryExecuteResult
{
Messages = null