diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-05-04 14:11:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-04 14:11:18 -0700 |
| commit | 2a6517453feb6f00e3d64bcb4fde61934897f4bd (patch) | |
| tree | dc681744b655f6eb40478ef6d7ae5495686f2b71 /lsp/phpactor.lua | |
| parent | feat: support :LspStart/LspRestart in Nvim 0.11.2+ #3734 (diff) | |
| download | nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.gz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.bz2 nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.lz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.xz nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.tar.zst nvim-lspconfig-2a6517453feb6f00e3d64bcb4fde61934897f4bd.zip | |
fix(configs): eliminate some usages of root_pattern #3820
Problem:
`root_pattern` is not necessary for non-glob patterns.
Solution:
Replace non-glob cases with `vim.fs.root()`..
Diffstat (limited to 'lsp/phpactor.lua')
| -rw-r--r-- | lsp/phpactor.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lsp/phpactor.lua b/lsp/phpactor.lua index 87e6c59d..9b7d3d82 100644 --- a/lsp/phpactor.lua +++ b/lsp/phpactor.lua @@ -4,17 +4,15 @@ --- --- Installation: https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation -local util = require 'lspconfig.util' - return { cmd = { 'phpactor', 'language-server' }, filetypes = { 'php' }, root_dir = function(bufnr, on_dir) local fname = vim.api.nvim_buf_get_name(bufnr) local cwd = assert(vim.uv.cwd()) - local root = util.root_pattern('composer.json', '.git', '.phpactor.json', '.phpactor.yml')(fname) + local root = vim.fs.root(fname, { 'composer.json', '.git', '.phpactor.json', '.phpactor.yml' }) -- prefer cwd if root is a descendant - on_dir(vim.fs.relpath(cwd, root) and cwd or root) + on_dir(root and vim.fs.relpath(cwd, root) and cwd) end, } |
