@@ -39,6 +39,11 @@ local define_user_command = function()
39
39
local args = vim .iter (opts .fargs )
40
40
local command = args :next ()
41
41
local not_found = false
42
+ local workspace_commands = {
43
+ [" to-pipe" ] = true ,
44
+ [" from-pipe" ] = true ,
45
+ [" alias-refactor" ] = true ,
46
+ }
42
47
43
48
if " nextls" == command then
44
49
local subcommand = args :next ()
@@ -48,18 +53,11 @@ local define_user_command = function()
48
53
string.format (" [elixir-tools] Uninstalled Next LS from %s" , nextls .default_bin ),
49
54
vim .lsp .log_levels .INFO
50
55
)
51
- elseif " to-pipe " == subcommand then
56
+ elseif workspace_commands [ subcommand ] then
52
57
local row , col = get_cursor_position ()
53
58
local uri = vim .uri_from_bufnr (0 )
54
59
vim .lsp .buf .execute_command {
55
- command = " to-pipe" ,
56
- arguments = { { position = { line = row , character = col }, uri = uri } },
57
- }
58
- elseif " from-pipe" == subcommand then
59
- local row , col = get_cursor_position ()
60
- local uri = vim .uri_from_bufnr (0 )
61
- vim .lsp .buf .execute_command {
62
- command = " from-pipe" ,
60
+ command = subcommand ,
63
61
arguments = { { position = { line = row , character = col }, uri = uri } },
64
62
}
65
63
else
@@ -77,7 +75,7 @@ local define_user_command = function()
77
75
complete = function (_ , cmd_line )
78
76
local cmd = vim .trim (cmd_line )
79
77
if vim .startswith (cmd , " Elixir nextls" ) then
80
- return { " uninstall " , " to-pipe" , " from-pipe" }
78
+ return { " alias-refactor " , " to-pipe" , " from-pipe" , " uninstall " }
81
79
elseif vim .startswith (cmd , " Elixir" ) then
82
80
return { " nextls" }
83
81
end
0 commit comments