How to fix SublimePHPCompanion not working in Sublime Text 4
If you have recently updated to Sublime Text 4, and that you are using SublimePHPCompanion, you may have already noticed how many features such as
Expand Fully Qualified Class Name,
Import Namespace etc stopped working.
At first I thought maybe the package needed updating before it can support Sublime Text 4… Turns out that the fix is super simple!
So the reason SublimePHPCompanion stopped working is due to this new setting added in ST4
index_exclude_gitignore. By default it’s set to true, which means the editor would look into our
.gitignorefiles and decide whether to index them or not.
Most of us would keep our
vendor directory listed in
.gitignore as that is a default in most framework-based projects like Laravel or Symfony.
Without indexing the
vendor folder, SublimePHPCompanion can’t tell what are the PHP packages that we have installed, and so all its features do not work as expected anymore.
To fix that, simply open up the
Preferences > Settings page, and add this line:
Now, ST4 would ignore the paths listed in our
.gitignore files, and started indexing
vendor again. With that, SublimePHPCompanion would work again!