aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorT1ckbase <146760065+T1ckbase@users.noreply.github.com>2026-02-24 18:52:59 +0800
committerGitHub <noreply@github.com>2026-02-24 05:52:59 -0500
commitfcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e (patch)
tree9fa72c2fc31f86a291e73eb00fa225e20068469c
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar.gz
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar.bz2
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar.lz
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar.xz
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.tar.zst
nvim-lspconfig-fcc66443c6f41ed80e2f99d0e2a4a49a92b93e5e.zip
feat(oxlint, oxfmt): try local binaries in node_modules #4324
-rw-r--r--lsp/oxfmt.lua9
-rw-r--r--lsp/oxlint.lua9
2 files changed, 16 insertions, 2 deletions
diff --git a/lsp/oxfmt.lua b/lsp/oxfmt.lua
index e0971a02..a269519e 100644
--- a/lsp/oxfmt.lua
+++ b/lsp/oxfmt.lua
@@ -15,7 +15,14 @@ local util = require 'lspconfig.util'
---@type vim.lsp.Config
return {
- cmd = { 'oxfmt', '--lsp' },
+ cmd = function(dispatchers, config)
+ local cmd = 'oxfmt'
+ local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/oxfmt'
+ if local_cmd and vim.fn.executable(local_cmd) == 1 then
+ cmd = local_cmd
+ end
+ return vim.lsp.rpc.start({ cmd, '--lsp' }, dispatchers)
+ end,
filetypes = {
'javascript',
'javascriptreact',
diff --git a/lsp/oxlint.lua b/lsp/oxlint.lua
index f55908b0..563e428f 100644
--- a/lsp/oxlint.lua
+++ b/lsp/oxlint.lua
@@ -30,7 +30,14 @@ end
---@type vim.lsp.Config
return {
- cmd = { 'oxlint', '--lsp' },
+ cmd = function(dispatchers, config)
+ local cmd = 'oxlint'
+ local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/oxlint'
+ if local_cmd and vim.fn.executable(local_cmd) == 1 then
+ cmd = local_cmd
+ end
+ return vim.lsp.rpc.start({ cmd, '--lsp' }, dispatchers)
+ end,
filetypes = {
'javascript',
'javascriptreact',