MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _validate_symbol

Method _validate_symbol

editor/script/script_text_editor.cpp:1362–1386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1360}
1361
1362void ScriptTextEditor::_validate_symbol(const String &p_symbol) {
1363 CodeEdit *text_edit = code_editor->get_text_editor();
1364
1365 Node *base = get_tree()->get_edited_scene_root();
1366 if (base) {
1367 base = _find_node_for_script(base, base, script);
1368 }
1369
1370 ScriptLanguage::LookupResult result;
1371 String lc_text = code_editor->get_text_editor()->get_text_for_symbol_lookup();
1372 Error lc_error = script->get_language()->lookup_code(lc_text, p_symbol, script->get_path(), base, result);
1373 bool is_singleton = ProjectSettings::get_singleton()->has_autoload(p_symbol) && ProjectSettings::get_singleton()->get_autoload(p_symbol).is_singleton;
1374 if (lc_error == OK || is_singleton || ScriptServer::is_global_class(p_symbol) || p_symbol.is_resource_file() || p_symbol.begins_with("uid://")) {
1375 text_edit->set_symbol_lookup_word_as_valid(true);
1376 } else if (p_symbol.is_relative_path()) {
1377 String path = _get_absolute_path(p_symbol);
1378 if (FileAccess::exists(path)) {
1379 text_edit->set_symbol_lookup_word_as_valid(true);
1380 } else {
1381 text_edit->set_symbol_lookup_word_as_valid(false);
1382 }
1383 } else {
1384 text_edit->set_symbol_lookup_word_as_valid(false);
1385 }
1386}
1387
1388void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, int p_column) {
1389 if (!EDITOR_GET("text_editor/behavior/documentation/enable_tooltips").booleanize()) {

Callers

nothing calls this directly

Calls 13

get_text_editorMethod · 0.80
has_autoloadMethod · 0.80
get_autoloadMethod · 0.80
is_resource_fileMethod · 0.80
begins_withMethod · 0.80
is_relative_pathMethod · 0.80
_find_node_for_scriptFunction · 0.70
get_edited_scene_rootMethod · 0.45
lookup_codeMethod · 0.45
get_languageMethod · 0.45

Tested by

no test coverage detected