Selaa lähdekoodia

Add setting to exclude addons from script warnings

(cherry picked from commit d7137a6b7233c6867c717883a61a1c3607ae84e5)
mashumafi 5 vuotta sitten
vanhempi
commit
717c492eb6
2 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 1 0
      modules/gdscript/gdscript.cpp
  2. 3 0
      modules/gdscript/gdscript_parser.cpp

+ 1 - 0
modules/gdscript/gdscript.cpp

@@ -2134,6 +2134,7 @@ GDScriptLanguage::GDScriptLanguage() {
 #ifdef DEBUG_ENABLED
 	GLOBAL_DEF("debug/gdscript/warnings/enable", true);
 	GLOBAL_DEF("debug/gdscript/warnings/treat_warnings_as_errors", false);
+	GLOBAL_DEF("debug/gdscript/warnings/exclude_addons", true);
 	GLOBAL_DEF("debug/gdscript/completion/autocomplete_setters_and_getters", false);
 	for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) {
 		String warning = GDScriptWarning::get_name_from_code((GDScriptWarning::Code)i).to_lower();

+ 3 - 0
modules/gdscript/gdscript_parser.cpp

@@ -8179,6 +8179,9 @@ void GDScriptParser::_add_warning(int p_code, int p_line, const String &p_symbol
 }
 
 void GDScriptParser::_add_warning(int p_code, int p_line, const Vector<String> &p_symbols) {
+	if (GLOBAL_GET("debug/gdscript/warnings/exclude_addons").booleanize() && base_path.begins_with("res://addons/")) {
+		return;
+	}
 	if (tokenizer->is_ignoring_warnings() || !GLOBAL_GET("debug/gdscript/warnings/enable").booleanize()) {
 		return;
 	}