From c90c6ab750ab05dd6d337e4f857958b8f3d00153 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 13 Jun 2022 12:20:35 -0700 Subject: Language Server improvements. (#2269) * Language Server improvements. - Improve parser robustness around `attribute_syntax`. - Exclude instance members in a static query. - Coloring accessors - Improved signature help cursor range check. * Add expected test result. * Language server: support configuring predefined macros. * Fix constructor highlighting. * Improving performance by supporting incremental text change notifications. * Fix UTF16 positions and highlighting of constructor calls. * Add completion suggestions for HLSL semantics. * Fix tests. * Fix: don't skip static variables in a static query. * Include literal init expr value in hover text. * Fix scenarios where completion failed to trigger. * Fixing language server protocol field initializations. Co-authored-by: Yong He --- .../compiler-core/slang-language-server-protocol.h | 114 ++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) (limited to 'source/compiler-core/slang-language-server-protocol.h') diff --git a/source/compiler-core/slang-language-server-protocol.h b/source/compiler-core/slang-language-server-protocol.h index e1ac47beb..11446bd0b 100644 --- a/source/compiler-core/slang-language-server-protocol.h +++ b/source/compiler-core/slang-language-server-protocol.h @@ -205,6 +205,33 @@ struct DidCloseTextDocumentParams static const UnownedStringSlice methodName; }; +struct WorkspaceFoldersServerCapabilities +{ + /** + * The server has support for workspace folders + */ + bool supported = false; + + /** + * Whether the server wants to receive workspace folder + * change notifications. + * + * If a string is provided, the string is treated as an ID + * under which the notification is registered on the client + * side. The ID can be used to unregister for these events + * using the `client/unregisterCapability` request. + */ + bool changeNotifications = false; + + static const StructRttiInfo g_rttiInfo; +}; + +struct WorkspaceCapabilities +{ + WorkspaceFoldersServerCapabilities workspaceFolders; + static const StructRttiInfo g_rttiInfo; +}; + struct ServerCapabilities { String positionEncoding; @@ -214,6 +241,7 @@ struct ServerCapabilities CompletionOptions completionProvider; SemanticTokensOptions semanticTokensProvider; SignatureHelpOptions signatureHelpProvider; + WorkspaceCapabilities workspace; static const StructRttiInfo g_rttiInfo; }; @@ -245,11 +273,13 @@ struct InitializeResult static const StructRttiInfo g_rttiInfo; }; -struct ShutdownParams { +struct ShutdownParams +{ static const UnownedStringSlice methodName; }; -struct ExitParams { +struct ExitParams +{ static const UnownedStringSlice methodName; }; @@ -630,5 +660,85 @@ struct SignatureHelp }; +struct DidChangeConfigurationParams +{ + /** + * The actual changed settings + */ + JSONValue settings = JSONValue::makeInvalid(); + + static const StructRttiInfo g_rttiInfo; + + static const UnownedStringSlice methodName; +}; + +struct ConfigurationItem +{ + /** + * The configuration section asked for. + */ + String section; + + static const StructRttiInfo g_rttiInfo; +}; + +struct ConfigurationParams +{ + List items; + + static const StructRttiInfo g_rttiInfo; + + static const UnownedStringSlice methodName; +}; + +struct Registration +{ + /** + * The id used to register the request. The id can be used to deregister + * the request again. + */ + String id; + + /** + * The method / capability to register for. + */ + String method; + + static const StructRttiInfo g_rttiInfo; +}; + +struct RegistrationParams +{ + List registrations; + + static const StructRttiInfo g_rttiInfo; +}; + +struct CancelParams +{ + /** + * The request id to cancel. + */ + int64_t id = 0; + + static const StructRttiInfo g_rttiInfo; +}; + +struct LogMessageParams +{ + /** + * The message type. See {@link MessageType} + */ + int type = 0; + + /** + * The actual message + */ + String message; + + static const StructRttiInfo g_rttiInfo; + static const UnownedStringSlice methodName; +}; + } // namespace LanguageServerProtocol } // namespace Slang -- cgit v1.2.3