Skip to content

Updated to the latest spec changes #415

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 5 commits into from
Nov 7, 2020
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
4 changes: 2 additions & 2 deletions language-server-protocol.sha.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- This is the last commit we caught up with https://github.com/Microsoft/language-server-protocol/commits/gh-pages
lastSha: a94f201e01fcdc0a308741bf3d46eef1a47fb6b5
lastSha: 558f1e114a3dc53da7c3686a657ebef070275d63

https://github.com/Microsoft/language-server-protocol/compare/a94f201e01fcdc0a308741bf3d46eef1a47fb6b5..gh-pages
https://github.com/Microsoft/language-server-protocol/compare/558f1e114a3dc53da7c3686a657ebef070275d63..gh-pages
4 changes: 4 additions & 0 deletions src/Protocol/Client/Capabilities/ClientCapabilities.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
Expand All @@ -8,16 +9,19 @@ public class ClientCapabilities : CapabilitiesBase
/// <summary>
/// Workspace specific client capabilities.
/// </summary>
[Optional]
public WorkspaceClientCapabilities? Workspace { get; set; }

/// <summary>
/// Text document specific client capabilities.
/// </summary>
[Optional]
public TextDocumentClientCapabilities? TextDocument { get; set; }

/// <summary>
/// Window specific client capabilities.
/// </summary>
[Optional]
public WindowClientCapabilities? Window { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
/// <summary>
/// Capabilities specific to the code lens requests scoped to the
/// workspace.
///
/// @since 3.16.0 - proposed state.
/// </summary>
[Obsolete(Constants.Proposal)]
[CapabilityKey(nameof(ClientCapabilities.TextDocument), nameof(WorkspaceClientCapabilities.CodeLens))]
public class CodeLensWorkspaceClientCapabilities
{
/// <summary>
/// Whether the client implementation supports a refresh request send from the server
/// to the client. This is useful if a server detects a change which requires a
/// re-calculation of all code lenses.
/// </summary>
[Optional]
public bool RefreshSupport { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,21 @@ public class CompletionItemCapabilityOptions
/// </summary>
[Optional]
public CompletionItemCapabilityResolveSupportOptions? ResolveSupport { get; set; }

/// <summary>
/// The client supports the `insertTextMode` property on
/// a completion item to override the whitespace handling mode
/// as defined by the client (see `insertTextMode`).
///
/// @since 3.16.0 - proposed state
/// </summary>
[Optional]
public CompletionItemInsertTextModeSupportCapabilityOptions? InsertTextModeSupport { get; set; }
}

public class CompletionItemInsertTextModeSupportCapabilityOptions
{
public Container<InsertTextMode> ValueSet { get; set; }
}

}
3 changes: 3 additions & 0 deletions src/Protocol/Client/Capabilities/FoldingRangeCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class FoldingRangeCapability : DynamicCapability, ConnectedCapability<IFo
/// The maximum number of folding ranges that the client prefers to receive per document. The value serves as a
/// hint, servers are free to follow the limit.
/// </summary>
/// <remarks>
/// <see cref="uint"/> in the LSP spec
/// </remarks>
[Optional]
public int? RangeLimit { get; set; }

Expand Down
13 changes: 13 additions & 0 deletions src/Protocol/Client/Capabilities/SemanticTokensCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Document.Proposals;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Models.Proposals;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
Expand Down Expand Up @@ -34,5 +35,17 @@ public class SemanticTokensCapability : DynamicCapability, ConnectedCapability<I
/// The formats the clients supports.
/// </summary>
public Container<SemanticTokenFormat> Formats { get; set; } = null!;

/// <summary>
/// Whether the client supports tokens that can overlap each other.
/// </summary>
[Optional]
public bool OverlappingTokenSupport { get; set; }

/// <summary>
/// Whether the client supports tokens that can span multiple lines.
/// </summary>
[Optional]
public bool MultilineTokenSupport { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
/// <summary>
/// Capabilities specific to the showMessage request
///
/// @since 3.16.0 - proposed state
/// </summary>
[Obsolete(Constants.Proposal)]
[CapabilityKey(nameof(ClientCapabilities.Window), nameof(WindowClientCapabilities.ShowMessage))]
public class ShowMessageRequestClientCapabilities
{
/// <summary>
/// Capabilities specific to the `MessageActionItem` type.
/// </summary>
[Optional]
public ShowMessageRequestMessageActionItemClientCapabilities? MessageActionItem { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
[Obsolete(Constants.Proposal)]
public class ShowMessageRequestMessageActionItemClientCapabilities
{
/// <summary>
/// Whether the client supports additional attribues which
/// are preserved and send back to the server in the
/// request's response.
/// </summary>
[Optional]
public bool AdditionalPropertiesSupport { get; set; }
}
}
7 changes: 7 additions & 0 deletions src/Protocol/Client/Capabilities/WindowClientCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ public class WindowClientCapabilities : CapabilitiesBase
/// Whether client supports handling progress notifications.
/// </summary>
public Supports<bool> WorkDoneProgress { get; set; }

/// <summary>
/// Capabilities specific to the showMessage request
///
/// @since 3.16.0 - proposed state
/// </summary>
public Supports<ShowMessageRequestClientCapabilities> ShowMessage { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/Protocol/Client/Capabilities/WorkspaceClientCapabilities.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities
{
public class WorkspaceClientCapabilities : CapabilitiesBase
Expand Down Expand Up @@ -36,8 +38,18 @@ public class WorkspaceClientCapabilities : CapabilitiesBase
///
/// @since 3.16.0 - proposed state.
/// </summary>
[Obsolete(Constants.Proposal)]
public Supports<SemanticTokensWorkspaceCapability> SemanticTokens { get; set; }

/// <summary>
/// Capabilities specific to the code lens requests scoped to the
/// workspace.
///
/// @since 3.16.0 - proposed state.
/// </summary>
[Obsolete(Constants.Proposal)]
public Supports<CodeLensWorkspaceClientCapabilities> CodeLens { get; set; }

/// <summary>
/// The client has support for workspace folders.
///
Expand Down
12 changes: 12 additions & 0 deletions src/Protocol/Client/Capabilities/WorkspaceEditCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,17 @@ public class WorkspaceEditCapability : ICapability
/// </summary>
[Optional]
public FailureHandlingKind? FailureHandling { get; set; }

/// <summary>
/// Whether the client normalizes line endings to the client specific
/// setting.
/// If set to `true` the client will normalize line ending characters
/// in a workspace edit containg to the client specific new line
/// character.
///
/// @since 3.16.0 - proposed state
/// </summary>
[Optional]
public bool NormalizesLineEndings { get; set; }
}
}
29 changes: 29 additions & 0 deletions src/Protocol/Models/CompletionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,42 @@ public class CompletionItem : ICanBeResolved, IRequest<CompletionItem>
[Optional]
public InsertTextFormat InsertTextFormat { get; set; }

/// <summary>
/// How whitespace and indentation is handled during completion
/// item insertion.
///
/// @since 3.16.0 - proposed state
/// </summary>
[Optional]
public InsertTextMode InsertTextMode { get; set; }

/// <summary>
/// An edit which is applied to a document when selecting this completion. When an edit is provided the value of
/// `insertText` is ignored.
///
/// *Note:* The range of the edit must be a single line range and it must contain the position at which completion
/// has been requested.
///
/// Most editors support two different operation when accepting a completion
/// item. One is to insert a completion text and the other is to replace an
/// existing text with a competion text. Since this can usually not
/// predetermend by a server it can report both ranges. Clients need to
/// signal support for `InsertReplaceEdits` via the
/// `textDocument.completion.insertReplaceSupport` client capability
/// property.
///
/// *Note 1:* The text edit's range as well as both ranges from a insert
/// replace edit must be a [single line] and they must contain the position
/// at which completion has been requested.
/// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
/// must be a prefix of the edit's replace range, that means it must be
/// contained and starting at the same position.
///
/// @since 3.16.0 additional type `InsertReplaceEdit` - proposed state
/// </summary>
/// <remarks>
/// TODO: Update this to union <see cref="TextEdit"/> <see cref="InsertReplaceEdit"/>
/// </remarks>
[Optional]
public TextEdit? TextEdit { get; set; }

Expand Down
16 changes: 16 additions & 0 deletions src/Protocol/Models/FoldingRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,38 @@ public class FoldingRange
/// <summary>
/// The zero-based line number from where the folded range starts.
/// </summary>
/// <remarks>
/// TODO: UPDATE THIS next version
/// <see cref="uint"/> in the LSP spec
/// </remarks>
public long StartLine { get; set; }

/// <summary>
/// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
/// </summary>
/// <remarks>
/// TODO: UPDATE THIS next version
/// <see cref="uint"/> in the LSP spec
/// </remarks>
[Optional]
public long? StartCharacter { get; set; }

/// <summary>
/// The zero-based line number where the folded range ends.
/// </summary>
/// <remarks>
/// TODO: UPDATE THIS next version
/// <see cref="uint"/> in the LSP spec
/// </remarks>
public long EndLine { get; set; }

/// <summary>
/// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
/// </summary>
/// <remarks>
/// TODO: UPDATE THIS next version
/// <see cref="uint"/> in the LSP spec
/// </remarks>
[Optional]
public long? EndCharacter { get; set; }

Expand Down
4 changes: 4 additions & 0 deletions src/Protocol/Models/FormattingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public class FormattingOptions : Dictionary<string, BooleanNumberString>
/// <summary>
/// Size of a tab in spaces.
/// </summary>
/// <remarks>
/// TODO: UPDATE THIS next version
/// <see cref="uint"/> in the LSP spec
/// </remarks>
[JsonIgnore]
public long TabSize
{
Expand Down
17 changes: 15 additions & 2 deletions src/Protocol/Models/InitializeParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public string? RootPath
/// <summary>
/// The capabilities provided by the client (editor or tool)
/// </summary>
[MaybeNull] public ClientCapabilities Capabilities { get; set; } = null!;
[MaybeNull]
public ClientCapabilities Capabilities { get; set; } = null!;

/// <summary>
/// The initial trace setting. If omitted trace is disabled ('off').
Expand All @@ -85,9 +86,21 @@ public string? RootPath
[MaybeNull]
public ProgressToken? WorkDoneToken { get; set; }

/// <summary>
/// The locale the client is currently showing the user interface
/// in. This must not necessarily be the locale of the operating
/// system.
///
/// Uses IETF language tags as the value's syntax
/// (See https://en.wikipedia.org/wiki/IETF_language_tag)
///
/// @since 3.16.0 - proposed state
/// </summary>
[Optional]
public string? Locale { get; set; }

public InitializeParams()
{

}

internal InitializeParams(IInitializeParams<JObject> @params, ClientCapabilities clientCapabilities)
Expand Down
33 changes: 33 additions & 0 deletions src/Protocol/Models/InsertReplaceEdit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Diagnostics;

namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
{
/// <summary>
/// A special text edit to provide an insert and a replace operation.
///
/// @since 3.16.0 - proposed state
/// </summary>
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
public class InsertReplaceEdit
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be added onto the CompletionItem but this is a breaking change so this has not been put into place yet.

{
/// <summary>
/// The string to be inserted.
/// </summary>
public string NewText { get; set; }

/// <summary>
/// The range if the insert is requested
/// </summary>
public Range Insert { get; set; }

/// <summary>
/// The range if the replace is requested.
/// </summary>
public Range Replace { get; set; }

private string DebuggerDisplay => $"{Insert} / {Replace} {( string.IsNullOrWhiteSpace(NewText) ? string.Empty : NewText.Length > 30 ? NewText.Substring(0, 30) : NewText )}";

/// <inheritdoc />
public override string ToString() => DebuggerDisplay;
}
}
Loading