feat: updated godot version
This commit is contained in:
parent
0c508b0831
commit
42b028dbb5
4694 changed files with 236470 additions and 401376 deletions
|
|
@ -34,38 +34,32 @@
|
|||
#include "gdscript_extend_parser.h"
|
||||
#include "gdscript_language_protocol.h"
|
||||
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "editor/script/script_editor_plugin.h"
|
||||
#include "editor/script/script_text_editor.h"
|
||||
#include "editor/settings/editor_settings.h"
|
||||
#include "servers/display/display_server.h"
|
||||
|
||||
void GDScriptTextDocument::_bind_methods() {
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
void GDScriptTextDocument::didOpen(const Variant &p_param) {
|
||||
|
|
@ -128,6 +122,21 @@ void GDScriptTextDocument::notify_client_show_symbol(const LSP::DocumentSymbol *
|
|||
GDScriptLanguageProtocol::get_singleton()->notify_client("gdscript/show_native_symbol", symbol->to_json(true));
|
||||
}
|
||||
|
||||
void GDScriptTextDocument::initialize() {
|
||||
if (GDScriptLanguageProtocol::get_singleton()->is_smart_resolve_enabled()) {
|
||||
for (const KeyValue<StringName, ClassMembers> &E : GDScriptLanguageProtocol::get_singleton()->get_workspace()->native_members) {
|
||||
const ClassMembers &members = E.value;
|
||||
|
||||
for (const KeyValue<String, const LSP::DocumentSymbol *> &F : members) {
|
||||
const LSP::DocumentSymbol *symbol = members.get(F.key);
|
||||
LSP::CompletionItem item = symbol->make_completion_item();
|
||||
item.data = JOIN_SYMBOLS(String(E.key), F.key);
|
||||
native_member_completions.push_back(item.to_json());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Variant GDScriptTextDocument::nativeSymbol(const Dictionary &p_params) {
|
||||
Variant ret;
|
||||
|
||||
|
|
@ -156,25 +165,6 @@ Array GDScriptTextDocument::documentSymbol(const Dictionary &p_params) {
|
|||
return arr;
|
||||
}
|
||||
|
||||
Array GDScriptTextDocument::documentHighlight(const Dictionary &p_params) {
|
||||
Array arr;
|
||||
LSP::TextDocumentPositionParams params;
|
||||
params.load(p_params);
|
||||
|
||||
const LSP::DocumentSymbol *symbol = GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_symbol(params);
|
||||
if (symbol) {
|
||||
String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(params.textDocument.uri);
|
||||
Vector<LSP::Location> usages = GDScriptLanguageProtocol::get_singleton()->get_workspace()->find_usages_in_file(*symbol, path);
|
||||
|
||||
for (const LSP::Location &usage : usages) {
|
||||
LSP::DocumentHighlight highlight;
|
||||
highlight.range = usage.range;
|
||||
arr.push_back(highlight.to_json());
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Array GDScriptTextDocument::completion(const Dictionary &p_params) {
|
||||
Array arr;
|
||||
|
||||
|
|
@ -299,6 +289,33 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
|
|||
if (data.get_type() == Variant::DICTIONARY) {
|
||||
params.load(p_params["data"]);
|
||||
symbol = GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_symbol(params, item.label, item.kind == LSP::CompletionItemKind::Method || item.kind == LSP::CompletionItemKind::Function);
|
||||
|
||||
} else if (data.is_string()) {
|
||||
String query = data;
|
||||
|
||||
Vector<String> param_symbols = query.split(SYMBOL_SEPARATOR, false);
|
||||
|
||||
if (param_symbols.size() >= 2) {
|
||||
StringName class_name = param_symbols[0];
|
||||
const String &member_name = param_symbols[param_symbols.size() - 1];
|
||||
String inner_class_name;
|
||||
if (param_symbols.size() >= 3) {
|
||||
inner_class_name = param_symbols[1];
|
||||
}
|
||||
|
||||
if (const ClassMembers *members = GDScriptLanguageProtocol::get_singleton()->get_workspace()->native_members.getptr(class_name)) {
|
||||
if (const LSP::DocumentSymbol *const *member = members->getptr(member_name)) {
|
||||
symbol = *member;
|
||||
}
|
||||
}
|
||||
|
||||
if (!symbol) {
|
||||
ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_parse_result(class_name);
|
||||
if (parser) {
|
||||
symbol = parser->get_member_symbol(member_name, inner_class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue