Drupal LSP (Drupal Language Server) is a language server implementation compatible with Language Server Protocol.
- Service auto-completion
- Service diagnostics
- Service go-to definition
- Routes auto-completion
- Routes diagnostics
- Routes go-to definition
- Hooks
To build and install the standalone drupal-lsp run
go install github.com/nkoporec/drupal-lsp@latest
Configuration for neovim builtin LSP with nvim-lspconfig
init.vim
lua <<EOF
local lspconfig = require 'lspconfig'
local configs = require 'lspconfig.configs'
if not configs.drupal then
configs.drupal = {
default_config = {
cmd = {'drupal-lsp'},
filetypes = { 'php'},
root_dir = function(fname)
return lspconfig.util.root_pattern('composer.json', '.git')(fname)
end
};
}
end
lspconfig.drupal.setup{autostart = true }
EOF
MIT © nkoporec