Better goto-definition on constructors.

This commit is contained in:
Jacob Dufault 2017-04-20 17:27:21 -07:00
parent 2f691e5365
commit d1fe600fcf

View File

@ -704,6 +704,14 @@ std::vector<SymbolRef> FindSymbolsAtLocation(WorkingFile* working_file, QueryFil
symbols.push_back(ref);
}
// Order function symbols first. This makes goto definition work better when
// used on a constructor.
std::sort(symbols.begin(), symbols.end(), [](const SymbolRef& a, const SymbolRef& b) {
if (a.idx.kind != b.idx.kind && a.idx.kind == SymbolKind::Func)
return 1;
return 0;
});
return symbols;
}