-
Notifications
You must be signed in to change notification settings - Fork 4.3k
LSP 3.18 protocol updates #82294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
LSP 3.18 protocol updates #82294
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1d60cfd
Add inline completion to the protocol
JoeRobich 4d5658f
Adds document ranges formatting support
JoeRobich d6a8f05
Fixup the Call and Type Hierarchy params
JoeRobich 9c95faf
Unify TraceSetting and TraceValue types
JoeRobich 5672cec
Use WorkDoneProgressParams were necessary
JoeRobich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/LanguageServer/Protocol/Protocol/DocumentRangesFormattingParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Class which represents the parameter that is sent with textDocument/rangesFormatting message. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#documentRangesFormattingParams">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class DocumentRangesFormattingParams : ITextDocumentParams, IWorkDoneProgressParams | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the identifier for the text document to be formatted. | ||
| /// </summary> | ||
| [JsonPropertyName("textDocument")] | ||
| [JsonRequired] | ||
| public TextDocumentIdentifier TextDocument { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the ranges to format. | ||
| /// </summary> | ||
| [JsonPropertyName("ranges")] | ||
| [JsonRequired] | ||
| public Range[] Ranges { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the formatting options. | ||
| /// </summary> | ||
| [JsonPropertyName("options")] | ||
| [JsonRequired] | ||
| public FormattingOptions Options { get; set; } | ||
|
|
||
| /// <inheritdoc/> | ||
| [JsonPropertyName(Methods.WorkDoneTokenName)] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public IProgress<WorkDoneProgress>? WorkDoneToken { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionClientCapabilities.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Client capabilities specific to inline completions. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionClientCapabilities">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionClientCapabilities : DynamicRegistrationSetting | ||
| { | ||
| } |
42 changes: 42 additions & 0 deletions
42
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Provides information about the context in which an inline completion was requested. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionContext">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionContext | ||
| { | ||
| /// <summary> | ||
| /// Describes how the inline completion was triggered. | ||
| /// </summary> | ||
| [JsonPropertyName("triggerKind")] | ||
| [JsonRequired] | ||
| public InlineCompletionTriggerKind TriggerKind { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Provides information about the currently selected item in the autocomplete widget | ||
| /// if it is visible. | ||
| /// <para> | ||
| /// 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 <c>console.</c> and the selected item is | ||
| /// <c>.log</c> replacing the <c>.</c> in the document, the inline completion must | ||
| /// also replace <c>.</c> and start with <c>.log</c>, for example <c>.telemet</c>. | ||
| /// </para> | ||
| /// <para> | ||
| /// Inline completion providers are requested again whenever the selected item changes. | ||
| /// </para> | ||
| /// </summary> | ||
| [JsonPropertyName("selectedCompletionInfo")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public SelectedCompletionInfo? SelectedCompletionInfo { get; set; } | ||
| } |
70 changes: 70 additions & 0 deletions
70
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionItem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// An inline completion item represents a text snippet that is proposed inline | ||
| /// to complete text that is being typed. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionItem">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionItem | ||
| { | ||
| /// <summary> | ||
| /// The text to replace the range with. Must be set. | ||
| /// <para> | ||
| /// Is used both for the preview and the accept operation. | ||
| /// </para> | ||
| /// </summary> | ||
| [JsonPropertyName("insertText")] | ||
| [JsonRequired] | ||
| public SumType<string, StringValue> InsertText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// A text that is used to decide if this inline completion should be shown. | ||
| /// When <see langword="null"/> the <see cref="InlineCompletionItem.InsertText"/> is used. | ||
| /// <para> | ||
| /// An inline completion is shown if the text to replace is a prefix of the | ||
| /// filter text. | ||
| /// </para> | ||
| /// </summary> | ||
| [JsonPropertyName("filterText")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public string? FilterText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The range to replace. | ||
| /// <para> | ||
| /// Must begin and end on the same line. | ||
| /// </para> | ||
| /// <para> | ||
| /// Prefer replacements over insertions to provide a better experience when | ||
| /// the user deletes typed text. | ||
| /// </para> | ||
| /// </summary> | ||
| [JsonPropertyName("range")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public Range? Range { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// An optional <see cref="Protocol.Command"/> that is executed <em>after</em> | ||
| /// inserting this completion. | ||
| /// </summary> | ||
| [JsonPropertyName("command")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public Command? Command { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The format of the insert text. The format applies to the <see cref="InsertText"/>. | ||
| /// If omitted defaults to <see cref="InsertTextFormat.Plaintext"/>. | ||
| /// </summary> | ||
| [JsonPropertyName("insertTextFormat")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
| public InsertTextFormat InsertTextFormat { get; set; } = InsertTextFormat.Plaintext; | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionList.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Represents a collection of inline completion items to be presented in the editor. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionList">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionList | ||
| { | ||
| /// <summary> | ||
| /// The inline completion items. | ||
| /// </summary> | ||
| [JsonPropertyName("items")] | ||
| [JsonRequired] | ||
| public InlineCompletionItem[] Items { get; set; } | ||
| } |
22 changes: 22 additions & 0 deletions
22
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Inline completion options used during static registration. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionOptions">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal class InlineCompletionOptions : IWorkDoneProgressOptions | ||
| { | ||
| /// <inheritdoc/> | ||
| [JsonPropertyName("workDoneProgress")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
| public bool WorkDoneProgress { get; init; } | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// A parameter literal used in inline completion requests. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionParams">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionParams : ITextDocumentPositionParams, IWorkDoneProgressParams | ||
| { | ||
| /// <summary> | ||
| /// The text document. | ||
| /// </summary> | ||
| [JsonPropertyName("textDocument")] | ||
| [JsonRequired] | ||
| public TextDocumentIdentifier TextDocument { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The position inside the text document. | ||
| /// </summary> | ||
| [JsonPropertyName("position")] | ||
| [JsonRequired] | ||
| public Position Position { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Additional information about the context in which inline completions | ||
| /// were requested. | ||
| /// </summary> | ||
| [JsonPropertyName("context")] | ||
| [JsonRequired] | ||
| public InlineCompletionContext Context { get; set; } | ||
|
|
||
| /// <inheritdoc/> | ||
| [JsonPropertyName(Methods.WorkDoneTokenName)] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public IProgress<WorkDoneProgress>? WorkDoneToken { get; set; } | ||
| } |
26 changes: 26 additions & 0 deletions
26
...LanguageServer/Protocol/Protocol/InlineCompletions/InlineCompletionRegistrationOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
|
|
||
| /// <summary> | ||
| /// Inline completion options used during static or dynamic capability registration. | ||
| /// <para> | ||
| /// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#inlineCompletionRegistrationOptions">Language Server Protocol specification</see> for additional information. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks>Since LSP 3.18</remarks> | ||
| internal sealed class InlineCompletionRegistrationOptions : InlineCompletionOptions, ITextDocumentRegistrationOptions, IStaticRegistrationOptions | ||
| { | ||
| /// <inheritdoc/> | ||
| [JsonPropertyName("documentSelector")] | ||
| public DocumentFilter[]? DocumentSelector { get; set; } | ||
|
|
||
| /// <inheritdoc/> | ||
| [JsonPropertyName("id")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public string? Id { get; set; } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had
TraceValueandTraceSetting. They are now unified asTraceValue