Neovim plugin for WordPress and WooCommerce development.
- Configures tabs and indentation according to WordPress Coding Standards
- Configuration for Intelephense LSP server
- Configuration for
phpcs
andphpcbf
for none-ls
-
PHP_CodeSniffer with WordPress Coding Standards
NOTE: If you are using
Mason
, you need to disable it forphpcs
and installphpcs
globally with support for WordPress Coding Standards.require("mason-null-ls").setup { automatic_installation = { exclude = { "phpcs", "phpcbf" } } }
composer global require "wp-coding-standards/wpcs"
Install the plugin with your preferred package manager:
{
"bitpoke/wordpress.nvim",
}
use {
"bitpoke/wordpress.nvim",
}
Where you configure your LSP and none-ls servers, add the following lines
local wp = require('wordpress')
local lspconfig = require('lspconfig')
local null_ls = require('null-ls')
-- setup intelephense for PHP, WordPress and WooCommerce development
lspconfig.intelephense.setup(wp.intelephense)
null_ls.setup({
...,
sources = {
...,
null_ls.builtins.diagnostics.phpcs.with(wp.null_ls_phpcs),
null_ls.builtins.formatting.phpcbf.with(wp.null_ls_phpcs),
},
})
vim.lsp.buf.format()
uses all available formatters for the current file type. To avoid this, you can use the following command to format the current buffer:
vim.lsp.buf.format({ filter = require('wordpress').null_ls_formatter })