mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
Fix code lens sometimes appearing on "};"
This commit is contained in:
parent
8bbd9b7694
commit
f5ed2828c3
@ -488,6 +488,15 @@ optional<lsRange> GetLsRange(WorkingFile* working_file, const Range& location) {
|
|||||||
if (!start || !end)
|
if (!start || !end)
|
||||||
return nullopt;
|
return nullopt;
|
||||||
|
|
||||||
|
// If remapping end fails (end can never be < start), just guess that the
|
||||||
|
// final location didn't move. This only screws up the highlighted code
|
||||||
|
// region if we guess wrong, so not a big deal.
|
||||||
|
//
|
||||||
|
// Remapping fails often in C++ since there are a lot of "};" at the end of
|
||||||
|
// class/struct definitions.
|
||||||
|
if (*end < *start)
|
||||||
|
*end = *start + (location.end.line - location.start.line);
|
||||||
|
|
||||||
return lsRange(
|
return lsRange(
|
||||||
lsPosition(*start - 1, location.start.column - 1),
|
lsPosition(*start - 1, location.start.column - 1),
|
||||||
lsPosition(*end - 1, location.end.column - 1));
|
lsPosition(*end - 1, location.end.column - 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user