Skip to content

Commit

Permalink
impl server capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Jul 8, 2024
1 parent eeea530 commit 3d049b9
Show file tree
Hide file tree
Showing 51 changed files with 1,096 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Common;
using EmmyLua.LanguageServer.Framework.Protocol.Model.Kind;
using EmmyLua.LanguageServer.Framework.Protocol.Model.Union;

Expand Down Expand Up @@ -97,16 +98,8 @@ public class SemanticTokensClientCapabilitiesRequests
* The client will send the `textDocument/semanticTokens/full` request if
* the server provides a corresponding server capability.
*/
[JsonPropertyName("full"), JsonConverter(typeof(BooleanOrConverter<SemanticTokensClientCapabilitiesRequestsFull>))]
public BooleanOr<SemanticTokensClientCapabilitiesRequestsFull>? Full { get; init; }
[JsonPropertyName("full"), JsonConverter(typeof(BooleanOrConverter<SemanticTokensCapabilitiesFull>))]
public BooleanOr<SemanticTokensCapabilitiesFull>? Full { get; init; }
}

public class SemanticTokensClientCapabilitiesRequestsFull
{
/**
* The client will send the `textDocument/semanticTokens/full/delta` request if
* the server provides a corresponding server capability.
*/
[JsonPropertyName("delta")]
public bool? Delta { get; init; }
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Common;

public class SemanticTokensCapabilitiesFull
{
/**
* The client will send the `textDocument/semanticTokens/full/delta` request if
* the server provides a corresponding server capability.
*/
[JsonPropertyName("delta")]
public bool? Delta { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Common;

public class SemanticTokensLegend
{
/**
* The token types a server uses.
*/
[JsonPropertyName("tokenTypes")]
public List<string> TokenTypes { get; init; } = [];

/**
* The token modifiers a server uses.
*/
[JsonPropertyName("tokenModifiers")]
public List<string> TokenModifiers { get; init; } = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class CallHierarchyOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System.Text.Json.Serialization;
using EmmyLua.LanguageServer.Framework.Protocol.Model;
using EmmyLua.LanguageServer.Framework.Protocol.Model.Kind;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class CodeActionOptions : WorkDoneProgressOptions
{
/**
* CodeActionKinds that this server may return.
*
* The list of kinds may be generic, such as `CodeActionKind.Refactor`,
* or the server may list out every specific kind they provide.
*/
[JsonPropertyName("codeActionKinds")]
public List<CodeActionKind> CodeActionKinds { get; set; }

/**
* Static documentation for a class of code actions.
*
* Documentation from the provider should be shown in the code actions
* menu if either:
*
* - Code actions of `kind` are requested by the editor. In this case,
* the editor will show the documentation that most closely matches the
* requested code action kind. For example, if a provider has
* documentation for both `Refactor` and `RefactorExtract`, when the
* user requests code actions for `RefactorExtract`, the editor will use
* the documentation for `RefactorExtract` instead of the documentation
* for `Refactor`.
*
* - Any code actions of `kind` are returned by the provider.
*
* At most one documentation entry should be shown per provider.
*
* @since 3.18.0
* @proposed
*/
[JsonPropertyName("documentation")]
public List<CodeActionKindDocumentation> Documentation { get; set; }
}

/**
* Documentation for a class of code actions.
*
* @since 3.18.0
* @proposed
*/
public class CodeActionKindDocumentation
{
/**
* The kind of the code action being documented.
*
* If the kind is generic, such as `CodeActionKind.Refactor`, the
* documentation will be shown whenever any refactorings are returned. If
* the kind is more specific, such as `CodeActionKind.RefactorExtract`, the
* documentation will only be shown when extract refactoring code actions
* are returned.
*/
[JsonPropertyName("kind")]
public CodeActionKind Kind { get; set; }

/**
* Command that is used to display the documentation to the user.
*
* The title of this documentation code action is taken
* from {@linkcode Command.title}
*/
[JsonPropertyName("command")]
public Command Command { get; set; } = null!;

/**
* The server provides support to resolve additional
* information for a code action.
*
* @since 3.16.0
*/
[JsonPropertyName("resolveProvider")]
public bool? ResolveProvider { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class CodeLensOptions : WorkDoneProgressOptions
{
/**
* Code lens has a resolve provider as well.
*/
[JsonPropertyName("resolveProvider")]
public bool? ResolveProvider { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class CompletionOptions : WorkDoneProgressOptions
{
/**
* Most tools trigger completion request automatically without explicitly
* requesting it using a keyboard shortcut (e.g., Ctrl+Space). Typically they
* do so when the user starts to type an identifier. For example, if the user
* types `c` in a JavaScript file, code complete will automatically pop up and
* present `console` besides others as a completion item. Characters that
* make up identifiers don't need to be listed here.
*
* If code complete should automatically be triggered on characters not being
* valid inside an identifier (for example, `.` in JavaScript), list them in
* `triggerCharacters`.
*/
[JsonPropertyName("triggerCharacters")]
public List<string>? TriggerCharacters { get; init; }

/**
* The list of all possible characters that commit a completion. This field
* can be used if clients don't support individual commit characters per
* completion item. See client capability
* `completion.completionItem.commitCharactersSupport`.
*
* If a server provides both `allCommitCharacters` and commit characters on
* an individual completion item, the ones on the completion item win.
*
* @since 3.2.0
*/
[JsonPropertyName("allCommitCharacters")]
public List<string>? AllCommitCharacters { get; init; }

/**
* The server provides support to resolve additional
* information for a completion item.
*/
[JsonPropertyName("resolveProvider")]
public bool ResolveProvider { get; init; }

/**
* The server supports the following `CompletionItem` specific
* capabilities.
*
* @since 3.17.0
*/
[JsonPropertyName("completionItem")]
public CompletionItemDetailOptions? CompletionItem { get; init; }
}

public class CompletionItemDetailOptions
{
/**
* The server has support for completion item label
* details (see also `CompletionItemLabelDetails`) when receiving
* a completion item in a resolve call.
*
* @since 3.17.0
*/
[JsonPropertyName("labelDetailsSupport")]
public bool? LabelDetailsSupport { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DeclarationOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DefinitionOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DiagnosticOptions : WorkDoneProgressOptions
{
/**
* An optional identifier under which the diagnostics are
* managed by the client.
*/
[JsonPropertyName("identifier")]
public string? Identifier { get; set; }

/**
* Whether the language has inter file dependencies, meaning that
* editing code in one file can result in a different diagnostic
* set in another file. Inter file dependencies are common for
* most programming languages and typically uncommon for linters.
*/
[JsonPropertyName("interFileDependencies")]
public bool InterFileDependencies { get; set; }

/**
* The server provides support for workspace diagnostics as well.
*/
[JsonPropertyName("workspaceDiagnostics")]
public bool WorkspaceDiagnostics { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentColorOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentFormattingOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentHighlightOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentLinkOptions : WorkDoneProgressOptions
{
/**
* Document links have a resolve provider as well.
*/
[JsonPropertyName("resolveProvider")]
public bool? ResolveProvider { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentOnTypeFormattingOptions
{
/**
* A character on which formatting should be triggered, like `{`.
*/
[JsonPropertyName("firstTriggerCharacter")]
public string FirstTriggerCharacter { get; set; } = null!;

/**
* More trigger characters.
*/
public List<string>? MoreTriggerCharacter { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentRangeFormattingOptions : WorkDoneProgressOptions
{
/**
* Whether the server supports formatting multiple ranges at once.
*
* @since 3.18.0
* @proposed
*/
[JsonPropertyName("rangesSupport")]
public bool? RangesSupport { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class DocumentSymbolOptions : WorkDoneProgressOptions
{
/**
* A human-readable string that is shown when multiple outlines trees
* are shown for the same document.
*
* @since 3.16.0
*/
[JsonPropertyName("label")]
public string? Label { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class ExecuteCommandOptions : WorkDoneProgressOptions
{
/**
* The commands to be executed on the server.
*/
[JsonPropertyName("commands")]
public List<string> Commands { get; init; } = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
using EmmyLua.LanguageServer.Framework.Protocol.Model;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

/**
* The options to register for file operations.
*
* @since 3.16.0
*/
public class FileOperationRegistrationOptions
{
/**
* The actual filters.
*/
[JsonPropertyName("filters")]
public List<FileOperationFilter> Filters { get; set; } = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class HoverOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

public class ImplementationOptions : WorkDoneProgressOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;

namespace EmmyLua.LanguageServer.Framework.Protocol.Capabilities.Server.Options;

/**
* Inlay hint options used during static registration.
*
* @since 3.17.0
*/
public class InlayHintsOptions : WorkDoneProgressOptions
{
/**
* The server provides support to resolve additional
* information for an inlay hint item.
*/
[JsonPropertyName("resolveProvider")]
public bool? ResolveProvider { get; set; }
}
Loading

0 comments on commit 3d049b9

Please sign in to comment.