aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/phpactor.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lsp/phpactor.lua')
-rw-r--r--lsp/phpactor.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lsp/phpactor.lua b/lsp/phpactor.lua
new file mode 100644
index 00000000..99d0698f
--- /dev/null
+++ b/lsp/phpactor.lua
@@ -0,0 +1,19 @@
+local util = require 'lspconfig.util'
+
+---@brief
+---
+---https://github.com/phpactor/phpactor
+--
+-- Installation: https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation
+return {
+ cmd = { 'phpactor', 'language-server' },
+ filetypes = { 'php' },
+ root_dir = function(bufnr, on_dir)
+ local fname = vim.api.nvim_buf_get_name(bufnr)
+ local cwd = vim.uv.cwd()
+ local root = util.root_pattern('composer.json', '.git', '.phpactor.json', '.phpactor.yml')(fname)
+
+ -- prefer cwd if root is a descendant
+ on_dir(util.path.is_descendant(cwd, root) and cwd or root)
+ end,
+}