Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 1.67 KB

README.md

File metadata and controls

71 lines (54 loc) · 1.67 KB

Test crates.io

EBNFER

An implementation of the language server protocol (LSP) for EBNF grammars.

Features

  • Semantic tokens (Root rule)
  • Diagnostics
  • Hover
  • References
  • Completion
  • Document formatting
  • Rename
  • Go to definition
  • Document symbols
  • Code actions (supress unused warning)
  • Formatting
ebnfer.mp4

Installation

Build from source or install via cargo:

cargo install ebnfer

Use w. Neovim (0.10.0)

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,
})

Further development

  • Vs Code extension - w. general document highlighting
  • Workspace support - multiple files

Inspired

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.