Skip to content

[DOC]: Better way to get WordPress intellisense #2

Open
@swashata

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.

  1. First increase the default fileSize to 3MB or greater (VSCode > Preference > User Settings) "intelephense.file.maxSize": 3000000.
  2. Now if you are using composer then composer require --dev giacocorsiglia/wordpress-stubs.
  3. 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).
  4. Now from vscode command palette simply do a Intelephense: Clear Cache and Reload.
  5. Also disable any WordPress core snippets extension you might have.

And from then on, it just works. Here's a video.

WP Intelephense

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions