@@ -26,6 +26,14 @@ local enabled = function(value)
2626 return value == nil or value == true
2727end
2828
29+ local get_cursor_position = function ()
30+ local rowcol = vim .api .nvim_win_get_cursor (0 )
31+ local row = rowcol [1 ] - 1
32+ local col = rowcol [2 ]
33+
34+ return row , col
35+ end
36+
2937local define_user_command = function ()
3038 vim .api .nvim_create_user_command (" Elixir" , function (opts )
3139 local args = vim .iter (opts .fargs )
@@ -37,6 +45,14 @@ local define_user_command = function()
3745 if " uninstall" == subcommand then
3846 vim .fn .delete (nextls .default_bin )
3947 vim .notify (string.format (" Uninstalled Next LS from %s" , nextls .default_bin ), vim .lsp .log_levels .INFO )
48+ elseif " to-pipe" == subcommand then
49+ local row , col = get_cursor_position ()
50+ local uri = vim .uri_from_bufnr (0 )
51+ vim .lsp .buf .execute_command { command = " to-pipe" , arguments = {{position = {line = row , character = col }, uri = uri }} }
52+ elseif " from-pipe" == subcommand then
53+ local row , col = get_cursor_position ()
54+ local uri = vim .uri_from_bufnr (0 )
55+ vim .lsp .buf .execute_command { command = " from-pipe" , arguments = {{position = {line = row , character = col }, uri = uri }} }
4056 else
4157 not_found = true
4258 end
@@ -52,7 +68,7 @@ local define_user_command = function()
5268 complete = function (_ , cmd_line )
5369 local cmd = vim .trim (cmd_line )
5470 if vim .startswith (cmd , " Elixir nextls" ) then
55- return { " uninstall" }
71+ return { " uninstall" , " to-pipe " , " from-pipe " }
5672 elseif vim .startswith (cmd , " Elixir" ) then
5773 return { " nextls" }
5874 end
0 commit comments