mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Added support for scripts reporting multiple errors to ScriptTextEditor
Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
This commit is contained in:
parent
0a6a71973e
commit
d0e78c86d7
16 changed files with 163 additions and 63 deletions
|
@ -131,7 +131,7 @@ static void get_function_names_recursively(const GDScriptParser::ClassNode *p_cl
|
|||
}
|
||||
}
|
||||
|
||||
bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
|
||||
bool GDScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
|
||||
GDScriptParser parser;
|
||||
GDScriptAnalyzer analyzer(&parser);
|
||||
|
||||
|
@ -156,10 +156,16 @@ bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &
|
|||
}
|
||||
#endif
|
||||
if (err) {
|
||||
GDScriptParser::ParserError parse_error = parser.get_errors().front()->get();
|
||||
r_line_error = parse_error.line;
|
||||
r_col_error = parse_error.column;
|
||||
r_test_error = parse_error.message;
|
||||
if (r_errors) {
|
||||
for (const List<GDScriptParser::ParserError>::Element *E = parser.get_errors().front(); E; E = E->next()) {
|
||||
const GDScriptParser::ParserError &pe = E->get();
|
||||
ScriptLanguage::ScriptError e;
|
||||
e.line = pe.line;
|
||||
e.column = pe.column;
|
||||
e.message = pe.message;
|
||||
r_errors->push_back(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
const GDScriptParser::ClassNode *cl = parser.get_tree();
|
||||
|
@ -2378,7 +2384,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
|
|||
r_forced = r_result.size() > 0;
|
||||
}
|
||||
|
||||
Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_forced, String &r_call_hint) {
|
||||
::Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_forced, String &r_call_hint) {
|
||||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
|
||||
|
||||
GDScriptParser parser;
|
||||
|
@ -2929,7 +2935,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
return ERR_CANT_RESOLVE;
|
||||
}
|
||||
|
||||
Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result) {
|
||||
::Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result) {
|
||||
//before parsing, try the usual stuff
|
||||
if (ClassDB::class_exists(p_symbol)) {
|
||||
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue