// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.SqlTools.Hosting.Protocol.Contracts; using Microsoft.Kusto.ServiceLayer.LanguageServices.Contracts; using Microsoft.Kusto.ServiceLayer.Workspace.Contracts; namespace Microsoft.Kusto.ServiceLayer.Formatter.Contracts { /// /// A formatting request to process an entire document /// public class DocumentFormattingRequest { public static readonly RequestType Type = RequestType.Create("textDocument/formatting"); } /// /// A formatting request to process a specific range inside a document /// public class DocumentRangeFormattingRequest { public static readonly RequestType Type = RequestType.Create("textDocument/rangeFormatting"); } /// /// A formatting request to handle a user typing, giving a chance to update the text based on this /// public class DocumentOnTypeFormattingRequest { public static readonly RequestType Type = RequestType.Create("textDocument/onTypeFormatting"); } /// /// Params for the /// public class DocumentFormattingParams { /// /// The document to format. /// public TextDocumentIdentifier TextDocument { get; set; } /// /// The formatting options /// public FormattingOptions Options { get; set; } } /// /// Params for the /// public class DocumentRangeFormattingParams : DocumentFormattingParams { /// /// The range to format /// public Range Range { get; set; } } /// /// Params for the /// public class DocumentOnTypeFormattingParams : DocumentFormattingParams { /// /// The position at which this request was sent. /// Position Position { get; set; } /// /// The character that has been typed. /// string Ch { get; set; } } /// /// Value-object describing what options formatting should use. /// public class FormattingOptions { /// /// Size of a tab in spaces /// public int TabSize { get; set; } /// /// Prefer spaces over tabs. /// public bool InsertSpaces { get; set; } // TODO there may be other options passed by VSCode - format is // [key: string]: boolean | number | string; // Determine how these might be passed and add them here } }