Use config instead of parameter for query editor result copy and fix some wording (#2124)

* Fix typo and update wording

* use config instead of parameter for copying result
This commit is contained in:
Hai Cao
2023-06-27 16:44:23 -07:00
committed by GitHub
parent 4334d79d76
commit 33b5cb98cd
5 changed files with 78 additions and 18 deletions

View File

@@ -0,0 +1,26 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
public class QueryEditorResultSettingsValues
{
/// <summary>
/// Whether to remove the line break from cell values when copying results.
/// </summary>
public bool CopyRemoveNewLine { get; set; } = true;
/// <summary>
/// Whether to skip adding a line break between rows when copying results when the previous row already has a trailing line break.
/// </summary>
public bool SkipNewLineAfterTrailingLineBreak { get; set; } = false;
/// <summary>
/// Whether to include the column headers when copying results.
/// </summary>
public bool CopyIncludeHeaders { get; set; } = false;
}
}

View File

@@ -0,0 +1,30 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Newtonsoft.Json;
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
{
public class QueryEditorSettingsValues
{
/// <summary>
/// Gets or sets the results setting
/// </summary>
[JsonProperty("results")]
public QueryEditorResultSettingsValues? Results { get; set; }
/// <summary>
/// Update the current settings with the new settings
/// </summary>
/// <param name="newSettings">The new settings</param>
public void Update(QueryEditorSettingsValues newSettings)
{
if (newSettings != null)
{
Results = newSettings.Results ?? Results;
}
}
}
}

View File

@@ -18,6 +18,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
private SqlToolsSettingsValues mssqlTools = null;
private SqlToolsSettingsValues allSqlTools = null;
private TelemetrySettingsValues telemetrySettings = null;
private QueryEditorSettingsValues queryEditorSettings = null;
public ISqlToolsSettingsValues SqlTools
{
@@ -83,6 +84,23 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
}
}
/// <summary>
/// Gets or sets the underlying query editor settings value object
/// </summary>
[JsonProperty("queryEditor")]
public QueryEditorSettingsValues QueryEditorSettings
{
get
{
this.queryEditorSettings ??= new QueryEditorSettingsValues();
return this.queryEditorSettings;
}
set
{
this.queryEditorSettings = value;
}
}
/// <summary>
/// Query execution settings forwarding property
/// </summary>