#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); std::vector ToQueryLocation( QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation( QueryDatabase* db, const std::vector& refs); std::vector ToQueryLocation(QueryDatabase* db, std::vector>*); std::vector ToQueryLocation(QueryDatabase* db, std::vector>*); std::vector ToQueryLocation(QueryDatabase* db, std::vector>*); 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, const 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, const QueryLocation& 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, WithGen> x, Fn fn) { Q& obj = collection[x.value.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) { size_t j = 0; for (WithGen> x : ids) { Q& obj = collection[x.value.id]; if (1 /*obj.gen == x.gen*/) { if (obj.def) // FIXME Deprecate optional def fn(obj); ids[j++] = x; } } ids.resize(j); }