mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Fix #452
This commit is contained in:
parent
aba38a9da1
commit
9fddd5173e
@ -139,7 +139,7 @@ struct TextDocumentDefinitionHandler
|
|||||||
// For symbols whose detailed names contain |query| as a substring,
|
// For symbols whose detailed names contain |query| as a substring,
|
||||||
// we use the tuple <length difference, not in the same file, line
|
// we use the tuple <length difference, not in the same file, line
|
||||||
// distance> to find the best match.
|
// distance> to find the best match.
|
||||||
std::tuple<int, bool, int> best_score = {INT_MAX, true, 0};
|
std::tuple<int, bool, int> best_score{INT_MAX, true, 0};
|
||||||
int best_i = -1;
|
int best_i = -1;
|
||||||
for (int i = 0; i < (int)db->symbols.size(); ++i) {
|
for (int i = 0; i < (int)db->symbols.size(); ++i) {
|
||||||
if (db->symbols[i].kind == SymbolKind::Invalid)
|
if (db->symbols[i].kind == SymbolKind::Invalid)
|
||||||
@ -152,7 +152,7 @@ struct TextDocumentDefinitionHandler
|
|||||||
if (!use)
|
if (!use)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::tuple<int, bool, int> score = {
|
std::tuple<int, bool, int> score{
|
||||||
int(detailed_name.size() - query.size()), use->file != file_id,
|
int(detailed_name.size() - query.size()), use->file != file_id,
|
||||||
std::abs(use->range.start.line - position.line)};
|
std::abs(use->range.start.line - position.line)};
|
||||||
if (score < best_score) {
|
if (score < best_score) {
|
||||||
|
Loading…
Reference in New Issue
Block a user