Using devcontainer
Starting the code editor
With WP Setup you can easily develop inside the CLI containers. This will give you full access to container files and resources, improving your debugging capabilities and giving you direct access to container WP CLI, Composer and Node.js commands.
Current the devcontainer command only supports VSCode and you can easily start with the following command:
npx wp-setup code ./my-plugin
In this code above, the ./my-plugin
option referes to a volume configured in you wp-setup.json
file. So to access your root directory from container you need to run:
npx wp-setup code .
If the directory option is omitted, the VSCode will start at the WordPress root directory. Also you can pass a full directory name to your container.
Running from test container
Another welcome option available is to run the IDE from the test container, this will improve your TDD (Test Driven Development) capabilities allowing to easily run and debug code directly from the editor.
npx wp-setup code . --test
This way you can easily run your locally installed Pest from VSCode terminal:
./vendor/bin/pest