Export to Markdown Support (#1705)

* Adding file writer for Markdown tables. No testing yet.

* Unit tests for the markdown writer

* Wiring up the factory and and request types

* Wiring up changes for Markdown serialization in serialization service

* Couple last minute tweaks

* Changes as per PR comments

* Revert temp testing code. 🙈

* Fluent assertions in SerializationServiceTests.cs

Co-authored-by: Ben Russell <russellben@microsoft.com>
This commit is contained in:
Benjamin Russell
2022-09-27 13:55:43 -05:00
committed by GitHub
parent 5c20f92312
commit af2c0c77e7
10 changed files with 905 additions and 54 deletions

View File

@@ -84,7 +84,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
public string Delimiter { get; set; }
/// <summary>
/// either CR, CRLF or LF to seperate rows in CSV
/// either CR, CRLF or LF to separate rows in CSV
/// </summary>
public string LineSeperator { get; set; }
@@ -123,6 +123,28 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
//TODO: define config for save as JSON
}
/// <summary>
/// Parameters for saving results as a Markdown table
/// </summary>
public class SaveResultsAsMarkdownRequestParams : SaveResultsRequestParams
{
/// <summary>
/// Encoding of the CSV file
/// </summary>
public string Encoding { get; set; }
/// <summary>
/// Whether to include column names as header for the table.
/// </summary>
public bool IncludeHeaders { get; set; }
/// <summary>
/// Character sequence to separate a each row in the table. Should be either CR, CRLF, or
/// LF. If not provided, defaults to the system default line ending sequence.
/// </summary>
public string? LineSeparator { get; set; }
}
/// <summary>
/// Parameters to save results as XML
/// </summary>
@@ -179,6 +201,16 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
RequestType<SaveResultsAsJsonRequestParams, SaveResultRequestResult> Type =
RequestType<SaveResultsAsJsonRequestParams, SaveResultRequestResult>.Create("query/saveJson");
}
/// <summary>
/// Request type to save results as a Markdown table
/// </summary>
public class SaveResultsAsMarkdownRequest
{
public static readonly
RequestType<SaveResultsAsMarkdownRequestParams, SaveResultRequestResult> Type =
RequestType<SaveResultsAsMarkdownRequestParams, SaveResultRequestResult>.Create("query/saveMarkdown");
}
/// <summary>
/// Request type to save results as XML