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 Find User, 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:

"index_exclude_gitignore": false,

Now, ST4 would ignore the paths listed in our .gitignore files, and started indexing vendor again. With that, SublimePHPCompanion would work again!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store