mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	GDScript: Add support for static method calls in native types
This commit is contained in:
		
							parent
							
								
									e4f0fc50f7
								
							
						
					
					
						commit
						4710e2b278
					
				
					 11 changed files with 135 additions and 20 deletions
				
			
		|  | @ -957,7 +957,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base | |||
| 	bool _static = base_type.is_meta_type; | ||||
| 
 | ||||
| 	if (_static && base_type.kind != GDScriptParser::DataType::BUILTIN) { | ||||
| 		ScriptLanguage::CodeCompletionOption option("new", ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION); | ||||
| 		ScriptLanguage::CodeCompletionOption option("new", ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION, ScriptLanguage::LOCATION_LOCAL); | ||||
| 		option.insert_text += "("; | ||||
| 		r_result.insert(option.display, option); | ||||
| 	} | ||||
|  | @ -1058,22 +1058,25 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base | |||
| 					} | ||||
| 				} | ||||
| 
 | ||||
| 				if (!_static || Engine::get_singleton()->has_singleton(type)) { | ||||
| 					List<MethodInfo> methods; | ||||
| 					ClassDB::get_method_list(type, &methods, false, true); | ||||
| 					for (const MethodInfo &E : methods) { | ||||
| 						if (E.name.begins_with("_")) { | ||||
| 							continue; | ||||
| 						} | ||||
| 						int location = p_recursion_depth + _get_method_location(type, E.name); | ||||
| 						ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION, location); | ||||
| 						if (E.arguments.size()) { | ||||
| 							option.insert_text += "("; | ||||
| 						} else { | ||||
| 							option.insert_text += "()"; | ||||
| 						} | ||||
| 						r_result.insert(option.display, option); | ||||
| 				bool only_static = _static && !Engine::get_singleton()->has_singleton(type); | ||||
| 
 | ||||
| 				List<MethodInfo> methods; | ||||
| 				ClassDB::get_method_list(type, &methods, false, true); | ||||
| 				for (const MethodInfo &E : methods) { | ||||
| 					if (only_static && (E.flags & METHOD_FLAG_STATIC) == 0) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					if (E.name.begins_with("_")) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					int location = p_recursion_depth + _get_method_location(type, E.name); | ||||
| 					ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION, location); | ||||
| 					if (E.arguments.size()) { | ||||
| 						option.insert_text += "("; | ||||
| 					} else { | ||||
| 						option.insert_text += "()"; | ||||
| 					} | ||||
| 					r_result.insert(option.display, option); | ||||
| 				} | ||||
| 				return; | ||||
| 			} break; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 George Marques
						George Marques