fix(refactor): use method-call syntax for Action:rename#493
Merged
Conversation
client-command-handlers.lua:21 used action.rename(params) (dot) instead of action:rename(params) (colon). Since Action:rename is defined with self, the dot-call passed params as self and left the actual params argument as nil, causing action.lua:28 to error with "bad argument nvim-java#1 to 'ipairs' (table expected, got nil)". All other handlers in this file already use : when calling into Action:* methods. This brings RENAME_COMMAND in line with them. Reproduction: in any Java file with jdtls attached, trigger a refactoring that produces a follow-up rename (e.g. "Extract to constant" on a string literal). jdtls fires RENAME_COMMAND with the new symbol's location, and the handler errors before the rename UI opens. After this fix, the rename UI opens as expected. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
s1n7ax
approved these changes
Jun 6, 2026
Member
|
Thanks for the contribution <3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lua/java-refactor/client-command-handlers.lua:21callsaction.rename(params)with a dot. SinceAction:renameis definedwith
self, the dot-call passesparamsasselfand leaves theactual
paramsargument asnil, which makesaction.lua:28errorwith:
Every other handler in this file already uses
:when calling intoAction:*methods (generate_constructor,generate_to_string,apply_refactoring_command, etc.). This bringsRENAME_COMMANDinline with them.
The patch is a one-character change:
.→:.Reproduction
that produces a follow-up rename — e.g. "Extract to constant"
(
textDocument/codeAction→refactor.extract.constant).RENAME_COMMANDback so the newsymbol can be renamed inline.
After this fix, the rename UI opens on the newly extracted constant as
expected.
Test plan
(
~/.local/share/nvim/lazy/nvim-java/lua/java-refactor/client-command-handlers.lua:21),restarted nvim, and confirmed "Extract to constant" → inline rename
works end-to-end.
🤖 Generated with Claude Code