Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/LanguageServer/Protocol/Protocol/CompletionParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Roslyn.LanguageServer.Protocol;
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#completionParams">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal sealed class CompletionParams : TextDocumentPositionParams, IPartialResultParams<SumType<CompletionItem[], CompletionList>?>, IWorkDoneProgressOptions
internal sealed class CompletionParams : TextDocumentPositionParams, IPartialResultParams<SumType<CompletionItem[], CompletionList>?>, IWorkDoneProgressParams
{
/// <summary>
/// The completion context. This is only available if the client specifies the
Expand All @@ -37,7 +37,7 @@ public IProgress<SumType<CompletionItem[], CompletionList>?>? PartialResultToken
}

/// <inheritdoc/>
[JsonPropertyName("workDoneProgress")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool WorkDoneProgress { get; init; }
[JsonPropertyName(Methods.WorkDoneTokenName)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IProgress<WorkDoneProgress>? WorkDoneToken { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ internal class DocumentRangeFormattingOptions : IWorkDoneProgressOptions
[JsonPropertyName("workDoneProgress")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool WorkDoneProgress { get; init; }

/// <summary>
/// Whether the server supports formatting multiple ranges at once.
/// </summary>
/// <remarks>Since LSP 3.18</remarks>
[JsonPropertyName("rangesSupport")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool RangesSupport { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Roslyn.LanguageServer.Protocol;

using System;
using System.Text.Json.Serialization;

/// <summary>
Expand All @@ -12,7 +13,7 @@ namespace Roslyn.LanguageServer.Protocol;
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#documentRangeFormattingParams">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal sealed class DocumentRangeFormattingParams : ITextDocumentParams
internal sealed class DocumentRangeFormattingParams : ITextDocumentParams, IWorkDoneProgressParams
{
/// <summary>
/// Gets or sets the identifier for the text document to be formatted.
Expand Down Expand Up @@ -46,4 +47,9 @@ public FormattingOptions Options
get;
set;
}

/// <inheritdoc/>
[JsonPropertyName(Methods.WorkDoneTokenName)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IProgress<WorkDoneProgress>? WorkDoneToken { get; set; }
}
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; }
}
6 changes: 3 additions & 3 deletions src/LanguageServer/Protocol/Protocol/InitializeParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public ClientCapabilities Capabilities
/// Gets or sets the initial trace setting.
/// </summary>
[JsonPropertyName("trace")]
[DefaultValue(typeof(TraceSetting), "off")]
[DefaultValue(typeof(TraceValue), "off")]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had TraceValue and TraceSetting. They are now unified as TraceValue

[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

/// <summary>
Expand Down
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
{
}
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; }
}
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;
}
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; }
}
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; }
}
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; }
}
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; }
}
Loading
Loading