aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-04-21 18:45:38 +0200
committerJustin M. Keyes <justinkz@gmail.com>2025-04-21 18:47:01 +0200
commitd1796795ddcb75dcdf8fc172504ef72fb6e32cb9 (patch)
tree985db097ece9dc4ca2b4e0aa3c6cdfa511c855eb
parentci(lint): enforce "Lsp" command name prefix (diff)
downloadnvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar.gz
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar.bz2
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar.lz
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar.xz
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.tar.zst
nvim-lspconfig-d1796795ddcb75dcdf8fc172504ef72fb6e32cb9.zip
fix: use "Lsp" prefix for config-defined commands
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--lsp/basedpyright.lua4
-rw-r--r--lsp/clangd.lua4
-rw-r--r--lsp/denols.lua2
-rw-r--r--lsp/ds_pinyin_lsp.lua4
-rw-r--r--lsp/julials.lua2
-rw-r--r--lsp/markdown_oxide.lua6
-rw-r--r--lsp/pyright.lua4
-rw-r--r--lsp/rust_analyzer.lua2
-rw-r--r--lsp/svelte.lua27
-rw-r--r--lsp/svlangserver.lua4
-rw-r--r--lsp/texlab.lua16
-rw-r--r--lsp/zk.lua6
13 files changed, 38 insertions, 51 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 734b32eb..44c394f9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -49,9 +49,9 @@ end
---@brief
---
--- https://github.com/microsoft/pyright
---
--- `pyright`, a static type checker and language server for python
+--- https://github.com/microsoft/pyright
+---
+--- `pyright`, a static type checker and language server for python
return {
cmd = { 'pyright-langserver', '--stdio' },
filetypes = { 'python' },
@@ -73,7 +73,7 @@ return {
},
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'PyrightOrganizeImports', organize_imports, {})
+ vim.api.nvim_buf_create_user_command(0, 'LspPyrightOrganizeImports', organize_imports, {})
end,
}
```
diff --git a/lsp/basedpyright.lua b/lsp/basedpyright.lua
index bf31539d..f78bbd21 100644
--- a/lsp/basedpyright.lua
+++ b/lsp/basedpyright.lua
@@ -56,11 +56,11 @@ return {
},
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'PyrightOrganizeImports', organize_imports, {
+ vim.api.nvim_buf_create_user_command(0, 'LspPyrightOrganizeImports', organize_imports, {
desc = 'Organize Imports',
})
- vim.api.nvim_buf_create_user_command(0, 'PyrightSetPythonPath', set_python_path, {
+ vim.api.nvim_buf_create_user_command(0, 'LspPyrightSetPythonPath', set_python_path, {
desc = 'Reconfigure basedpyright with the provided python path',
nargs = 1,
complete = 'file',
diff --git a/lsp/clangd.lua b/lsp/clangd.lua
index 9f7c6ed6..c6037c26 100644
--- a/lsp/clangd.lua
+++ b/lsp/clangd.lua
@@ -81,11 +81,11 @@ return {
offsetEncoding = { 'utf-8', 'utf-16' },
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'ClangdSwitchSourceHeader', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspClangdSwitchSourceHeader', function()
switch_source_header(0)
end, { desc = 'Switch between source/header' })
- vim.api.nvim_buf_create_user_command(0, 'ClangdShowSymbolInfo', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspClangdShowSymbolInfo', function()
symbol_info()
end, { desc = 'Show symbol info' })
end,
diff --git a/lsp/denols.lua b/lsp/denols.lua
index 19d4fb57..80ff679e 100644
--- a/lsp/denols.lua
+++ b/lsp/denols.lua
@@ -106,7 +106,7 @@ return {
['textDocument/references'] = denols_handler,
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'DenolsCache', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspDenolsCache', function()
local clients = vim.lsp.get_clients { bufnr = 0, name = 'denols' }
if #clients > 0 then
buf_cache(0, clients[#clients])
diff --git a/lsp/ds_pinyin_lsp.lua b/lsp/ds_pinyin_lsp.lua
index 67407827..c1c8b022 100644
--- a/lsp/ds_pinyin_lsp.lua
+++ b/lsp/ds_pinyin_lsp.lua
@@ -60,10 +60,10 @@ return {
max_suggest = 15,
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'DsPinyinCompletionOff', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspDsPinyinCompletionOff', function()
ds_pinyin_lsp_off(0)
end, { desc = 'Turn off the ds-pinyin-lsp completion' })
- vim.api.nvim_buf_create_user_command(0, 'DsPinyinCompletionOn', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspDsPinyinCompletionOn', function()
ds_pinyin_lsp_on(0)
end, { desc = 'Turn on the ds-pinyin-lsp completion' })
end,
diff --git a/lsp/julials.lua b/lsp/julials.lua
index 17565a7c..ccea4d5a 100644
--- a/lsp/julials.lua
+++ b/lsp/julials.lua
@@ -121,7 +121,7 @@ return {
filetypes = { 'julia' },
root_markers = root_files,
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'JuliaActivateEnv', activate_env, {
+ vim.api.nvim_buf_create_user_command(0, 'LspJuliaActivateEnv', activate_env, {
desc = 'Activate a Julia environment',
nargs = '?',
complete = 'file',
diff --git a/lsp/markdown_oxide.lua b/lsp/markdown_oxide.lua
index 5059363b..79b11913 100644
--- a/lsp/markdown_oxide.lua
+++ b/lsp/markdown_oxide.lua
@@ -13,17 +13,17 @@ return {
filetypes = { 'markdown' },
cmd = { 'markdown-oxide' },
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'Today', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspToday', function()
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'today' } }
end, {
desc = "Open today's daily note",
})
- vim.api.nvim_buf_create_user_command(0, 'Tomorrow', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspTomorrow', function()
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'tomorrow' } }
end, {
desc = "Open tomorrow's daily note",
})
- vim.api.nvim_buf_create_user_command(0, 'Yesterday', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspYesterday', function()
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'yesterday' } }
end, {
desc = "Open yesterday's daily note",
diff --git a/lsp/pyright.lua b/lsp/pyright.lua
index ae46ccdf..161b8e0e 100644
--- a/lsp/pyright.lua
+++ b/lsp/pyright.lua
@@ -56,10 +56,10 @@ return {
},
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'PyrightOrganizeImports', organize_imports, {
+ vim.api.nvim_buf_create_user_command(0, 'LspPyrightOrganizeImports', organize_imports, {
desc = 'Organize Imports',
})
- vim.api.nvim_buf_create_user_command(0, 'PyrightSetPythonPath', set_python_path, {
+ vim.api.nvim_buf_create_user_command(0, 'LspPyrightSetPythonPath', set_python_path, {
desc = 'Reconfigure pyright with the provided python path',
nargs = 1,
complete = 'file',
diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua
index 754eed09..ada5243d 100644
--- a/lsp/rust_analyzer.lua
+++ b/lsp/rust_analyzer.lua
@@ -113,7 +113,7 @@ return {
end
end,
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'CargoReload', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspCargoReload', function()
reload_workspace(0)
end, { desc = 'Reload current cargo workspace' })
end,
diff --git a/lsp/svelte.lua b/lsp/svelte.lua
index ed2c19e1..98fde15f 100644
--- a/lsp/svelte.lua
+++ b/lsp/svelte.lua
@@ -9,29 +9,16 @@
--- npm install -g svelte-language-server
--- ```
-local function migrate_to_svelte_5()
- local clients = vim.lsp.get_clients({
- bufnr = 0,
- name = 'svelte',
- })
- for _, client in ipairs(clients) do
- client:exec_cmd({
- command = 'migrate_to_svelte_5',
- arguments = { vim.uri_from_bufnr(0) },
- })
- end
-end
-
return {
cmd = { 'svelteserver', '--stdio' },
filetypes = { 'svelte' },
root_markers = { 'package.json', '.git' },
- on_attach = function()
- vim.api.nvim_buf_create_user_command(
- 0,
- 'MigrateToSvelte5',
- migrate_to_svelte_5,
- { desc = 'Migrate Component to Svelte 5 Syntax' }
- )
+ on_attach = function(client, bufnr)
+ vim.api.nvim_buf_create_user_command(bufnr, 'LspMigrateToSvelte5', function()
+ client:exec_cmd({
+ command = 'migrate_to_svelte_5',
+ arguments = { vim.uri_from_bufnr(bufnr) },
+ })
+ end, { desc = 'Migrate Component to Svelte 5 Syntax' })
end,
}
diff --git a/lsp/svlangserver.lua b/lsp/svlangserver.lua
index 381e8f89..6121ea9b 100644
--- a/lsp/svlangserver.lua
+++ b/lsp/svlangserver.lua
@@ -35,10 +35,10 @@ return {
},
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'SvlangserverBuildIndex', build_index, {
+ vim.api.nvim_buf_create_user_command(0, 'LspSvlangserverBuildIndex', build_index, {
desc = 'Instructs language server to rerun indexing',
})
- vim.api.nvim_buf_create_user_command(0, 'SvlangserverReportHierarchy', report_hierarchy, {
+ vim.api.nvim_buf_create_user_command(0, 'LspSvlangserverReportHierarchy', report_hierarchy, {
desc = 'Generates hierarchy for the given module',
})
end,
diff --git a/lsp/texlab.lua b/lsp/texlab.lua
index f4be0f51..8123d5b7 100644
--- a/lsp/texlab.lua
+++ b/lsp/texlab.lua
@@ -193,28 +193,28 @@ return {
},
},
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'TexlabBuild', client_with_fn(buf_build), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabBuild', client_with_fn(buf_build), {
desc = 'Build the current buffer',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabForward', client_with_fn(buf_search), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabForward', client_with_fn(buf_search), {
desc = 'Forward search from current position',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabCancelBuild', client_with_fn(buf_cancel_build), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabCancelBuild', client_with_fn(buf_cancel_build), {
desc = 'Cancel the current build',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabDependencyGraph', client_with_fn(dependency_graph), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabDependencyGraph', client_with_fn(dependency_graph), {
desc = 'Show the dependency graph',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabCleanArtifacts', client_with_fn(command_factory('Artifacts')), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabCleanArtifacts', client_with_fn(command_factory('Artifacts')), {
desc = 'Clean the artifacts',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabCleanAuxiliary', client_with_fn(command_factory('Auxiliary')), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabCleanAuxiliary', client_with_fn(command_factory('Auxiliary')), {
desc = 'Clean the auxiliary files',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabFindEnvironments', client_with_fn(buf_find_envs), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabFindEnvironments', client_with_fn(buf_find_envs), {
desc = 'Find the environments at current position',
})
- vim.api.nvim_buf_create_user_command(0, 'TexlabChangeEnvironment', client_with_fn(buf_change_env), {
+ vim.api.nvim_buf_create_user_command(0, 'LspTexlabChangeEnvironment', client_with_fn(buf_change_env), {
desc = 'Change the environment at current position',
})
end,
diff --git a/lsp/zk.lua b/lsp/zk.lua
index 6a336b7b..f659cb25 100644
--- a/lsp/zk.lua
+++ b/lsp/zk.lua
@@ -17,7 +17,7 @@ return {
filetypes = { 'markdown' },
root_markers = { '.zk' },
on_attach = function()
- vim.api.nvim_buf_create_user_command(0, 'ZkIndex', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspZkIndex', function()
vim.lsp.buf.execute_command {
command = 'zk.index',
arguments = { vim.api.nvim_buf_get_name(0) },
@@ -26,7 +26,7 @@ return {
desc = 'ZkIndex',
})
- vim.api.nvim_buf_create_user_command(0, 'ZkList', function()
+ vim.api.nvim_buf_create_user_command(0, 'LspZkList', function()
local bufpath = vim.api.nvim_buf_get_name(0)
local root = find_zk_root(bufpath)
@@ -48,7 +48,7 @@ return {
desc = 'ZkList',
})
- vim.api.nvim_buf_create_user_command(0, 'ZkNew', function(...)
+ vim.api.nvim_buf_create_user_command(0, 'LspZkNew', function(...)
vim.lsp.buf_request(0, 'workspace/executeCommand', {
command = 'zk.new',
arguments = {