diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Contracts/CopyResultsRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Contracts/CopyResultsRequest.cs
index d1e45d64..9ec3928a 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Contracts/CopyResultsRequest.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Contracts/CopyResultsRequest.cs
@@ -22,21 +22,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
///
public class CopyResultsRequestParams : SubsetParams
{
- ///
- /// Whether to remove the line break from cell values.
- ///
- public bool RemoveNewLines { get; set; }
-
- ///
- /// Whether to avoid adding a line break between rows during row concatenation for copying result when the previous row already has a trailing line break.
- ///
- public bool AvoidNewLineAfterTailingLineBreak { get; set; }
-
- ///
- /// Whether to include the column headers.
- ///
- public bool IncludeHeaders { get; set; }
-
///
/// The selections.
///
diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/QueryExecutionService.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/QueryExecutionService.cs
index 0fc91726..19b47e1c 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/QueryExecutionService.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/QueryExecutionService.cs
@@ -729,7 +729,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
var lastRowIndex = rowRanges.Last().End;
var builder = new StringBuilder();
var pageSize = 200;
- if (requestParams.IncludeHeaders)
+ if (Settings.QueryEditorSettings.Results.CopyIncludeHeaders)
{
Validate.IsNotNullOrEmptyString(nameof(requestParams.OwnerUri), requestParams.OwnerUri);
Query query;
@@ -780,7 +780,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
selection.FromColumn <= columnIndex &&
selection.ToColumn >= columnIndex))
{
- builder.Append(requestParams.RemoveNewLines ? row[columnIndex].DisplayValue.ReplaceLineEndings(" ") : row[columnIndex].DisplayValue);
+ builder.Append(Settings.QueryEditorSettings.Results.CopyRemoveNewLine ? row[columnIndex].DisplayValue.ReplaceLineEndings(" ") : row[columnIndex].DisplayValue);
}
if (columnIndex != lastColumnIndex)
{
@@ -789,7 +789,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
}
}
// Add line break if this is not the last row in all selections.
- if (rowIndex + pageStartRowIndex != lastRowIndex && (!builder.ToString().EndsWith(Environment.NewLine) || !requestParams.AvoidNewLineAfterTailingLineBreak))
+ if (rowIndex + pageStartRowIndex != lastRowIndex && (!builder.ToString().EndsWith(Environment.NewLine) || !Settings.QueryEditorSettings.Results.SkipNewLineAfterTrailingLineBreak))
{
builder.Append(Environment.NewLine);
}
@@ -1141,6 +1141,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
internal Task UpdateSettings(SqlToolsSettings newSettings, SqlToolsSettings oldSettings, EventContext eventContext)
{
Settings.QueryExecutionSettings.Update(newSettings.QueryExecutionSettings);
+ Settings.QueryEditorSettings.Update(newSettings.QueryEditorSettings);
return Task.FromResult(0);
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorResultsSettingsValues.cs b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorResultsSettingsValues.cs
new file mode 100644
index 00000000..0986aa94
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorResultsSettingsValues.cs
@@ -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
+ {
+ ///
+ /// Whether to remove the line break from cell values when copying results.
+ ///
+ public bool CopyRemoveNewLine { get; set; } = true;
+
+ ///
+ /// Whether to skip adding a line break between rows when copying results when the previous row already has a trailing line break.
+ ///
+ public bool SkipNewLineAfterTrailingLineBreak { get; set; } = false;
+
+ ///
+ /// Whether to include the column headers when copying results.
+ ///
+ public bool CopyIncludeHeaders { get; set; } = false;
+
+ }
+}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorSettingsValues.cs b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorSettingsValues.cs
new file mode 100644
index 00000000..479a3be0
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/QueryEditorSettingsValues.cs
@@ -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
+ {
+ ///
+ /// Gets or sets the results setting
+ ///
+ [JsonProperty("results")]
+ public QueryEditorResultSettingsValues? Results { get; set; }
+
+ ///
+ /// Update the current settings with the new settings
+ ///
+ /// The new settings
+ public void Update(QueryEditorSettingsValues newSettings)
+ {
+ if (newSettings != null)
+ {
+ Results = newSettings.Results ?? Results;
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/SqlContext/SqlToolsSettings.cs b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/SqlToolsSettings.cs
index b7c0eed0..4ded2a44 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/SqlContext/SqlToolsSettings.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/SqlContext/SqlToolsSettings.cs
@@ -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
}
}
+ ///
+ /// Gets or sets the underlying query editor settings value object
+ ///
+ [JsonProperty("queryEditor")]
+ public QueryEditorSettingsValues QueryEditorSettings
+ {
+ get
+ {
+ this.queryEditorSettings ??= new QueryEditorSettingsValues();
+ return this.queryEditorSettings;
+ }
+ set
+ {
+ this.queryEditorSettings = value;
+ }
+ }
+
///
/// Query execution settings forwarding property
///