mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Merge pull request #95821 from anvilfolk/cache-gd-docs
Scripting: Fix script docs not being searchable without manually recompiling scripts
This commit is contained in:
		
						commit
						0cc7e2c27a
					
				
					 8 changed files with 358 additions and 148 deletions
				
			
		| 
						 | 
				
			
			@ -2286,39 +2286,9 @@ void ScriptEditor::_update_script_names() {
 | 
			
		|||
			sedata.push_back(sd);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Vector<String> disambiguated_script_names;
 | 
			
		||||
		Vector<String> full_script_paths;
 | 
			
		||||
		for (int j = 0; j < sedata.size(); j++) {
 | 
			
		||||
			String name = sedata[j].name.replace("(*)", "");
 | 
			
		||||
			ScriptListName script_display = (ScriptListName)(int)EDITOR_GET("text_editor/script_list/list_script_names_as");
 | 
			
		||||
			switch (script_display) {
 | 
			
		||||
				case DISPLAY_NAME: {
 | 
			
		||||
					name = name.get_file();
 | 
			
		||||
				} break;
 | 
			
		||||
				case DISPLAY_DIR_AND_NAME: {
 | 
			
		||||
					name = name.get_base_dir().get_file().path_join(name.get_file());
 | 
			
		||||
				} break;
 | 
			
		||||
				default:
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			disambiguated_script_names.append(name);
 | 
			
		||||
			full_script_paths.append(sedata[j].tooltip);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		EditorNode::disambiguate_filenames(full_script_paths, disambiguated_script_names);
 | 
			
		||||
 | 
			
		||||
		for (int j = 0; j < sedata.size(); j++) {
 | 
			
		||||
			if (sedata[j].name.ends_with("(*)")) {
 | 
			
		||||
				sedata.write[j].name = disambiguated_script_names[j] + "(*)";
 | 
			
		||||
			} else {
 | 
			
		||||
				sedata.write[j].name = disambiguated_script_names[j];
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
 | 
			
		||||
		if (eh) {
 | 
			
		||||
			String name = eh->get_class();
 | 
			
		||||
		if (eh && !eh->get_class().is_empty()) {
 | 
			
		||||
			String name = eh->get_class().unquote();
 | 
			
		||||
			Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Help"));
 | 
			
		||||
			String tooltip = vformat(TTR("%s Class Reference"), name);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2336,6 +2306,36 @@ void ScriptEditor::_update_script_names() {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Vector<String> disambiguated_script_names;
 | 
			
		||||
	Vector<String> full_script_paths;
 | 
			
		||||
	for (int j = 0; j < sedata.size(); j++) {
 | 
			
		||||
		String name = sedata[j].name.replace("(*)", "");
 | 
			
		||||
		ScriptListName script_display = (ScriptListName)(int)EDITOR_GET("text_editor/script_list/list_script_names_as");
 | 
			
		||||
		switch (script_display) {
 | 
			
		||||
			case DISPLAY_NAME: {
 | 
			
		||||
				name = name.get_file();
 | 
			
		||||
			} break;
 | 
			
		||||
			case DISPLAY_DIR_AND_NAME: {
 | 
			
		||||
				name = name.get_base_dir().get_file().path_join(name.get_file());
 | 
			
		||||
			} break;
 | 
			
		||||
			default:
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		disambiguated_script_names.append(name);
 | 
			
		||||
		full_script_paths.append(sedata[j].tooltip);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	EditorNode::disambiguate_filenames(full_script_paths, disambiguated_script_names);
 | 
			
		||||
 | 
			
		||||
	for (int j = 0; j < sedata.size(); j++) {
 | 
			
		||||
		if (sedata[j].name.ends_with("(*)")) {
 | 
			
		||||
			sedata.write[j].name = disambiguated_script_names[j] + "(*)";
 | 
			
		||||
		} else {
 | 
			
		||||
			sedata.write[j].name = disambiguated_script_names[j];
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_sort_list_on_update && !sedata.is_empty()) {
 | 
			
		||||
		sedata.sort();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -3704,7 +3704,7 @@ bool ScriptEditor::_help_tab_goto(const String &p_name, const String &p_desc) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void ScriptEditor::update_doc(const String &p_name) {
 | 
			
		||||
	ERR_FAIL_COND(!EditorHelp::get_doc_data()->has_doc(p_name));
 | 
			
		||||
	ERR_FAIL_COND(!EditorHelp::has_doc(p_name));
 | 
			
		||||
 | 
			
		||||
	for (int i = 0; i < tab_container->get_tab_count(); i++) {
 | 
			
		||||
		EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue