efm-langserver
efm-langserver copied to clipboard
PHP issue
trafficstars
When i try to format a PHP file, I always get this error:
[ERROR][2023-11-27 17:59:45] ...-format/init.lua:205 "efm: 0: format for LanguageID not supported: php"
My current config:
lsp_setup = {
on_attach = on_attach,
init_options = { documentFormatting = true, documentRangeFormatting = true },
filetypes = { "php" },
settings = {
rootMarkers = { ".git/" },
languages = {
php = {
formatCommand = "phpcbf",
formatStdin = true,
},
},
},
}
❯ whereis phpcbf
phpcbf: /usr/bin/phpcbf
NVIM v0.9.4
efm-langserver 0.0.49
phpcbf has the issue mentioned here:
https://github.com/mattn/efm-langserver/issues/183
There's an issue to revise the exit codes: https://github.com/squizlabs/PHP_CodeSniffer/issues/2898
That results in the formatting output being ignored.
I also believe there are some problems in your configuration, php should be a list:
-- …
php = {
{ formatCommand = "phpcbf", formatStdin = true },
},