#pragma once #include "query_utils.h" #include "query.h" #include "working_files.h" #include optional GetDefinitionSpellingOfSymbol(QueryDatabase* db, const QueryTypeId& id); optional GetDefinitionSpellingOfSymbol(QueryDatabase* db, const QueryFuncId& id); optional GetDefinitionSpellingOfSymbol(QueryDatabase* db, const QueryVarId& id); optional GetDefinitionSpellingOfSymbol(QueryDatabase* db, const SymbolIdx& symbol); optional GetDefinitionExtentOfSymbol(QueryDatabase* db, const SymbolIdx& symbol); optional GetDeclarationFileForSymbol(QueryDatabase* db, const SymbolIdx& symbol); QueryLocation ToQueryLocation(QueryDatabase* db, Reference ref); QueryFileId GetFileId(QueryDatabase* db, Reference ref); std::vector ToReference(QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation( QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation( QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation( QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation(QueryDatabase* db, const std::vector& ids); std::vector GetUsesOfSymbol(QueryDatabase* db, const SymbolIdx& symbol, bool include_decl); std::vector GetDeclarationsOfSymbolForGotoDefinition( QueryDatabase* db, SymbolIdx symbol); bool HasCallersOnSelfOrBaseOrDerived(QueryDatabase* db, QueryFunc& root); std::vector GetCallersForAllBaseFunctions(QueryDatabase* db, QueryFunc& root); std::vector GetCallersForAllDerivedFunctions(QueryDatabase* db, QueryFunc& root); optional GetLsPosition(WorkingFile* working_file, const Position& position); optional GetLsRange(WorkingFile* working_file, const Range& location); lsDocumentUri GetLsDocumentUri(QueryDatabase* db, QueryFileId file_id, std::string* path); lsDocumentUri GetLsDocumentUri(QueryDatabase* db, QueryFileId file_id); optional GetLsLocation(QueryDatabase* db, WorkingFiles* working_files, Reference location); std::vector GetLsLocations( QueryDatabase* db, WorkingFiles* working_files, const std::vector& locations); // Returns a symbol. The symbol will have *NOT* have a location assigned. optional GetSymbolInfo(QueryDatabase* db, WorkingFiles* working_files, SymbolIdx symbol, bool use_short_name); std::vector FindSymbolsAtLocation(WorkingFile* working_file, QueryFile* file, lsPosition position); void EmitDiagnostics(WorkingFiles* working_files, std::string path, std::vector diagnostics); template void EachWithGen(std::vector& collection, Id x, Fn fn) { Q& obj = collection[x.id]; // FIXME Deprecate optional def // if (obj.gen == x.gen && obj.def) if (obj.def) fn(obj); } template void EachWithGen(std::vector& collection, std::vector>& ids, Fn fn) { for (Id x : ids) { Q& obj = collection[x.id]; if (obj.def) // FIXME Deprecate optional def fn(obj); } }