mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 17:23:27 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user