mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-10-30 20:22:38 +00:00 
			
		
		
		
	Fix 'Base' code lens on interface parent types
This commit is contained in:
		
							parent
							
								
									f158f759b1
								
							
						
					
					
						commit
						e32adb1786
					
				| @ -190,10 +190,14 @@ std::vector<QueryableLocation> GetDeclarationsOfSymbolForGotoDefinition(Queryabl | |||||||
|   return {}; |   return {}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| optional<QueryableLocation> GetBaseDefinitionSpelling(QueryableDatabase* db, QueryableFuncDef& func) { | optional<QueryableLocation> GetBaseDefinitionOrDeclarationSpelling(QueryableDatabase* db, QueryableFuncDef& func) { | ||||||
|   if (!func.def.base) |   if (!func.def.base) | ||||||
|     return nullopt; |     return nullopt; | ||||||
|   return db->funcs[func.def.base->id].def.definition_spelling; |   QueryableFuncDef& base = db->funcs[func.def.base->id]; | ||||||
|  |   auto def = base.def.definition_spelling; | ||||||
|  |   if (!def && !base.declarations.empty()) | ||||||
|  |     def = base.declarations[0]; | ||||||
|  |   return def; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::vector<QueryFuncRef> GetCallersForAllBaseFunctions(QueryableDatabase* db, QueryableFuncDef& root) { | std::vector<QueryFuncRef> GetCallersForAllBaseFunctions(QueryableDatabase* db, QueryableFuncDef& root) { | ||||||
| @ -1006,9 +1010,9 @@ void QueryDbMainLoop( | |||||||
|           AddCodeLens(&common, ref.loc.OffsetStartColumn(offset++), ToQueryableLocation(db, func.derived), "derived", "derived"); |           AddCodeLens(&common, ref.loc.OffsetStartColumn(offset++), ToQueryableLocation(db, func.derived), "derived", "derived"); | ||||||
| 
 | 
 | ||||||
|           // "Base"
 |           // "Base"
 | ||||||
|           optional<QueryableLocation> base_definition = GetBaseDefinitionSpelling(db, func); |           optional<QueryableLocation> base_loc = GetBaseDefinitionOrDeclarationSpelling(db, func); | ||||||
|           if (base_definition) { |           if (base_loc) { | ||||||
|             optional<lsLocation> ls_base = GetLsLocation(db, working_files, *base_definition); |             optional<lsLocation> ls_base = GetLsLocation(db, working_files, *base_loc); | ||||||
|             if (ls_base) { |             if (ls_base) { | ||||||
|               optional<lsRange> range = GetLsRange(common.working_file, ref.loc.range); |               optional<lsRange> range = GetLsRange(common.working_file, ref.loc.range); | ||||||
|               if (range) { |               if (range) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user