An implementation of the language server protocol (LSP) for EBNF grammars.
- Semantic tokens (Root rule)
- Diagnostics
- Hover
- References
- Completion
- Document formatting
- Rename
- Go to definition
- Document symbols
- Code actions (supress unused warning)
- Formatting
ebnfer.mp4
Build from source or install via cargo:
cargo install ebnfer
Add ebnf as file type by adding the following to config: (init.lua
fx.)
vim.filetype.add {
extension = {
ebnf = "ebnf",
},
}
Add lsp attach with the following lua (N.B: cmd should have .exe
suffix on windows):
vim.api.nvim_create_autocmd("FileType", {
pattern = "ebnf",
callback = function()
vim.lsp.buf_attach_client(
0,
vim.lsp.start_client {
name = "ebnfer",
cmd = { "ebnfer" },
on_attach = on_attach,
capabilities = capabilities,
}
)
end,
})
- Vs Code extension - w. general document highlighting
- Workspace support - multiple files
This project is inspired by the ebnf analysis crate on crates.io - ebnf. Also inspired by the following youtube video: Learn By Building: Language Server Protocol - TJ Devries.