message: Optimize textDocument/definition for comments
diff: @@ -133,21 +133,26 @@ struct TextDocumentDefinitionHandler
  const std::string& buffer = working_file->buffer_content;
  std::string query = LexWordAroundPos(request->params.position, buffer);
  - int best_score = kMinScore;
  - int best_i = 0;
  - std::vector<int> score, dp;
  + int best_score = INT_MAX;
  + int best_i = -1;
  for (int i = 0; i < (int)db->symbols.size(); ++i) {
  + if (db->symbols[i].kind == SymbolKind::Invalid)
  + continue;
  std::string_view detailed_name = db->GetSymbolDetailedName(i);
  - if (detailed_name.size() > score.size()) {
  - score.resize(detailed_name.size());
  - dp.resize(detailed_name.size());
  - }
  - int t = FuzzyEvaluate(query, detailed_name, score, dp);
  - if (t > best_score) {
  - best_score = t;
  + size_t idx = detailed_name.find(query);
  + if (idx == std::string::npos)
  + continue;
  +
  + int score = detailed_name.size() - query.size();
  + assert(score >= 0);
  + if (score < best_score) {
  + best_score = score;
  best_i = i;
  }
  + if (score == 0)
  + break;
  }
  + if (best_i != -1) {
  Maybe<Use> use = GetDefinitionSpellingOfSymbol(db, db->symbols[best_i]);
  if (use) {
  optional<lsLocation> ls_loc = GetLsLocation(db, working_files, *use);
  @@ -156,6 +161,7 @@ struct TextDocumentDefinitionHandler
  }
  }
  }
  + }
  QueueManager::WriteStdout(IpcId::TextDocumentDefinition, out);
  }
  