diff --git a/src/LanguageServer/Protocol/Protocol/CompletionParams.cs b/src/LanguageServer/Protocol/Protocol/CompletionParams.cs index 33a94014e2cef..cd0d6b507d778 100644 --- a/src/LanguageServer/Protocol/Protocol/CompletionParams.cs +++ b/src/LanguageServer/Protocol/Protocol/CompletionParams.cs @@ -13,7 +13,7 @@ namespace Roslyn.LanguageServer.Protocol; /// See the Language Server Protocol specification for additional information. /// /// -internal sealed class CompletionParams : TextDocumentPositionParams, IPartialResultParams?>, IWorkDoneProgressOptions +internal sealed class CompletionParams : TextDocumentPositionParams, IPartialResultParams?>, IWorkDoneProgressParams { /// /// The completion context. This is only available if the client specifies the @@ -37,7 +37,7 @@ public IProgress?>? PartialResultToken } /// - [JsonPropertyName("workDoneProgress")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public bool WorkDoneProgress { get; init; } + [JsonPropertyName(Methods.WorkDoneTokenName)] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public IProgress? WorkDoneToken { get; set; } } diff --git a/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs b/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs index 956d3269997eb..e8bccf1860f70 100644 --- a/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs +++ b/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingOptions.cs @@ -18,4 +18,12 @@ internal class DocumentRangeFormattingOptions : IWorkDoneProgressOptions [JsonPropertyName("workDoneProgress")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public bool WorkDoneProgress { get; init; } + + /// + /// Whether the server supports formatting multiple ranges at once. + /// + /// Since LSP 3.18 + [JsonPropertyName("rangesSupport")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + public bool RangesSupport { get; init; } } diff --git a/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs b/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs index 0621faaca11a9..57dcd8d4daa2b 100644 --- a/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs +++ b/src/LanguageServer/Protocol/Protocol/DocumentRangeFormattingParams.cs @@ -4,6 +4,7 @@ namespace Roslyn.LanguageServer.Protocol; +using System; using System.Text.Json.Serialization; /// @@ -12,7 +13,7 @@ namespace Roslyn.LanguageServer.Protocol; /// See the Language Server Protocol specification for additional information. /// /// -internal sealed class DocumentRangeFormattingParams : ITextDocumentParams +internal sealed class DocumentRangeFormattingParams : ITextDocumentParams, IWorkDoneProgressParams { /// /// Gets or sets the identifier for the text document to be formatted. @@ -46,4 +47,9 @@ public FormattingOptions Options get; set; } + + /// + [JsonPropertyName(Methods.WorkDoneTokenName)] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public IProgress? WorkDoneToken { get; set; } } diff --git a/src/LanguageServer/Protocol/Protocol/DocumentRangesFormattingParams.cs b/src/LanguageServer/Protocol/Protocol/DocumentRangesFormattingParams.cs new file mode 100644 index 0000000000000..fce2dad38f75a --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/DocumentRangesFormattingParams.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Text.Json.Serialization; + +/// +/// Class which represents the parameter that is sent with textDocument/rangesFormatting message. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class DocumentRangesFormattingParams : ITextDocumentParams, IWorkDoneProgressParams +{ + /// + /// Gets or sets the identifier for the text document to be formatted. + /// + [JsonPropertyName("textDocument")] + [JsonRequired] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// Gets or sets the ranges to format. + /// + [JsonPropertyName("ranges")] + [JsonRequired] + public Range[] Ranges { get; set; } + + /// + /// Gets or sets the formatting options. + /// + [JsonPropertyName("options")] + [JsonRequired] + public FormattingOptions Options { get; set; } + + /// + [JsonPropertyName(Methods.WorkDoneTokenName)] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public IProgress? WorkDoneToken { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InitializeParams.cs b/src/LanguageServer/Protocol/Protocol/InitializeParams.cs index 29bd0abb68fa6..77235618d35a5 100644 --- a/src/LanguageServer/Protocol/Protocol/InitializeParams.cs +++ b/src/LanguageServer/Protocol/Protocol/InitializeParams.cs @@ -107,14 +107,14 @@ public ClientCapabilities Capabilities /// Gets or sets the initial trace setting. /// [JsonPropertyName("trace")] - [DefaultValue(typeof(TraceSetting), "off")] + [DefaultValue(typeof(TraceValue), "off")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public TraceSetting Trace + public TraceValue Trace { get; set; #pragma warning disable SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line - } = TraceSetting.Off; + } = TraceValue.Off; #pragma warning restore SA1500, SA1513 // Braces for multi-line statements should not share line, Closing brace should be followed by blank line /// diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionClientCapabilities.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionClientCapabilities.cs new file mode 100644 index 0000000000000..a6947ca77a332 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionClientCapabilities.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Client capabilities specific to inline completions. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionClientCapabilities : DynamicRegistrationSetting +{ +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionContext.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionContext.cs new file mode 100644 index 0000000000000..f72a741f27dc0 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionContext.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// Provides information about the context in which an inline completion was requested. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionContext +{ + /// + /// Describes how the inline completion was triggered. + /// + [JsonPropertyName("triggerKind")] + [JsonRequired] + public InlineCompletionTriggerKind TriggerKind { get; set; } + + /// + /// Provides information about the currently selected item in the autocomplete widget + /// if it is visible. + /// + /// If set, provided inline completions must extend the text of the selected item + /// and use the same range, otherwise they are not shown as preview. + /// As an example, if the document text is console. and the selected item is + /// .log replacing the . in the document, the inline completion must + /// also replace . and start with .log, for example .telemet. + /// + /// + /// Inline completion providers are requested again whenever the selected item changes. + /// + /// + [JsonPropertyName("selectedCompletionInfo")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public SelectedCompletionInfo? SelectedCompletionInfo { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionItem.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionItem.cs new file mode 100644 index 0000000000000..19dd7fb9304df --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionItem.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// An inline completion item represents a text snippet that is proposed inline +/// to complete text that is being typed. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionItem +{ + /// + /// The text to replace the range with. Must be set. + /// + /// Is used both for the preview and the accept operation. + /// + /// + [JsonPropertyName("insertText")] + [JsonRequired] + public SumType InsertText { get; set; } + + /// + /// A text that is used to decide if this inline completion should be shown. + /// When the is used. + /// + /// An inline completion is shown if the text to replace is a prefix of the + /// filter text. + /// + /// + [JsonPropertyName("filterText")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? FilterText { get; set; } + + /// + /// The range to replace. + /// + /// Must begin and end on the same line. + /// + /// + /// Prefer replacements over insertions to provide a better experience when + /// the user deletes typed text. + /// + /// + [JsonPropertyName("range")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Range? Range { get; set; } + + /// + /// An optional that is executed after + /// inserting this completion. + /// + [JsonPropertyName("command")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Command? Command { get; set; } + + /// + /// The format of the insert text. The format applies to the . + /// If omitted defaults to . + /// + [JsonPropertyName("insertTextFormat")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + public InsertTextFormat InsertTextFormat { get; set; } = InsertTextFormat.Plaintext; +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionList.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionList.cs new file mode 100644 index 0000000000000..3e693723bfbd0 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionList.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// Represents a collection of inline completion items to be presented in the editor. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionList +{ + /// + /// The inline completion items. + /// + [JsonPropertyName("items")] + [JsonRequired] + public InlineCompletionItem[] Items { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionOptions.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionOptions.cs new file mode 100644 index 0000000000000..ff026de945bb9 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionOptions.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// Inline completion options used during static registration. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal class InlineCompletionOptions : IWorkDoneProgressOptions +{ + /// + [JsonPropertyName("workDoneProgress")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + public bool WorkDoneProgress { get; init; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionParams.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionParams.cs new file mode 100644 index 0000000000000..b5886dcd4372c --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionParams.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System; +using System.Text.Json.Serialization; + +/// +/// A parameter literal used in inline completion requests. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionParams : ITextDocumentPositionParams, IWorkDoneProgressParams +{ + /// + /// The text document. + /// + [JsonPropertyName("textDocument")] + [JsonRequired] + public TextDocumentIdentifier TextDocument { get; set; } + + /// + /// The position inside the text document. + /// + [JsonPropertyName("position")] + [JsonRequired] + public Position Position { get; set; } + + /// + /// Additional information about the context in which inline completions + /// were requested. + /// + [JsonPropertyName("context")] + [JsonRequired] + public InlineCompletionContext Context { get; set; } + + /// + [JsonPropertyName(Methods.WorkDoneTokenName)] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public IProgress? WorkDoneToken { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionRegistrationOptions.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionRegistrationOptions.cs new file mode 100644 index 0000000000000..69023b0cd52b5 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionRegistrationOptions.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// Inline completion options used during static or dynamic capability registration. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class InlineCompletionRegistrationOptions : InlineCompletionOptions, ITextDocumentRegistrationOptions, IStaticRegistrationOptions +{ + /// + [JsonPropertyName("documentSelector")] + public DocumentFilter[]? DocumentSelector { get; set; } + + /// + [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Id { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionTriggerKind.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionTriggerKind.cs new file mode 100644 index 0000000000000..e60e7a2f4ef3e --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionTriggerKind.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +/// +/// Describes how an inline completion request was triggered. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal enum InlineCompletionTriggerKind +{ + /// + /// Completion was triggered explicitly by a user gesture. + /// + Invoked = 1, + + /// + /// Completion was triggered automatically while editing. + /// + Automatic = 2, +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/SelectedCompletionInfo.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/SelectedCompletionInfo.cs new file mode 100644 index 0000000000000..828af8aa38efa --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/SelectedCompletionInfo.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// Describes the currently selected completion item. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class SelectedCompletionInfo +{ + /// + /// The range that will be replaced if this completion item is accepted. + /// + [JsonPropertyName("range")] + [JsonRequired] + public Range Range { get; set; } + + /// + /// The text the range will be replaced with if this completion is accepted. + /// + [JsonPropertyName("text")] + [JsonRequired] + public string Text { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/InlineCompletions/StringValue.cs b/src/LanguageServer/Protocol/Protocol/InlineCompletions/StringValue.cs new file mode 100644 index 0000000000000..acd8ca671fef4 --- /dev/null +++ b/src/LanguageServer/Protocol/Protocol/InlineCompletions/StringValue.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Roslyn.LanguageServer.Protocol; + +using System.Text.Json.Serialization; + +/// +/// A string value used as a snippet, a computed value, or with both. +/// +/// See the Language Server Protocol specification for additional information. +/// +/// +/// Since LSP 3.18 +internal sealed class StringValue +{ + /// + /// The kind of string value. + /// + [JsonPropertyName("kind")] + [JsonRequired] + public string Kind { get; init; } = "snippet"; + + /// + /// The snippet string. + /// + [JsonPropertyName("value")] + [JsonRequired] + public string Value { get; set; } +} diff --git a/src/LanguageServer/Protocol/Protocol/Methods.Document.cs b/src/LanguageServer/Protocol/Protocol/Methods.Document.cs index cf9ee709397e9..97e770de5154f 100644 --- a/src/LanguageServer/Protocol/Protocol/Methods.Document.cs +++ b/src/LanguageServer/Protocol/Protocol/Methods.Document.cs @@ -372,7 +372,7 @@ partial class Methods /// /// /// If computing full completion items is expensive, servers can additionally provide a handler for the completion - /// item resolve request (‘completionItem/resolve’), which is sent when a completion item is selected in the user interface. + /// item resolve request (‘completionItem/resolve’), which is sent when a completion item is selected in the user interface. /// /// /// See the Language Server Protocol specification for additional information. @@ -401,6 +401,26 @@ partial class Methods /// public static readonly LspRequest TextDocumentCompletionResolve = new(TextDocumentCompletionResolveName); + /// + /// Method name for 'textDocument/inlineCompletion'. + /// + /// The inline completion request is sent from the client to the server to compute inline + /// completions at a given cursor position. Inline completions are similar to completions + /// but are displayed inline with the text and can only be accepted or rejected. + /// + /// + /// See the Language Server Protocol specification for additional information. + /// + /// + /// Since LSP 3.18 + public const string TextDocumentInlineCompletionName = "textDocument/inlineCompletion"; + + /// + /// Strongly typed message object for 'textDocument/inlineCompletion'. + /// + /// Since LSP 3.18 + public static readonly LspRequest?> TextDocumentInlineCompletion = new(TextDocumentInlineCompletionName); + /// /// Method name for 'textDocument/signatureHelp'. /// @@ -547,6 +567,23 @@ partial class Methods /// public static readonly LspRequest TextDocumentRangeFormatting = new(TextDocumentRangeFormattingName); + /// + /// Method name for 'textDocument/rangesFormatting'. + /// + /// The document ranges formatting request is sent from the client to the server to format multiple ranges in a document at once. + /// + /// + /// See the Language Server Protocol specification for additional information. + /// + /// + /// Since LSP 3.18 + public const string TextDocumentRangesFormattingName = "textDocument/rangesFormatting"; + + /// + /// Strongly typed message object for 'textDocument/rangesFormatting'. + /// + public static readonly LspRequest TextDocumentRangesFormatting = new(TextDocumentRangesFormattingName); + /// /// Method name for 'textDocument/onTypeFormatting'. /// diff --git a/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyIncomingCallsParams.cs b/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyIncomingCallsParams.cs index b2c27eaf0e4ee..c10508481ac3a 100644 --- a/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyIncomingCallsParams.cs +++ b/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyIncomingCallsParams.cs @@ -14,7 +14,7 @@ namespace Roslyn.LanguageServer.Protocol; /// /// /// Since LSP 3.16 -internal sealed class CallHierarchyIncomingCallsParams : TextDocumentPositionParams, IWorkDoneProgressParams, IPartialResultParams +internal sealed class CallHierarchyIncomingCallsParams : IWorkDoneProgressParams, IPartialResultParams { /// /// The item returned from `textDocument/prepareCallHierarchy` @@ -29,9 +29,6 @@ internal sealed class CallHierarchyIncomingCallsParams : TextDocumentPositionPar public IProgress? WorkDoneToken { get; set; } /// - /// - /// may only be used if the client opts in via - /// [JsonPropertyName(Methods.PartialResultTokenName)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public IProgress? PartialResultToken { get; set; } diff --git a/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyOutgoingCallsParams.cs b/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyOutgoingCallsParams.cs index c0297ac170bf5..3f4e94d47a5f9 100644 --- a/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyOutgoingCallsParams.cs +++ b/src/LanguageServer/Protocol/Protocol/Navigation/CallHierarchyOutgoingCallsParams.cs @@ -8,13 +8,13 @@ namespace Roslyn.LanguageServer.Protocol; /// -/// The params sent in a 'callHierarchy/incomingCalls' request. +/// The params sent in a 'callHierarchy/outgoingCalls' request. /// -/// See the Language Server Protocol specification for additional information. +/// See the Language Server Protocol specification for additional information. /// /// /// Since LSP 3.16 -internal sealed class CallHierarchyOutgoingCallsParams : TextDocumentPositionParams, IWorkDoneProgressParams, IPartialResultParams +internal sealed class CallHierarchyOutgoingCallsParams : IWorkDoneProgressParams, IPartialResultParams { /// /// The item returned from `textDocument/prepareCallHierarchy` @@ -29,9 +29,6 @@ internal sealed class CallHierarchyOutgoingCallsParams : TextDocumentPositionPar public IProgress? WorkDoneToken { get; set; } /// - /// - /// may only be used if the client opts in via - /// [JsonPropertyName(Methods.PartialResultTokenName)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public IProgress? PartialResultToken { get; set; } diff --git a/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySubtypesParams.cs b/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySubtypesParams.cs index 1f74a2466d16b..4fb75c3b70c33 100644 --- a/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySubtypesParams.cs +++ b/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySubtypesParams.cs @@ -14,7 +14,7 @@ namespace Roslyn.LanguageServer.Protocol; /// /// /// Since LSP 3.17 -internal sealed class TypeHierarchySubtypesParams : TextDocumentPositionParams, IWorkDoneProgressParams, IPartialResultParams +internal sealed class TypeHierarchySubtypesParams : IWorkDoneProgressParams, IPartialResultParams { /// /// The for which to return subtypes @@ -29,9 +29,6 @@ internal sealed class TypeHierarchySubtypesParams : TextDocumentPositionParams, public IProgress? WorkDoneToken { get; set; } /// - /// - /// may only be used if the client opts in via - /// [JsonPropertyName(Methods.PartialResultTokenName)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public IProgress? PartialResultToken { get; set; } diff --git a/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySupertypesParams.cs b/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySupertypesParams.cs index 7ab19e1bac9ac..0f0dcbb48b54a 100644 --- a/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySupertypesParams.cs +++ b/src/LanguageServer/Protocol/Protocol/Navigation/TypeHierarchySupertypesParams.cs @@ -10,11 +10,11 @@ namespace Roslyn.LanguageServer.Protocol; /// /// The params sent in a 'typeHierarchy/supertypes' request. /// -/// See the Language Server Protocol specification for additional information. +/// See the Language Server Protocol specification for additional information. /// /// /// Since LSP 3.17 -internal sealed class TypeHierarchySupertypesParams : TextDocumentPositionParams, IWorkDoneProgressParams, IPartialResultParams +internal sealed class TypeHierarchySupertypesParams : IWorkDoneProgressParams, IPartialResultParams { /// /// The for which to return supertypes @@ -29,9 +29,6 @@ internal sealed class TypeHierarchySupertypesParams : TextDocumentPositionParams public IProgress? WorkDoneToken { get; set; } /// - /// - /// may only be used if the client opts in via - /// [JsonPropertyName(Methods.PartialResultTokenName)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public IProgress? PartialResultToken { get; set; } diff --git a/src/LanguageServer/Protocol/Protocol/RangeFormattingClientCapabilities.cs b/src/LanguageServer/Protocol/Protocol/RangeFormattingClientCapabilities.cs index 7bd6d1e8b18ae..51f18f69a34e0 100644 --- a/src/LanguageServer/Protocol/Protocol/RangeFormattingClientCapabilities.cs +++ b/src/LanguageServer/Protocol/Protocol/RangeFormattingClientCapabilities.cs @@ -4,6 +4,8 @@ namespace Roslyn.LanguageServer.Protocol; +using System.Text.Json.Serialization; + /// /// Capabilities specific to the `textDocument/rangeFormatting` request. /// @@ -12,4 +14,11 @@ namespace Roslyn.LanguageServer.Protocol; /// internal sealed class RangeFormattingClientCapabilities : DynamicRegistrationSetting { + /// + /// Whether the client supports formatting multiple ranges at once. + /// + /// Since LSP 3.18 + [JsonPropertyName("rangesSupport")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + public bool RangesSupport { get; init; } } diff --git a/src/LanguageServer/Protocol/Protocol/ServerCapabilities.cs b/src/LanguageServer/Protocol/Protocol/ServerCapabilities.cs index e986cbc6bc3a8..40da11494d311 100644 --- a/src/LanguageServer/Protocol/Protocol/ServerCapabilities.cs +++ b/src/LanguageServer/Protocol/Protocol/ServerCapabilities.cs @@ -286,6 +286,14 @@ public TextDocumentSyncOptions? TextDocumentSync [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public SumType? WorkspaceSymbolProvider { get; set; } + /// + /// The server provides inline completions. + /// + /// Since LSP 3.18 + [JsonPropertyName("inlineCompletionProvider")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public SumType? InlineCompletionProvider { get; set; } + /// /// Workspace specific server capabilities. /// diff --git a/src/LanguageServer/Protocol/Protocol/TextDocumentClientCapabilities.cs b/src/LanguageServer/Protocol/Protocol/TextDocumentClientCapabilities.cs index 0bb1af5fca422..f686c7b974ae7 100644 --- a/src/LanguageServer/Protocol/Protocol/TextDocumentClientCapabilities.cs +++ b/src/LanguageServer/Protocol/Protocol/TextDocumentClientCapabilities.cs @@ -239,4 +239,12 @@ internal class TextDocumentClientCapabilities [JsonPropertyName("diagnostic")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public DiagnosticSetting? Diagnostic { get; set; } + + /// + /// Capabilities specific to the `textDocument/inlineCompletion` request. + /// + /// Since LSP 3.18 + [JsonPropertyName("inlineCompletion")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public InlineCompletionClientCapabilities? InlineCompletion { get; set; } } diff --git a/src/LanguageServer/Protocol/Protocol/TraceSetting.cs b/src/LanguageServer/Protocol/Protocol/TraceSetting.cs deleted file mode 100644 index da43e3361c8b6..0000000000000 --- a/src/LanguageServer/Protocol/Protocol/TraceSetting.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Roslyn.LanguageServer.Protocol; - -using System.ComponentModel; -using System.Text.Json.Serialization; - -/// -/// Value representing the language server trace setting. -/// -/// See the Language Server Protocol specification for additional information. -/// -[JsonConverter(typeof(StringEnumConverter))] -[TypeConverter(typeof(StringEnumConverter.TypeConverter))] -internal readonly record struct TraceSetting(string Value) : IStringEnum -{ - /// - /// Setting for 'off'. - /// - public static readonly TraceSetting Off = new("off"); - - /// - /// Setting for 'messages'. - /// - public static readonly TraceSetting Messages = new("messages"); - - /// - /// Setting for 'verbose'. - /// - public static readonly TraceSetting Verbose = new("verbose"); -}