================ @@ -648,6 +649,27 @@ tweakSelection(const Range &Sel, const InputsAndAST &AST, return std::move(Result); } +// Some fixes may perform local renaming, we want to convert those to clangd +// rename commands, such that we can leverage the index for more accurate +// results. +std::optional<ClangdServer::CodeActionResult::Rename> +TryConvertToRename(const Diag *Diag, const ClangdServer::DiagRef &DR, + const Fix &Fix) { + bool IsClangTidyRename = Diag->Source == Diag::ClangTidy && + Diag->Name == "readability-identifier-naming" && + !Fix.Edits.empty(); + if (IsClangTidyRename) { + ClangdServer::CodeActionResult::Rename R; + R.NewName = Fix.Edits.front().newText; + R.Diag = DR; ---------------- HighCommander4 wrote:
(for simplicity, consider omitting the `DR` parameter, and just construct a `DiagRef` here as `{Diag->Range, Diag->Message}`, which is how a `DiagRef` is constructed [elsewhere](https://searchfox.org/llvm/rev/33c6b77d2a18862fb5b16160ef9d600382e93f19/clang-tools-extra/clangd/ClangdLSPServer.cpp#1763)) https://github.com/llvm/llvm-project/pull/78454 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits