support copy result in STS (#2096)

* use new sql parser

* copy results to clipboard

* fix parameter name
This commit is contained in:
Alan Ren
2023-06-09 09:15:08 -07:00
committed by GitHub
parent 94981d7bbe
commit 934df0556a
5 changed files with 204 additions and 13 deletions

View File

@@ -0,0 +1,56 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
{
public class TableSelectionRange
{
public int FromRow { get; set; }
public int ToRow { get; set; }
public int FromColumn { get; set; }
public int ToColumn { get; set; }
}
/// <summary>
/// Parameters for the copy results request
/// </summary>
public class CopyResultsRequestParams : SubsetParams
{
/// <summary>
/// Whether to remove the line break from cell values.
/// </summary>
public bool RemoveNewLines { get; set; }
/// <summary>
/// Whether to include the column headers.
/// </summary>
public bool IncludeHeaders { get; set; }
/// <summary>
/// The selections.
/// </summary>
public TableSelectionRange[] Selections { get; set; }
}
/// <summary>
/// Result for the copy results request
/// </summary>
public class CopyResultsRequestResult
{
}
/// <summary>
/// Copy Results Request
/// </summary>
public class CopyResultsRequest
{
public static readonly RequestType<CopyResultsRequestParams, CopyResultsRequestResult> Type =
RequestType<CopyResultsRequestParams, CopyResultsRequestResult>.Create("query/copy");
}
}