Skip to content

Commit

Permalink
LSP Protocol: Update several interface types
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed Jun 17, 2024
1 parent 126482b commit 9098078
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;

namespace Roslyn.LanguageServer.Protocol;

/// <summary>
/// Interface representing the static registration options for options returned in the initialize request.
///
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#staticRegistrationOptions">Language Server Protocol specification</see> for additional information.
/// <para>
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#staticRegistrationOptions">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal interface IStaticRegistrationOptions
{
/// <summary>
/// Gets or sets the id used to register the request. The id can be used to deregister the request again.
/// Gets or sets the id used to register the request. The id can be used to deregister the request again.
/// </summary>
[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Id { get; set; }
}
13 changes: 7 additions & 6 deletions src/LanguageServer/Protocol/Protocol/ITextDocumentParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;

namespace Roslyn.LanguageServer.Protocol
{
/// <summary>
/// Interface to identify a text document.
/// Interface for request/notification params that apply to a document
/// </summary>
internal interface ITextDocumentParams
{
/// <summary>
/// Gets or sets the value which identifies the document.
/// The identifier of the document.
/// </summary>
public TextDocumentIdentifier TextDocument
{
get;
}
[JsonPropertyName("textDocument")]
[JsonRequired]
public TextDocumentIdentifier TextDocument { get; }
}
}
28 changes: 10 additions & 18 deletions src/LanguageServer/Protocol/Protocol/ITextDocumentPositionParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,23 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;

namespace Roslyn.LanguageServer.Protocol
{
/// <summary>
/// Interface to identify a text document and a position inside that document.
///
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentPositionParams">Language Server Protocol specification</see> for additional information.
/// Interface for request/notification params that apply to a a position inside a document
/// <para>
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal interface ITextDocumentPositionParams : ITextDocumentParams
{
/// <summary>
/// Gets or sets the value which identifies the document.
/// </summary>
public new TextDocumentIdentifier TextDocument
{
get;
set;
}

/// <summary>
/// Gets or sets the value which indicates the position within the document.
/// The position within the document.
/// </summary>
public Position Position
{
get;
set;
}
[JsonPropertyName("position")]
[JsonRequired]
public Position Position { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;

namespace Roslyn.LanguageServer.Protocol;

/// <summary>
/// Interface representing the text document registration options.
///
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentRegistrationOptions">Language Server Protocol specification</see> for additional information.
/// Interface for registration options that can be scoped to particular text documents.
/// <para>
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentRegistrationOptions">Language Server Protocol specification</see> for additional information.
/// </para>
/// </summary>
internal interface ITextDocumentRegistrationOptions
{
/// <summary>
/// Gets or sets the document filters for this registration option.
/// A document selector to identify the scope of the registration. If set to
/// <see langword="null"/> the document selector provided on the client side will be used.
/// </summary>
[JsonPropertyName("documentSelector")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DocumentFilter[]? DocumentSelector { get; set; }
}

0 comments on commit 9098078

Please sign in to comment.