Skip to content

Commit 1723ea5

Browse files
committed
stineti
1 parent 19aa289 commit 1723ea5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lua/java-refactor/lsp-refactor-commands.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ local M = {
2020
local start_char = rename.offset - vim.fn.line2byte(line) + 1
2121
local end_char = start_char + rename.length
2222

23-
local name = ui.input({ prompt = 'name' })
23+
local name = ui.input('Variable Name')
2424

2525
if not name then
2626
return

lua/java-refactor/refactor-commands.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local class = require('java-core.utils.class')
22
local notify = require('java-core.utils.notify')
3+
local lsp_refactor_commands = require('java-refactor.lsp-refactor-commands')
34

45
local JdtlsClient = require('java-core.ls.clients.jdtls-client')
56

@@ -30,7 +31,6 @@ function RefactorCommands:extract_variable()
3031
buffer
3132
)
3233

33-
vim.print(vim.lsp.handlers)
3434
vim.lsp.util.apply_workspace_edit(edit.edit, 'utf-8')
3535

3636
RefactorCommands.run_lsp_client_command(
@@ -40,14 +40,20 @@ function RefactorCommands:extract_variable()
4040
end
4141

4242
function RefactorCommands.run_lsp_client_command(command_name, arguments)
43-
local command = vim.lsp.commands[command_name]
43+
local command
44+
45+
if lsp_refactor_commands[command_name] then
46+
command = lsp_refactor_commands[command_name]
47+
else
48+
command = vim.lsp.commands[command_name]
49+
end
4450

4551
if not command then
4652
notify.error('Command "' .. command_name .. '" is not supported')
4753
return
4854
end
4955

50-
vim.lsp.commands[command_name](arguments)
56+
command(arguments)
5157
end
5258

5359
return RefactorCommands

0 commit comments

Comments
 (0)