From e35f4888245dac1dd37ec85373b41c131cb4b52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Nordl=C3=B6w?= Date: Tue, 3 Dec 2024 10:10:54 +0100 Subject: [PATCH] Support LSP Inlay Hints in protocol specification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Per Nordlöw --- protocol/source/served/lsp/protocol.d | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/protocol/source/served/lsp/protocol.d b/protocol/source/served/lsp/protocol.d index 679efff8..82999a38 100644 --- a/protocol/source/served/lsp/protocol.d +++ b/protocol/source/served/lsp/protocol.d @@ -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, InlayHintOptions) inlayHintProvider; @serdeOptional Variant!(void, bool, CodeActionOptions) codeActionProvider; @serdeOptional Variant!(void, CodeLensOptions) codeLensProvider; @serdeOptional Variant!(void, DocumentLinkOptions) documentLinkProvider; @@ -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; + OptionalJsonValue 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 { @@ -3151,6 +3189,13 @@ struct DocumentSymbolOptions @serdeOptional Optional!string label; } +@serdeFallbackStruct +struct InlayHintOptions +{ + mixin WorkDoneProgressOptions; + @serdeOptional Optional!bool resolveProvider; +} + @serdeFallbackStruct struct DocumentSymbolRegistrationOptions {