diff options
Diffstat (limited to 'editor/doc_tools.cpp')
-rw-r--r-- | editor/doc_tools.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 6acf654b04..36ae19cb23 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -534,11 +534,11 @@ void DocTools::generate(bool p_basic_types) { Vector<Error> errs = ClassDB::get_method_error_return_values(name, E.name); if (errs.size()) { - if (errs.find(OK) == -1) { + if (!errs.has(OK)) { errs.insert(0, OK); } for (int i = 0; i < errs.size(); i++) { - if (method.errors_returned.find(errs[i]) == -1) { + if (!method.errors_returned.has(errs[i])) { method.errors_returned.push_back(errs[i]); } } @@ -1356,7 +1356,12 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str header += " inherits=\"" + c.inherits + "\""; } header += String(" version=\"") + VERSION_BRANCH + "\""; - header += ">"; + // Reference the XML schema so editors can provide error checking. + // Modules are nested deep, so change the path to reference the same schema everywhere. + const String schema_path = save_path.find("modules/") != -1 ? "../../../doc/class.xsd" : "../class.xsd"; + header += vformat( + R"( xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="%s">)", + schema_path); _write_string(f, 0, header); _write_string(f, 1, "<brief_description>"); |