summaryrefslogtreecommitdiff
path: root/modules/gdscript/language_server/gdscript_language_protocol.cpp
diff options
context:
space:
mode:
authorFrancois Belair <razoric480@gmail.com>2021-07-11 15:51:31 -0400
committerFrancois Belair <razoric480@gmail.com>2021-07-11 16:17:49 -0400
commit9a8421aa058437ce01bc67244bb8dcd0f15fc9e6 (patch)
treea6e5958415dd3651e7565dd3743542d711e268b9 /modules/gdscript/language_server/gdscript_language_protocol.cpp
parentfb3961b2ef9ed03501f98a8aa621f78679cc2be9 (diff)
Implement applyEdit in LSP for signal connecting
Diffstat (limited to 'modules/gdscript/language_server/gdscript_language_protocol.cpp')
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 0d1f98778e..fb60da1ff4 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -284,6 +284,23 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
peer->res_queue.push_back(msg.utf8());
}
+void GDScriptLanguageProtocol::request_client(const String &p_method, const Variant &p_params, int p_client_id) {
+ if (p_client_id == -1) {
+ ERR_FAIL_COND_MSG(latest_client_id == -1,
+ "GDScript LSP: Can't notify client as none was connected.");
+ p_client_id = latest_client_id;
+ }
+ ERR_FAIL_COND(!clients.has(p_client_id));
+ Ref<LSPeer> peer = clients.get(p_client_id);
+ ERR_FAIL_COND(peer == nullptr);
+
+ Dictionary message = make_request(p_method, p_params, next_server_id);
+ next_server_id++;
+ String msg = Variant(message).to_json_string();
+ msg = format_output(msg);
+ peer->res_queue.push_back(msg.utf8());
+}
+
bool GDScriptLanguageProtocol::is_smart_resolve_enabled() const {
return bool(_EDITOR_GET("network/language_server/enable_smart_resolve"));
}