aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/basedpyright.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-04-21 13:43:00 -0700
committerGitHub <noreply@github.com>2025-04-21 13:43:00 -0700
commit44ba712bc3015cce9b599d18f947d85a630e512b (patch)
treeae71e900e2c0c8f34bca009c4ec1f3e0d3d21051 /lsp/basedpyright.lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.gz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.bz2
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.lz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.xz
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.tar.zst
nvim-lspconfig-44ba712bc3015cce9b599d18f947d85a630e512b.zip
ci(lint): use client:exec_cmd() #3755
Use `client:exec_cmd()` instead of calling `request("workspace/executeCommand")` directly.
Diffstat (limited to 'lsp/basedpyright.lua')
-rw-r--r--lsp/basedpyright.lua24
1 files changed, 7 insertions, 17 deletions
diff --git a/lsp/basedpyright.lua b/lsp/basedpyright.lua
index f78bbd21..8872ea14 100644
--- a/lsp/basedpyright.lua
+++ b/lsp/basedpyright.lua
@@ -4,21 +4,6 @@
---
--- `basedpyright`, a static type checker and language server for python
-local function organize_imports()
- local params = {
- command = 'basedpyright.organizeimports',
- arguments = { vim.uri_from_bufnr(0) },
- }
-
- local clients = vim.lsp.get_clients {
- bufnr = vim.api.nvim_get_current_buf(),
- name = 'basedpyright',
- }
- for _, client in ipairs(clients) do
- client.request('workspace/executeCommand', params, nil, 0)
- end
-end
-
local function set_python_path(path)
local clients = vim.lsp.get_clients {
bufnr = vim.api.nvim_get_current_buf(),
@@ -55,8 +40,13 @@ return {
},
},
},
- on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'LspPyrightOrganizeImports', organize_imports, {
+ on_attach = function(client, bufnr)
+ vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
+ client:exec_cmd({
+ command = 'basedpyright.organizeimports',
+ arguments = { vim.uri_from_bufnr(bufnr) },
+ })
+ end, {
desc = 'Organize Imports',
})