Skip to content

Commit

Permalink
Support LSP Inlay Hints in protocol specification
Browse files Browse the repository at this point in the history
Acked-by: Per Nordlöw <[email protected]>
  • Loading branch information
nordlow committed Dec 3, 2024
1 parent 0339545 commit 2e20c7b
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions protocol/source/served/lsp/protocol.d
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,7 @@ struct ServerCapabilities
@serdeOptional Variant!(void, bool, ReferenceOptions) referencesProvider;
@serdeOptional Variant!(void, bool, DocumentHighlightOptions) documentHighlightProvider;
@serdeOptional Variant!(void, bool, DocumentSymbolOptions) documentSymbolProvider;
@serdeOptional Variant!(void, bool, InlayHintProvider) inlayHintProvider;
@serdeOptional Variant!(void, bool, CodeActionOptions) codeActionProvider;
@serdeOptional Variant!(void, CodeLensOptions) codeLensProvider;
@serdeOptional Variant!(void, DocumentLinkOptions) documentLinkProvider;
Expand Down Expand Up @@ -3085,6 +3086,43 @@ struct ReferenceParams
ReferenceContext context;
}

@serdeFallbackStruct
@allowedMethods("textDocument/inlayHint")
struct InlayHintParams
{
TextDocumentIdentifier textDocument;
TextRange range;
}

@serdeFallbackStruct
struct InlayHint
{
Position position;
Variant!(string, InlayHintLabelPart[]) label;
@serdeOptional Optional!InlayHintKind kind;
@serdeOptional Optional!(TextEdit[]) textEdits;
@serdeOptional Variant!(void, string, MarkupContent) tooltip;
@serdeOptional Optional!(bool) paddingLeft;
@serdeOptional Optional!(bool) paddingRight;
// TODO: @serdeOptional Optional!(LSPAny) data;
}

@serdeEnumProxy!uint
enum InlayHintKind
{
type = 1,
parameter = 2,
}

@serdeFallbackStruct
struct InlayHintLabelPart
{
string value;
@serdeOptional Variant!(void, string, MarkupContent) tooltip;
@serdeOptional Optional!Location location;
@serdeOptional Optional!Command command;
}

@serdeFallbackStruct
struct ReferenceContext
{
Expand Down Expand Up @@ -3151,6 +3189,14 @@ struct DocumentSymbolOptions
@serdeOptional Optional!string label;
}

@serdeFallbackStruct
struct InlayHintProvider
{
mixin WorkDoneProgressOptions;

@serdeOptional Optional!string label;
}

@serdeFallbackStruct
struct DocumentSymbolRegistrationOptions
{
Expand Down

0 comments on commit 2e20c7b

Please sign in to comment.