[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 2 00:02:08 PST 2025
================
@@ -761,7 +762,35 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
return false;
if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM))
return false;
- Edits.push_back(toTextEdit(FixIt, SM, *LangOpts));
+
+ auto R = tooling::Replacement(SM, FixIt.RemoveRange, FixIt.CodeToInsert,
----------------
kadircet wrote:
we deliberately do not apply formatting here due to latency concerns. there can be many fix-its available in a file and eagerly formatting all of them is likely to affect diagnostics latencies (as clangd potentially re-evaluates them at every keystroke).
can we rather perform this when the user asks for a code-action to be applied?
https://github.com/llvm/llvm-project/pull/118569
More information about the cfe-commits
mailing list