As far as I can tell, WordPress support is built into the PHP language server called Intelephense, but you've got to enable it.
Open Code's preferences and type "stubs" into the search bar. Under Intelephense: Stubs
, scroll all the way to the bottom of the list to hit the Add Item
button. Scroll some more to find wordpress
and add it. Easy!
ACF is not supported out of the box, however, so if that's a common plugin for your development purposes, you'll want to add its stubs to the system as well to prevent Intelephense from saying every usage of its methods and functions is an error. Luckily, there's a guy who has been generating stubs for ACF and a handful of other things.
Download the latest release and pull the main acf-pro-stubs.php
file out of it. Yes, it's about 615 KB currently. Now we've got to put it somewhere and point Intelephense at it.
In my case, for this PC I'm using right now, I had to install PHP to even have Intelephense run. I put PHP at C:\PHP841\
so it'd be easy to find, and therein I created a stubs
folder, and that's where this ACF stubs file, and any others I end up getting, will live.
Your setup will for sure be different, and you don't have to have the stubs placed next to your PHP executable anyhow. The point is to get the stubs installed somewhere so we can include them. Copy the path to the folder they end up living in now.
Back over in the Code settings, search for includepaths
and find the Intelephense one. (It was the only one for me, but this isn't my main development machine, so there could be more.) Click its Add Item
button and paste in the path to your stubs folder.

If everything's gone according to plan, Intelephense will more or less immediately stop complaining about ACF's get_field()
function and the like.