bmewburn / intelephense-docs

Documentation for the Intelephense PHP language server

Home Page:https://intelephense.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implementation feature only works after file has been opened

vittorio-c opened this issue · comments

Hello,

I can't get the "Find all implementations" feature work properly.

The server finds implementations of an interface only if I've already opened the corresponding file before.

Let's say I have :

  • one interface : interface IAccount in lib/public
  • one implementation : class Account implements IAccount in lib/private

From IAccount, Account is not found if I don't open it first. If I open Account and come back to IAccount, then the feature works properly.

I am using Neovim with 0.4.3 + LanguageClient-neovim 0.1.157.

I am using intelephense 1.3.11 paid version (licence key activated).

Here go the config files.

init.vim :

let g:LanguageClient_serverCommands = {
            \ 'php': ['intelephense', '--stdio'],
            \ }
let g:LanguageClient_settingsPath = "/some/path/intelephense.json"

intelephense.json (I could have named it settings.json ) :

{
    "initializationOptions": {
        "storagePath": "/tmp/intelephense",
        "licenceKey": "myKey",
        "clearcache": true
    },
    "intelephense.completion.insertUseDeclaration": true, 
    "intelephense.completion.maxItems": 100,
    "intelephense.files.associations": ["*.php", "*.phtml"]
}

Any idea what I could do ? Could it come from vim's buffers ?

Also, is the syntax in my intelephense.json correct ? (I have found several different syntax, and I don't know which one I should be using).

Thanks

EDIT: i just tried with vim-lsp plugin, and it does exactly the same thing. So problem is not likely to come from the lsp client.

Okay, I've found what is going on. This happens only when I re-open a project with vim, after having closed it, and not having deleted the /tmp/intelephense directory.

Apparently, intelephense is not able to handle properly that situation, where you re-open a project that has already an existing cache folder.

I tried to set "clearcache": true but it does not work. I don't event know it it supposed to delete /tmp/intelephense or any other folder I am not aware of.

For the moment, I'll stick with the "remember to manually delete your folder" when you quit vim. Or turn on and off your computer.

Thank you