[llvm-branch-commits] [clang-tools-extra] c03b58b - [clangd] Fix code action kind for readability-identifier-naming fixes (#162808)

Cullen Rhodes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 14 03:08:02 PDT 2025


Author: Ruoyu Zhong
Date: 2025-10-14T10:07:55Z
New Revision: c03b58bb091ed8f2c171c485b833f9ced6cba72e

URL: https://github.com/llvm/llvm-project/commit/c03b58bb091ed8f2c171c485b833f9ced6cba72e
DIFF: https://github.com/llvm/llvm-project/commit/c03b58bb091ed8f2c171c485b833f9ced6cba72e.diff

LOG: [clangd] Fix code action kind for readability-identifier-naming fixes (#162808)

https://github.com/llvm/llvm-project/pull/78454 converted
readability-identifier-naming fixes to use rename mechanism to rename
the symbol project-wide. However, it set the code action kind to
"refactor" instead of "quickfix", which caused the fixes to be filtered
out when editors (like VS Code) request quick fixes for diagnostics. On
VS Code, for example, users would see "No quick fixes available" despite
the diagnostic indicating "(fix available)".

Fix that by changing the code action kind back to "quickfix".

Signed-off-by: Ruoyu Zhong <zhongruoyu at outlook.com>

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdLSPServer.cpp
    clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index a703009e2b467..e83af299bbd18 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -81,7 +81,7 @@ CodeAction toCodeAction(const ClangdServer::CodeActionResult::Rename &R,
                         const URIForFile &File) {
   CodeAction CA;
   CA.title = R.FixMessage;
-  CA.kind = std::string(CodeAction::REFACTOR_KIND);
+  CA.kind = std::string(CodeAction::QUICKFIX_KIND);
   CA.command.emplace();
   CA.command->title = R.FixMessage;
   CA.command->command = std::string(ApplyRenameCommand);

diff  --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
index 2c7f50d8c9e4c..95bf5e54fc792 100644
--- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
@@ -235,7 +235,8 @@ TEST_F(LSPTest, ClangTidyRename) {
             .takeValue()
             .getAsArray())[0];
 
-  ASSERT_EQ((*RenameCommand.getAsObject())["title"], "change 'foo' to 'Foo'");
+  ASSERT_EQ((*RenameCommand.getAsObject())["title"],
+            "Apply fix: change 'foo' to 'Foo'");
 
   Client.expectServerCall("workspace/applyEdit");
   Client.call("workspace/executeCommand", RenameCommand);


        


More information about the llvm-branch-commits mailing list