From d1fe600fcff7c7b82224b2234dd65f7f2121dd9a Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Thu, 20 Apr 2017 17:27:21 -0700 Subject: [PATCH] Better goto-definition on constructors. --- src/command_line.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/command_line.cc b/src/command_line.cc index fcf3bea8..35feb59c 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -704,6 +704,14 @@ std::vector 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; }