File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -701,14 +701,21 @@ void ClangdServer::codeAction(const CodeActionInputs &Params,
701701 return nullptr ;
702702 };
703703 for (const auto &DiagRef : Params.Diagnostics ) {
704- if (const auto *Diag = FindMatchedDiag (DiagRef))
705- for (const auto &Fix : Diag->Fixes ) {
706- if (auto Rename = tryConvertToRename (Diag, Fix)) {
704+ if (const auto *Diag = FindMatchedDiag (DiagRef)) {
705+ auto It = Diag->Fixes .begin ();
706+ if (It != Diag->Fixes .end ()) {
707+ if (auto Rename = tryConvertToRename (Diag, *It)) {
708+ // Only try to convert the first Fix to rename as subsequent Fixes
709+ // might be "ignore [readability-identifier-naming] for this
710+ // line".
707711 Result.Renames .emplace_back (std::move (*Rename));
708- } else {
709- Result.QuickFixes .push_back ({DiagRef, Fix});
712+ It++;
710713 }
711714 }
715+ for (; It != Diag->Fixes .end (); It++) {
716+ Result.QuickFixes .push_back ({DiagRef, *It});
717+ }
718+ }
712719 }
713720 }
714721
You can’t perform that action at this time.
0 commit comments