From 4d5c2813a6df6171e314da1fd0eb63fa00f2b963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 26 Jan 2023 11:17:26 -0300 Subject: [PATCH] ecode: LSP - Fixes typescript-language-server. --- src/tools/ecode/plugins/lsp/lspclientserver.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tools/ecode/plugins/lsp/lspclientserver.cpp b/src/tools/ecode/plugins/lsp/lspclientserver.cpp index 2aaf08def..48b505fb8 100644 --- a/src/tools/ecode/plugins/lsp/lspclientserver.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientserver.cpp @@ -64,6 +64,16 @@ static json newID( const PluginIDType& id ) { return j; } +static json newEmptyResult( const PluginIDType& id ) { + json j; + j[MEMBER_RESULT] = json( json::value_t::object ); + if ( id.isInteger() ) + j[MEMBER_ID] = id.asInt(); + else + j[MEMBER_ID] = id.asString(); + return j; +} + static std::string jsonString( const json& container, const std::string& member, const std::string& def ) { return container.is_object() && container.contains( member ) && container[member].is_string() @@ -1207,7 +1217,7 @@ void LSPClientServer::processRequest( const json& msg ) { // auto params = msg[MEMBER_PARAMS]; // bool handled = false; if ( method == "window/workDoneProgress/create" || method == "client/registerCapability" ) { - write( newID( msgid ) ); + write( newEmptyResult( msgid ) ); return; } write( newError( LSPErrorCode::MethodNotFound, method ), nullptr, nullptr, msgid );