mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-18 19:45:49 +00:00
Make implicit calls spanning one more column to the left/right
This is hacky but useful. e.g. textDocument/definition on the space/semicolon in `A a;` or `return 42;` will take you to the constructor.
This commit is contained in:
parent
c157445ef3
commit
3e1a068c19
14
src/query.cc
14
src/query.cc
@ -230,9 +230,17 @@ QueryFile::Def BuildFileDef(const IdMap& id_map, const IndexFile& indexed) {
|
||||
add_outline(id_map.ToSymbol(func.id), decl.spelling);
|
||||
}
|
||||
for (const IndexFuncRef& caller : func.callers) {
|
||||
// if (caller.is_implicit)
|
||||
// continue;
|
||||
add_all_symbols(id_map.ToSymbol(func.id), caller.loc);
|
||||
// Make ranges of implicit function calls larger (spanning one more column
|
||||
// to the left/right). This is hacky but useful. e.g.
|
||||
// textDocument/definition on the space/semicolon in `A a;` or `return 42;`
|
||||
// will take you to the constructor.
|
||||
Range range = caller.loc;
|
||||
if (caller.is_implicit) {
|
||||
if (range.start.column > 1)
|
||||
range.start.column--;
|
||||
range.end.column++;
|
||||
}
|
||||
add_all_symbols(id_map.ToSymbol(func.id), range);
|
||||
}
|
||||
}
|
||||
for (const IndexVar& var : indexed.vars) {
|
||||
|
Loading…
Reference in New Issue
Block a user