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

Method _error_clicked

editor/script/script_text_editor.cpp:323–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323void ScriptTextEditor::_error_clicked(const Variant &p_line) {
324 if (p_line.get_type() == Variant::INT) {
325 goto_line_centered(p_line.operator int64_t());
326 } else if (p_line.get_type() == Variant::DICTIONARY) {
327 Dictionary meta = p_line.operator Dictionary();
328 const String path = meta["path"].operator String();
329 const int line = meta["line"].operator int64_t();
330 const int column = meta["column"].operator int64_t();
331 if (path.is_empty()) {
332 goto_line_centered(line, column);
333 } else {
334 Ref<Resource> scr = ResourceLoader::load(path);
335 if (scr.is_null()) {
336 EditorNode::get_singleton()->show_warning(TTR("Could not load file at:") + "\n\n" + path, TTR("Error!"));
337 } else {
338 int corrected_column = column;
339
340 const String line_text = code_editor->get_text_editor()->get_line(line);
341 const int indent_size = code_editor->get_text_editor()->get_indent_size();
342 if (indent_size > 1) {
343 const int tab_count = line_text.length() - line_text.lstrip("\t").length();
344 corrected_column -= tab_count * (indent_size - 1);
345 }
346
347 ScriptEditor::get_singleton()->edit(scr, line, corrected_column);
348 }
349 }
350 }
351}
352
353void ScriptTextEditor::reload_text() {
354 ERR_FAIL_COND(script.is_null());

Callers

nothing calls this directly

Calls 14

TTRFunction · 0.85
int64_tMethod · 0.80
show_warningMethod · 0.80
get_text_editorMethod · 0.80
get_indent_sizeMethod · 0.80
lstripMethod · 0.80
get_typeMethod · 0.45
DictionaryMethod · 0.45
StringMethod · 0.45
is_emptyMethod · 0.45
is_nullMethod · 0.45
get_lineMethod · 0.45

Tested by

no test coverage detected