nkoporec / drupal-lsp

1 stars 0 forks source link

drupal-lsp

Drupal LSP (Drupal Language Server) is a language server implementation compatible with Language Server Protocol.

ezgif-5-924ec3e574

Features

Installation

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

License

MIT © nkoporec