Description
Hi,
First of all thank you very much for this awesome package. Your package is one of many reasons why I moved from Sublimetext to VSCode (don't mean to start a war here though).
I have been fiddling around a bit, and have been trying various methods to add WordPress intellisense. My preference has always been to just add the plugin/theme directory to vscode workspace. But in order to get intellisense of WordPress core functions, I had to add WordPress source in the workspace too. Not a great fan of this.
Then I came across this and since I use composer anyway, getting intellisense was a breeze.
I would've wanted to contribute to some doc, but since I didn't find any, I am opening an issue explaining the method and I leave it upto you to do what-so-ever you wish.
These are just the steps one need to follow to get WP intellisense.
- First increase the default fileSize to 3MB or greater (VSCode > Preference > User Settings)
"intelephense.file.maxSize": 3000000
. - Now if you are using composer then
composer require --dev giacocorsiglia/wordpress-stubs
. - If you are not using composer then simply download wordpress-stubs.php and put it in your project directory (you probably don't want to track it with git).
- Now from vscode command palette simply do a
Intelephense: Clear Cache and Reload
. - Also disable any WordPress core snippets extension you might have.
And from then on, it just works. Here's a video.