The missing language server for Drupal.
You can download the VSCode extension by searching for drupal-ls in VSCode or going to the marketplace.
Currently the extension is supported on the following platforms:
- MacOS (darwin-x64, darwin-arm64)
- Linux (linux-x64, linux-arm64)
- Download the binary for your system from the Releases page.
- Move it to a directory in your system
PATH(e.g.,/usr/local/bin) and ensure it is executable.
# Example: Move the downloaded binary to /usr/local/bin
mv ~/Downloads/drupal_ls /usr/local/bin/drupal_ls
chmod +x /usr/local/bin/drupal_ls- Update your
lazy.nvimconfiguration:
{
"jdrupal-dev/drupal_ls",
event = { "BufReadPre", "BufNewFile" },
config = function()
vim.lsp.config.drupal_ls = {
cmd = {
-- If the binary is in your PATH, you can just use the command name:
"drupal_ls",
-- Or specify the absolute path:
-- "/usr/local/bin/drupal_ls",
"--file",
"/tmp/drupal_ls-log.txt",
},
filetypes = { "php", "yaml" },
root_markers = {
'composer.json',
},
};
vim.lsp.enable("drupal_ls");
end,
}Prerequisites: You must have Rust and Cargo installed locally and globally accessible. Install Rust and Cargo
{
"jdrupal-dev/drupal_ls",
event = { "BufReadPre", "BufNewFile" },
-- Requires cargo to be installed locally.
build = "cargo build --release",
config = function()
vim.lsp.config.drupal_ls = {
cmd = {
-- The binary is built in the plugin directory
vim.fn.stdpath("data") .. "/lazy/drupal_ls/target/release/drupal_ls",
"--file",
"/tmp/drupal_ls-log.txt",
},
filetypes = { "php", "yaml" },
root_markers = {
'composer.json',
},
};
vim.lsp.enable("drupal_ls");
end,
}Hover
- Service references
- Service class
- Route references
- Route controller/form
- Hook references
- Permission references
- Plugin references
Go to definition
- Service references
- Service class
- Route references
- Route controller/form
- Hook references
- Permission references
- Plugin references
Completion
- Services
- Routes
- Snippets
- A few QoL improving snippets.
- Hooks
- form-[ELEMENT]
- render-[ELEMENT]
- Permissions
- Plugin IDs (limited to:)
- EntityType
- QueueWorker
- FieldType
- DataType
- FormElement
- RenderElement
Code actions
- Add translation placeholders to
t()functions.
- Build VSCode extension in CI.
- Autocomplete #theme functions in render arrays.
- Generate __construct doc block for classes.