fix(typescript): implemented move to new file. Fixes #3534

This commit is contained in:
Folke Lemaitre
2024-06-08 07:30:49 +02:00
parent 1394070aab
commit d90930b13e
2 changed files with 55 additions and 3 deletions

View File

@ -22,12 +22,13 @@ function M.get_clients(opts)
end
---@param on_attach fun(client:vim.lsp.Client, buffer)
function M.on_attach(on_attach)
---@param name? string
function M.on_attach(on_attach, name)
return vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf ---@type number
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client then
if client and (not name or client.name == name) then
return on_attach(client, buffer)
end
end,
@ -340,6 +341,7 @@ M.action = setmetatable({}, {
---@class LspCommand: lsp.ExecuteCommandParams
---@field open? boolean
---@field handler? lsp.Handler
---@param opts LspCommand
function M.execute(opts)
@ -353,7 +355,7 @@ function M.execute(opts)
params = params,
})
else
return vim.lsp.buf_request(0, "workspace/executeCommand", params)
return vim.lsp.buf_request(0, "workspace/executeCommand", params, opts.handler)
end
end