diff --git a/main/main.cpp b/main/main.cpp index e22c100..6fa550d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -91,12 +91,6 @@ #include "editor_code_editor/editor_script_editor.h" #endif -#ifdef MODULE_GDSCRIPT_ENABLED -#if defined(TOOLS_ENABLED) && !defined(GDSCRIPT_NO_LSP) -#include "modules/gdscript/language_server/gdscript_language_server.h" -#endif // TOOLS_ENABLED && !GDSCRIPT_NO_LSP -#endif // MODULE_GDSCRIPT_ENABLED - /* Static members */ // Singletons @@ -334,9 +328,6 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); OS::get_singleton()->print(" --debug-server
Start the editor debug server (:, e.g. 127.0.0.1:6007)\n"); -#if defined(MODULE_GDSCRIPT_ENABLED) && !defined(GDSCRIPT_NO_LSP) - OS::get_singleton()->print(" --lsp-port Use the specified port for the language server protocol. The port must be between 0 to 65535.\n"); -#endif // MODULE_GDSCRIPT_ENABLED && !GDSCRIPT_NO_LSP #endif OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n"); OS::get_singleton()->print(" -l, --language Use a specific locale ( being a two-letter code).\n"); @@ -981,21 +972,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->print("Missing argument for --benchmark-file .\n"); goto error; } -#if defined(TOOLS_ENABLED) && !defined(GDSCRIPT_NO_LSP) - } else if (I->get() == "--lsp-port") { - if (I->next()) { - int port_override = I->next()->get().to_int(); - if (port_override < 0 || port_override > 65535) { - OS::get_singleton()->print(" argument for --lsp-port must be between 0 and 65535.\n"); - goto error; - } - GDScriptLanguageServer::port_override = port_override; - N = I->next()->next(); - } else { - OS::get_singleton()->print("Missing argument for --lsp-port .\n"); - goto error; - } -#endif // TOOLS_ENABLED && !GDSCRIPT_NO_LSP } else { main_args.push_back(I->get()); } diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub index 8108df9..a4af0cf 100644 --- a/modules/gdscript/SCsub +++ b/modules/gdscript/SCsub @@ -9,11 +9,4 @@ env_gdscript.add_source_files(env.modules_sources, "*.cpp") if env["tools"]: env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp") - - # Those two modules are required for the language server protocol - if env["module_jsonrpc_enabled"] and env["module_websocket_enabled"]: - env_gdscript.add_source_files(env.modules_sources, "./language_server/*.cpp") - else: - # Using a define in the disabled case, to avoid having an extra define - # in regular builds where all modules are enabled. - env_gdscript.Append(CPPDEFINES=["GDSCRIPT_NO_LSP"]) \ No newline at end of file + \ No newline at end of file diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 4d9c84d..dd69abe 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -49,11 +49,6 @@ Ref resource_saver_gd; #include "editor/editor_node.h" #include "editor/editor_settings.h" -#ifndef GDSCRIPT_NO_LSP -#include "core/config/engine.h" -#include "language_server/gdscript_language_server.h" -#endif // !GDSCRIPT_NO_LSP - class EditorExportGDScript : public EditorExportPlugin { GDCLASS(EditorExportGDScript, EditorExportPlugin); @@ -138,13 +133,6 @@ static void _editor_init() { Ref gd_export; gd_export.instance(); EditorExport::get_singleton()->add_export_plugin(gd_export); - -#ifndef GDSCRIPT_NO_LSP - register_lsp_types(); - GDScriptLanguageServer *lsp_plugin = memnew(GDScriptLanguageServer); - EditorNode::get_singleton()->add_editor_plugin(lsp_plugin); - Engine::get_singleton()->add_singleton(Engine::Singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton())); -#endif // !GDSCRIPT_NO_LSP } #endif // TOOLS_ENABLED diff --git a/modules/jsonrpc/SCsub b/modules/jsonrpc/SCsub deleted file mode 100644 index fe53126..0000000 --- a/modules/jsonrpc/SCsub +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -Import("env") -Import("env_modules") - -env_jsonrpc = env_modules.Clone() -env_jsonrpc.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/jsonrpc/config.py b/modules/jsonrpc/config.py deleted file mode 100644 index b9cdfd3..0000000 --- a/modules/jsonrpc/config.py +++ /dev/null @@ -1,14 +0,0 @@ -def can_build(env, platform): - return True - - -def configure(env): - pass - -def get_doc_classes(): - return [ - "JSONRPC", - ] - -def get_doc_path(): - return "doc_classes" diff --git a/modules/jsonrpc/doc_classes/JSONRPC.xml b/modules/jsonrpc/doc_classes/JSONRPC.xml deleted file mode 100644 index 6ebe623..0000000 --- a/modules/jsonrpc/doc_classes/JSONRPC.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - A helper to handle dictionaries which look like JSONRPC documents. - - - [url=https://www.jsonrpc.org/]JSON-RPC[/url] is a standard which wraps a method call in a [JSON] object. The object has a particular structure and identifies which method is called, the parameters to that function, and carries an ID to keep track of responses. This class implements that standard on top of [Dictionary]; you will have to convert between a [Dictionary] and [JSON] with other functions. - - - - - - - - - - Returns a dictionary in the form of a JSON-RPC notification. Notifications are one-shot messages which do not expect a response. - - [code]method[/code]: Name of the method being called. - - [code]params[/code]: An array or dictionary of parameters being passed to the method. - - - - - - - - - Returns a dictionary in the form of a JSON-RPC request. Requests are sent to a server with the expectation of a response. The ID field is used for the server to specify which exact request it is responding to. - - [code]method[/code]: Name of the method being called. - - [code]params[/code]: An array or dictionary of parameters being passed to the method. - - [code]id[/code]: Uniquely identifies this request. The server is expected to send a response with the same ID. - - - - - - - - When a server has received and processed a request, it is expected to send a response. If you did not want a response then you need to have sent a Notification instead. - - [code]result[/code]: The return value of the function which was called. - - [code]id[/code]: The ID of the request this response is targeted to. - - - - - - - - - Creates a response which indicates a previous reply has failed in some way. - - [code]code[/code]: The error code corresponding to what kind of error this is. See the [enum ErrorCode] constants. - - [code]message[/code]: A custom message about this error. - - [code]id[/code]: The request this error is a response to. - - - - - - - - Given a Dictionary which takes the form of a JSON-RPC request: unpack the request and run it. Methods are resolved by looking at the field called "method" and looking for an equivalently named function in the JSONRPC object. If one is found that method is called. - To add new supported methods extend the JSONRPC class and call [method process_action] on your subclass. - [code]action[/code]: The action to be run, as a Dictionary in the form of a JSON-RPC request or notification. - - - - - - - - - - - - - - - - - - - - - - - A method call was requested but no function of that name existed in the JSONRPC subclass. - - - - - - - diff --git a/modules/jsonrpc/jsonrpc.cpp b/modules/jsonrpc/jsonrpc.cpp deleted file mode 100644 index 651d5e6..0000000 --- a/modules/jsonrpc/jsonrpc.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************/ -/* jsonrpc.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "jsonrpc.h" -#include "core/io/json.h" - -JSONRPC::JSONRPC() { -} - -JSONRPC::~JSONRPC() { -} - -void JSONRPC::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_scope", "scope", "target"), &JSONRPC::set_scope); - ClassDB::bind_method(D_METHOD("process_action", "action", "recurse"), &JSONRPC::process_action, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("process_string", "action"), &JSONRPC::process_string); - - ClassDB::bind_method(D_METHOD("make_request", "method", "params", "id"), &JSONRPC::make_request); - ClassDB::bind_method(D_METHOD("make_response", "result", "id"), &JSONRPC::make_response); - ClassDB::bind_method(D_METHOD("make_notification", "method", "params"), &JSONRPC::make_notification); - ClassDB::bind_method(D_METHOD("make_response_error", "code", "message", "id"), &JSONRPC::make_response_error, DEFVAL(Variant())); - - BIND_ENUM_CONSTANT(PARSE_ERROR); - BIND_ENUM_CONSTANT(INVALID_REQUEST); - BIND_ENUM_CONSTANT(METHOD_NOT_FOUND); - BIND_ENUM_CONSTANT(INVALID_PARAMS); - BIND_ENUM_CONSTANT(INTERNAL_ERROR); -} - -Dictionary JSONRPC::make_response_error(int p_code, const String &p_message, const Variant &p_id) const { - Dictionary dict; - dict["jsonrpc"] = "2.0"; - - Dictionary err; - err["code"] = p_code; - err["message"] = p_message; - - dict["error"] = err; - dict["id"] = p_id; - - return dict; -} - -Dictionary JSONRPC::make_response(const Variant &p_value, const Variant &p_id) { - Dictionary dict; - dict["jsonrpc"] = "2.0"; - dict["id"] = p_id; - dict["result"] = p_value; - return dict; -} - -Dictionary JSONRPC::make_notification(const String &p_method, const Variant &p_params) { - Dictionary dict; - dict["jsonrpc"] = "2.0"; - dict["method"] = p_method; - dict["params"] = p_params; - return dict; -} - -Dictionary JSONRPC::make_request(const String &p_method, const Variant &p_params, const Variant &p_id) { - Dictionary dict; - dict["jsonrpc"] = "2.0"; - dict["method"] = p_method; - dict["params"] = p_params; - dict["id"] = p_id; - return dict; -} - -Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elements) { - Variant ret; - if (p_action.get_type() == Variant::DICTIONARY) { - Dictionary dict = p_action; - String method = dict.get("method", ""); - if (method.begins_with("$/")) { - return ret; - } - - Array args; - if (dict.has("params")) { - Variant params = dict.get("params", Variant()); - if (params.get_type() == Variant::ARRAY) { - args = params; - } else { - args.push_back(params); - } - } - - Object *object = this; - if (method_scopes.has(method.get_base_dir())) { - object = method_scopes[method.get_base_dir()]; - method = method.get_file(); - } - - Variant id; - if (dict.has("id")) { - id = dict["id"]; - } - - if (object == nullptr || !object->has_method(method)) { - ret = make_response_error(JSONRPC::METHOD_NOT_FOUND, "Method not found: " + method, id); - } else { - Variant call_ret = object->callv(method, args); - if (id.get_type() != Variant::NIL) { - ret = make_response(call_ret, id); - } - } - } else if (p_action.get_type() == Variant::ARRAY && p_process_arr_elements) { - Array arr = p_action; - int size = arr.size(); - if (size) { - Array arr_ret; - for (int i = 0; i < size; i++) { - const Variant &var = arr.get(i); - arr_ret.push_back(process_action(var)); - } - ret = arr_ret; - } else { - ret = make_response_error(JSONRPC::INVALID_REQUEST, "Invalid Request"); - } - } else { - ret = make_response_error(JSONRPC::INVALID_REQUEST, "Invalid Request"); - } - return ret; -} - -String JSONRPC::process_string(const String &p_input) { - if (p_input.empty()) { - return String(); - } - - Variant ret; - Variant input; - String err_message; - int err_line; - if (OK != JSON::parse(p_input, input, err_message, err_line)) { - ret = make_response_error(JSONRPC::PARSE_ERROR, "Parse error"); - } else { - ret = process_action(input, true); - } - - if (ret.get_type() == Variant::NIL) { - return ""; - } - return JSON::print(ret); -} - -void JSONRPC::set_scope(const String &p_scope, Object *p_obj) { - method_scopes[p_scope] = p_obj; -} diff --git a/modules/jsonrpc/jsonrpc.h b/modules/jsonrpc/jsonrpc.h deleted file mode 100644 index a88c92a..0000000 --- a/modules/jsonrpc/jsonrpc.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************/ -/* jsonrpc.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#ifndef JSONRPC_H -#define JSONRPC_H - -#include "core/object/object.h" -#include "core/variant/variant.h" - -class JSONRPC : public Object { - GDCLASS(JSONRPC, Object) - - RBMap method_scopes; - -protected: - static void _bind_methods(); - -public: - JSONRPC(); - ~JSONRPC(); - - enum ErrorCode { - PARSE_ERROR = -32700, - INVALID_REQUEST = -32600, - METHOD_NOT_FOUND = -32601, - INVALID_PARAMS = -32602, - INTERNAL_ERROR = -32603, - }; - - Dictionary make_response_error(int p_code, const String &p_message, const Variant &p_id = Variant()) const; - Dictionary make_response(const Variant &p_value, const Variant &p_id); - Dictionary make_notification(const String &p_method, const Variant &p_params); - Dictionary make_request(const String &p_method, const Variant &p_params, const Variant &p_id); - - Variant process_action(const Variant &p_action, bool p_process_arr_elements = false); - String process_string(const String &p_input); - - void set_scope(const String &p_scope, Object *p_obj); -}; - -VARIANT_ENUM_CAST(JSONRPC::ErrorCode); - -#endif // JSONRPC_H diff --git a/modules/jsonrpc/register_types.cpp b/modules/jsonrpc/register_types.cpp deleted file mode 100644 index 9af1e1f..0000000 --- a/modules/jsonrpc/register_types.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************/ -/* register_types.cpp */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#include "register_types.h" - -#include "core/object/class_db.h" - -#include "jsonrpc.h" - -void register_jsonrpc_types(ModuleRegistrationLevel p_level) { - if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { - ClassDB::register_class(); - } -} - -void unregister_jsonrpc_types(ModuleRegistrationLevel p_level) { -} diff --git a/modules/jsonrpc/register_types.h b/modules/jsonrpc/register_types.h deleted file mode 100644 index c1bd311..0000000 --- a/modules/jsonrpc/register_types.h +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************/ -/* register_types.h */ -/**************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/**************************************************************************/ -/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/**************************************************************************/ - -#ifndef JSONRPC_REGISTER_TYPES_H -#define JSONRPC_REGISTER_TYPES_H - -#include "modules/register_module_types.h" - -void register_jsonrpc_types(ModuleRegistrationLevel p_level); -void unregister_jsonrpc_types(ModuleRegistrationLevel p_level); - -#endif // JSONRPC_REGISTER_TYPES_H