mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Hack to restrict the region.
This commit is contained in:
parent
5d94d138cf
commit
6a03a86e64
@ -136,6 +136,22 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
continue; // applies to for loop
|
||||
is_type_member = func->def->declaring_type.has_value();
|
||||
detailed_name = func->def->short_name;
|
||||
|
||||
// TODO We use cursor extent for lambda definition. Without the region
|
||||
// shrinking hack, the contained keywords and primitive types will be
|
||||
// highlighted undesiredly.
|
||||
auto concise_name = detailed_name.substr(0, detailed_name.find('<'));
|
||||
if (sym.loc.range.start.line <= working_file->index_lines.size()) {
|
||||
std::string& line =
|
||||
working_file->index_lines[sym.loc.range.start.line - 1];
|
||||
auto pos = line.find(concise_name);
|
||||
sym.loc.range.end.line = sym.loc.range.start.line;
|
||||
if (pos == std::string::npos)
|
||||
sym.loc.range.end.column = sym.loc.range.start.column;
|
||||
else
|
||||
sym.loc.range.end.column =
|
||||
sym.loc.range.start.column + concise_name.size();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SymbolKind::Var: {
|
||||
|
Loading…
Reference in New Issue
Block a user