mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	HackStudio+LibCpp: Include class members in Locator
This commit is contained in:
		
							parent
							
								
									c8ad1df143
								
							
						
					
					
						commit
						c6c83bd80e
					
				
					 3 changed files with 23 additions and 12 deletions
				
			
		|  | @ -308,6 +308,11 @@ NonnullRefPtrVector<Declaration> ParserAutoComplete::get_global_declarations(con | |||
|         if (decl.is_namespace()) { | ||||
|             declarations.append(get_global_declarations(decl)); | ||||
|         } | ||||
|         if (decl.is_struct_or_class()) { | ||||
|             for (auto& member_decl : static_cast<StructOrClassDeclaration&>(decl).declarations()) { | ||||
|                 declarations.append(member_decl); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     return declarations; | ||||
|  | @ -511,7 +516,6 @@ OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_dat | |||
| 
 | ||||
| String ParserAutoComplete::scope_of_declaration(const Declaration& decl) | ||||
| { | ||||
| 
 | ||||
|     auto parent = decl.parent(); | ||||
|     if (!parent) | ||||
|         return {}; | ||||
|  | @ -521,15 +525,17 @@ String ParserAutoComplete::scope_of_declaration(const Declaration& decl) | |||
| 
 | ||||
|     auto& parent_decl = static_cast<Declaration&>(*parent); | ||||
| 
 | ||||
|     if (parent_decl.is_namespace()) { | ||||
|         auto& containing_namespace = static_cast<NamespaceDeclaration&>(parent_decl); | ||||
|         auto scope_of_parent = scope_of_declaration(parent_decl); | ||||
|         if (scope_of_parent.is_null()) | ||||
|             return containing_namespace.m_name; | ||||
|         return String::formatted("{}::{}", scope_of_parent, containing_namespace.m_name); | ||||
|     } | ||||
|     auto parent_scope = scope_of_declaration(parent_decl); | ||||
|     String containing_scope; | ||||
|     if (parent_decl.is_namespace()) | ||||
|         containing_scope = static_cast<NamespaceDeclaration&>(parent_decl).m_name; | ||||
|     if (parent_decl.is_struct_or_class()) | ||||
|         containing_scope = static_cast<StructOrClassDeclaration&>(parent_decl).name(); | ||||
| 
 | ||||
|     return {}; | ||||
|     if (parent_scope.is_null()) | ||||
|         return containing_scope; | ||||
| 
 | ||||
|     return String::formatted("{}::{}", parent_scope, containing_scope); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Itamar
						Itamar