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:
Eric M 2021-05-18 13:09:19 +10:00
parent 0a6a71973e
commit d0e78c86d7
16 changed files with 163 additions and 63 deletions

View file

@ -112,20 +112,29 @@ Ref<Script> PluginScriptLanguage::get_template(const String &p_class_name, const
return script;
}
bool PluginScriptLanguage::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 PluginScriptLanguage::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 {
PackedStringArray functions;
Array errors;
if (_desc.validate) {
bool ret = _desc.validate(
_data,
(godot_string *)&p_script,
&r_line_error,
&r_col_error,
(godot_string *)&r_test_error,
(godot_string *)&p_path,
(godot_packed_string_array *)&functions);
(godot_packed_string_array *)&functions,
(godot_array *)&errors);
for (int i = 0; i < functions.size(); i++) {
r_functions->push_back(functions[i]);
}
if (r_errors) {
for (int i = 0; i < errors.size(); i++) {
Dictionary error = errors[i];
ScriptLanguage::ScriptError e;
e.line = error["line"];
e.column = error["column"];
e.message = error["message"];
r_errors->push_back(e);
}
}
return ret;
}
return true;