diff options
Diffstat (limited to 'nvim/lua')
| -rw-r--r-- | nvim/lua/kkard2/lazy/lsp.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/nvim/lua/kkard2/lazy/lsp.lua b/nvim/lua/kkard2/lazy/lsp.lua index 08d22d1..a4d24ad 100644 --- a/nvim/lua/kkard2/lazy/lsp.lua +++ b/nvim/lua/kkard2/lazy/lsp.lua @@ -1,3 +1,43 @@ +-- WARNING: BAD CODE AHEAD +-- look at your own risk +local function rename_file() + local source_file, target_file + + vim.ui.input({ + prompt = "Source : ", + completion = "file", + default = vim.api.nvim_buf_get_name(0) + }, + function(input) + source_file = input + end + ) + vim.ui.input({ + prompt = "Target : ", + completion = "file", + default = source_file + }, + function(input) + target_file = input + end + ) + + local params = { + command = "_typescript.applyRenameFile", + arguments = { + { + sourceUri = source_file, + targetUri = target_file, + }, + }, + title = "" + } + + vim.lsp.util.rename(source_file, target_file) + vim.lsp.buf.execute_command(params) +end +-- END OF WARNING + return function() local lsp = require("lsp-zero").preset({}) @@ -16,4 +56,17 @@ return function() vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename) vim.keymap.set("n", "<leader><CR>", vim.lsp.buf.code_action) vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format) + + + + -- temp + require("lspconfig").tsserver.setup({ + commands = { + RenameFile = { + rename_file, + description = "Rename File" + }, + } + }) + -- end temp end |
