php-language-server: Intellisense slow on 5k files

I like the new auto completion tool and, I have a Laravel project that parses the files like so:

All 5568 PHP files parsed in 253 seconds. 178 MiB allocated.

When I type $someVar-> it takes about 2 seconds until the suggestions show up.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 22
  • Comments: 37 (19 by maintainers)

Commits related to this issue

Most upvoted comments

I had to switch to PHP Intelephense.

A little discouraging that a few attempts have been made by community to fix this but not enough attention has been given to review it. The main purpose of this project is to assist developers in writing code faster. Unfortunately it fails at it right now due to these long standing performance problems. @felixfbecker, thank you for all your efforts! It’s greatly appreciated, and I’m sorry to complain, but I felt like it’s important to say this.

🎉 This issue has been resolved in version 5.4.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

I had to switch to PHP Intelephense.

Same, the issue is still happening, had to switch, now it’s instant…

Hi! @felixfbecker willing to work on this – Do you have any suggestions on the best place to start? Profiling it with XDebug?

Same trouble, about 15 seconds, Yii2 basic project. And i switch to PHP Intelephense.

I have a similar issue on a Code igniter project. The autocompletion for class methods doesnt even pop up until I hit ctrl + space, then takes a few seconds. If i delete the -> and do it again, same thing. it doesnt cache the results either. but that is probably a different issue?

@MichaelBelgium if you can’t wait, help out 😃

Is the slowness coming from this:

CompletionProvider.php Lines 246-251

            foreach ($this->index->getDefinitions() as $fqn => $def) {
                foreach ($prefixes as $prefix) {
                    if (substr($fqn, 0, strlen($prefix)) === $prefix && $def->isMember) {
                        $list->items[] = CompletionItem::fromDefinition($def);
                    }
                }
            }

There is no trie index or anything like that, but everything is always looped through and it filters the matching ones in the loop?

Yes, all you need to do is symlink your local language server repo clone into ~/.vscode/extensions/felixfbecker.php-intellisense-x.x.x/vendor/felixfbecker/language-server

Another member of the emacs-php community - just wanted to echo what @cmatzenbach said above! Thank you so much for all of your work! This is gonna make programming in PHP a much better experience in emacs.

We of the emacs-php community are eagerly awaiting this merge 😃 Thanks to everyone who put time into this PR! It’s going to be big for the community

@felixfbecker Is it really neccessary to check each definition whether it starts with the prefix? Visual Studio Code is able to filter out, too?

@Vercoutere I ended up not putting any time into working on this because there happened to be a couple of other PR’s started. I’m not sure why they haven’t been merged. I have heard good things about Intelephense though.

@TheColorRed Have you disabled VSCode built-in suggestions? Try to set “php.suggest.basic” to false in settings.