2

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,
      }

1 Answer 1

1

I'd still like to know how to debug this stuff better, but my problem was solved by clearing my ~/.cache/phpactor/.

1
  • 1
    I'm not familiar with phpactor at all, but it looks like this is probably a problem in phpactor rather than neovim or the LSP integration you're using. If you can reproduce it again, it may be worth keeping a backup of that cache directory and reporting a bug at phpactor. Commented Sep 20, 2022 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.