LSP: Fix type bind, mark as experimental, deprecate direct LSP access
This commit is contained in:
parent
bf95b62586
commit
c416cbaf54
12 changed files with 332 additions and 43 deletions
|
|
@ -174,15 +174,18 @@ String GDScriptLanguageProtocol::format_output(const String &p_text) {
|
|||
}
|
||||
|
||||
void GDScriptLanguageProtocol::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_text_document"), &GDScriptLanguageProtocol::get_text_document);
|
||||
ClassDB::bind_method(D_METHOD("get_workspace"), &GDScriptLanguageProtocol::get_workspace);
|
||||
ClassDB::bind_method(D_METHOD("is_smart_resolve_enabled"), &GDScriptLanguageProtocol::is_smart_resolve_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_initialized"), &GDScriptLanguageProtocol::is_initialized);
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
ClassDB::bind_method(D_METHOD("initialize", "params"), &GDScriptLanguageProtocol::initialize);
|
||||
ClassDB::bind_method(D_METHOD("initialized", "params"), &GDScriptLanguageProtocol::initialized);
|
||||
ClassDB::bind_method(D_METHOD("on_client_connected"), &GDScriptLanguageProtocol::on_client_connected);
|
||||
ClassDB::bind_method(D_METHOD("on_client_disconnected"), &GDScriptLanguageProtocol::on_client_disconnected);
|
||||
ClassDB::bind_method(D_METHOD("on_client_disconnected", "client_id"), &GDScriptLanguageProtocol::on_client_disconnected);
|
||||
ClassDB::bind_method(D_METHOD("notify_client", "method", "params", "client_id"), &GDScriptLanguageProtocol::notify_client, DEFVAL(Variant()), DEFVAL(-1));
|
||||
ClassDB::bind_method(D_METHOD("is_smart_resolve_enabled"), &GDScriptLanguageProtocol::is_smart_resolve_enabled);
|
||||
ClassDB::bind_method(D_METHOD("get_text_document"), &GDScriptLanguageProtocol::get_text_document);
|
||||
ClassDB::bind_method(D_METHOD("get_workspace"), &GDScriptLanguageProtocol::get_workspace);
|
||||
ClassDB::bind_method(D_METHOD("is_initialized"), &GDScriptLanguageProtocol::is_initialized);
|
||||
#endif // !DISABLE_DEPRECATED
|
||||
}
|
||||
|
||||
Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void GDScriptLanguageServer::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (started && !use_thread) {
|
||||
protocol.poll(poll_limit_usec);
|
||||
GDScriptLanguageProtocol::get_singleton()->poll(poll_limit_usec);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ void GDScriptLanguageServer::thread_main(void *p_userdata) {
|
|||
GDScriptLanguageServer *self = static_cast<GDScriptLanguageServer *>(p_userdata);
|
||||
while (self->thread_running) {
|
||||
// Poll 20 times per second
|
||||
self->protocol.poll(self->poll_limit_usec);
|
||||
GDScriptLanguageProtocol::get_singleton()->poll(self->poll_limit_usec);
|
||||
OS::get_singleton()->delay_usec(50000);
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ void GDScriptLanguageServer::start() {
|
|||
port = (GDScriptLanguageServer::port_override > -1) ? GDScriptLanguageServer::port_override : (int)_EDITOR_GET("network/language_server/remote_port");
|
||||
use_thread = (bool)_EDITOR_GET("network/language_server/use_thread");
|
||||
poll_limit_usec = (int)_EDITOR_GET("network/language_server/poll_limit_usec");
|
||||
if (protocol.start(port, IPAddress(host)) == OK) {
|
||||
if (GDScriptLanguageProtocol::get_singleton()->start(port, IPAddress(host)) == OK) {
|
||||
EditorNode::get_log()->add_message("--- GDScript language server started on port " + itos(port) + " ---", EditorLog::MSG_TYPE_EDITOR);
|
||||
if (use_thread) {
|
||||
thread_running = true;
|
||||
|
|
@ -115,7 +115,7 @@ void GDScriptLanguageServer::stop() {
|
|||
thread_running = false;
|
||||
thread.wait_to_finish();
|
||||
}
|
||||
protocol.stop();
|
||||
GDScriptLanguageProtocol::get_singleton()->stop();
|
||||
started = false;
|
||||
EditorNode::get_log()->add_message("--- GDScript language server stopped ---", EditorLog::MSG_TYPE_EDITOR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
class GDScriptLanguageServer : public EditorPlugin {
|
||||
GDCLASS(GDScriptLanguageServer, EditorPlugin);
|
||||
|
||||
GDScriptLanguageProtocol protocol;
|
||||
|
||||
Thread thread;
|
||||
bool thread_running = false;
|
||||
// There is no notification when the editor is initialized. We need to poll till we attempted to start the server.
|
||||
|
|
|
|||
|
|
@ -39,27 +39,30 @@
|
|||
#include "servers/display/display_server.h"
|
||||
|
||||
void GDScriptTextDocument::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("didOpen"), &GDScriptTextDocument::didOpen);
|
||||
ClassDB::bind_method(D_METHOD("didClose"), &GDScriptTextDocument::didClose);
|
||||
ClassDB::bind_method(D_METHOD("didChange"), &GDScriptTextDocument::didChange);
|
||||
ClassDB::bind_method(D_METHOD("willSaveWaitUntil"), &GDScriptTextDocument::willSaveWaitUntil);
|
||||
ClassDB::bind_method(D_METHOD("didSave"), &GDScriptTextDocument::didSave);
|
||||
ClassDB::bind_method(D_METHOD("nativeSymbol"), &GDScriptTextDocument::nativeSymbol);
|
||||
ClassDB::bind_method(D_METHOD("documentSymbol"), &GDScriptTextDocument::documentSymbol);
|
||||
ClassDB::bind_method(D_METHOD("completion"), &GDScriptTextDocument::completion);
|
||||
ClassDB::bind_method(D_METHOD("resolve"), &GDScriptTextDocument::resolve);
|
||||
ClassDB::bind_method(D_METHOD("rename"), &GDScriptTextDocument::rename);
|
||||
ClassDB::bind_method(D_METHOD("prepareRename"), &GDScriptTextDocument::prepareRename);
|
||||
ClassDB::bind_method(D_METHOD("references"), &GDScriptTextDocument::references);
|
||||
ClassDB::bind_method(D_METHOD("foldingRange"), &GDScriptTextDocument::foldingRange);
|
||||
ClassDB::bind_method(D_METHOD("codeLens"), &GDScriptTextDocument::codeLens);
|
||||
ClassDB::bind_method(D_METHOD("documentLink"), &GDScriptTextDocument::documentLink);
|
||||
ClassDB::bind_method(D_METHOD("colorPresentation"), &GDScriptTextDocument::colorPresentation);
|
||||
ClassDB::bind_method(D_METHOD("hover"), &GDScriptTextDocument::hover);
|
||||
ClassDB::bind_method(D_METHOD("definition"), &GDScriptTextDocument::definition);
|
||||
ClassDB::bind_method(D_METHOD("declaration"), &GDScriptTextDocument::declaration);
|
||||
ClassDB::bind_method(D_METHOD("signatureHelp"), &GDScriptTextDocument::signatureHelp);
|
||||
ClassDB::bind_method(D_METHOD("show_native_symbol_in_editor"), &GDScriptTextDocument::show_native_symbol_in_editor);
|
||||
ClassDB::bind_method(D_METHOD("show_native_symbol_in_editor", "symbol_id"), &GDScriptTextDocument::show_native_symbol_in_editor);
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
ClassDB::bind_method(D_METHOD("didOpen", "params"), &GDScriptTextDocument::didOpen);
|
||||
ClassDB::bind_method(D_METHOD("didClose", "params"), &GDScriptTextDocument::didClose);
|
||||
ClassDB::bind_method(D_METHOD("didChange", "params"), &GDScriptTextDocument::didChange);
|
||||
ClassDB::bind_method(D_METHOD("willSaveWaitUntil", "params"), &GDScriptTextDocument::willSaveWaitUntil);
|
||||
ClassDB::bind_method(D_METHOD("didSave", "params"), &GDScriptTextDocument::didSave);
|
||||
ClassDB::bind_method(D_METHOD("nativeSymbol", "params"), &GDScriptTextDocument::nativeSymbol);
|
||||
ClassDB::bind_method(D_METHOD("documentSymbol", "params"), &GDScriptTextDocument::documentSymbol);
|
||||
ClassDB::bind_method(D_METHOD("completion", "params"), &GDScriptTextDocument::completion);
|
||||
ClassDB::bind_method(D_METHOD("resolve", "params"), &GDScriptTextDocument::resolve);
|
||||
ClassDB::bind_method(D_METHOD("rename", "params"), &GDScriptTextDocument::rename);
|
||||
ClassDB::bind_method(D_METHOD("prepareRename", "params"), &GDScriptTextDocument::prepareRename);
|
||||
ClassDB::bind_method(D_METHOD("references", "params"), &GDScriptTextDocument::references);
|
||||
ClassDB::bind_method(D_METHOD("foldingRange", "params"), &GDScriptTextDocument::foldingRange);
|
||||
ClassDB::bind_method(D_METHOD("codeLens", "params"), &GDScriptTextDocument::codeLens);
|
||||
ClassDB::bind_method(D_METHOD("documentLink", "params"), &GDScriptTextDocument::documentLink);
|
||||
ClassDB::bind_method(D_METHOD("colorPresentation", "params"), &GDScriptTextDocument::colorPresentation);
|
||||
ClassDB::bind_method(D_METHOD("hover", "params"), &GDScriptTextDocument::hover);
|
||||
ClassDB::bind_method(D_METHOD("definition", "params"), &GDScriptTextDocument::definition);
|
||||
ClassDB::bind_method(D_METHOD("declaration", "params"), &GDScriptTextDocument::declaration);
|
||||
ClassDB::bind_method(D_METHOD("signatureHelp", "params"), &GDScriptTextDocument::signatureHelp);
|
||||
#endif // !DISABLE_DEPRECATED
|
||||
}
|
||||
|
||||
void GDScriptTextDocument::didOpen(const Variant &p_param) {
|
||||
|
|
|
|||
|
|
@ -43,16 +43,16 @@
|
|||
#include "editor/settings/editor_settings.h"
|
||||
|
||||
void GDScriptWorkspace::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("apply_new_signal"), &GDScriptWorkspace::apply_new_signal);
|
||||
ClassDB::bind_method(D_METHOD("apply_new_signal", "obj", "function", "args"), &GDScriptWorkspace::apply_new_signal);
|
||||
ClassDB::bind_method(D_METHOD("get_file_path", "uri"), &GDScriptWorkspace::get_file_path);
|
||||
ClassDB::bind_method(D_METHOD("get_file_uri", "path"), &GDScriptWorkspace::get_file_uri);
|
||||
ClassDB::bind_method(D_METHOD("publish_diagnostics", "path"), &GDScriptWorkspace::publish_diagnostics);
|
||||
ClassDB::bind_method(D_METHOD("generate_script_api", "path"), &GDScriptWorkspace::generate_script_api);
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
ClassDB::bind_method(D_METHOD("didDeleteFiles"), &GDScriptWorkspace::didDeleteFiles);
|
||||
ClassDB::bind_method(D_METHOD("didDeleteFiles", "params"), &GDScriptWorkspace::didDeleteFiles);
|
||||
ClassDB::bind_method(D_METHOD("parse_script", "path", "content"), &GDScriptWorkspace::parse_script);
|
||||
ClassDB::bind_method(D_METHOD("parse_local_script", "path"), &GDScriptWorkspace::parse_script);
|
||||
ClassDB::bind_method(D_METHOD("parse_local_script", "path"), &GDScriptWorkspace::parse_local_script);
|
||||
ClassDB::bind_method(D_METHOD("publish_diagnostics", "path"), &GDScriptWorkspace::publish_diagnostics);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GDScriptWorkspace : public RefCounted {
|
|||
|
||||
private:
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
void didDeleteFiles() {}
|
||||
void didDeleteFiles(const Dictionary &p_params) {}
|
||||
Error parse_script(const String &p_path, const String &p_content) {
|
||||
WARN_DEPRECATED;
|
||||
return Error::FAILED;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue