I have a project like this:
- fruity/
- composer.json
- vendor/
- appley/
- various.php
- orangy/
- composer.json
- vendor/
- src/
It's basically two projects in one tree.
I'm using astronvim with nvim-lspconfig and phpactor as the LSP. PhpActor is working ok normally, but in this project it refuses to parse the orangy/ sources; it won't find classes defined in there.
I've set the root_dir
correctly; viewing :LspInfo
shows it correctly set to /path/to/fruity/
I've set the command to include -vvv
but can't see anything useful in the logs; I'm not sure the vvv worked.
Here's the config snippet I'm using in lsp.server-settings:
phpactor = {
cmd = { 'phpactor', 'language-server', '-vvv' },
root_dir = function(startPath)
print("root_dir running"); -- just to confirm this works; it does.
local rp = (require 'lspconfig.util').root_pattern
for _, pattern in pairs({".thisIsDocRoot", "index.php", ".git", "node_modules", "index.php", "composer.json"})
do
local found = rp({pattern})(startPath)
print(pattern, found) -- this works
if (found and found ~= '') then return found end
end
return nil
end,
}