Skip to content

devdammit/easyp.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easyp.nvim

LSP-powered diagnostics for .proto files using the easyp linter.

Two parts in one repo:

  • easyp-lsp — a standalone LSP server written in Go (stdio). On didOpen/didSave it runs easyp lint from the project root and publishes diagnostics for every file in the project. Reusable from any LSP-capable editor.
  • Neovim plugin — registers the server for filetype=proto and activates it only when easyp.yaml is found upward from the file.

Requirements

  • Neovim >= 0.11

  • Go (one-time build of the server binary)

  • easyp in $PATH:

    go install github.com/easyp-tech/easyp/cmd/easyp@latest

Installation

With lazy.nvim:

{
  "devdammit/easyp.nvim",
  ft = "proto",
  build = "go build -o bin/easyp-lsp ./cmd/easyp-lsp",
}

The plugin sets itself up with defaults. To customize:

require("easyp").setup({
  cmd = { "/path/to/easyp-lsp" },        -- default: <plugin>/bin/easyp-lsp
  easyp_bin = "easyp",                   -- or { "go", "tool", "easyp" } for a version pinned in go.mod
  lint_root = nil,                       -- proto import root relative to the project root, passed as `easyp lint -r`;
                                         -- nil = auto-detect from generate.inputs[].directory.root in easyp.yaml
  severity = "warning",                  -- error | warning | info | hint
})

The server can also be installed standalone (for use outside Neovim):

go install github.com/devdammit/easyp.nvim/cmd/easyp-lsp@latest

How it works

  1. When a .proto buffer opens, the plugin looks for easyp.yaml upward from the file (vim.fs.root). No config file — the server never starts.
  2. On every open/save the server runs easyp lint in the project root (JSON output via EASYP_FORMAT=json, with a fallback parser for the text format). If the project keeps protos under a separate import root (e.g. proto/ with import "common/model.proto"), the server picks it up from generate.inputs[].directory.root in easyp.yaml and passes it as easyp lint -r — set lint_root explicitly if your config declares no generate inputs.
  3. Diagnostics are published for all files in the project: the rule name (FIELD_LOWER_SNAKE_CASE, …) goes into code, the source is easyp. Issues that disappear after a fix are cleared.

easyp exit codes: 0 — clean, 1 — lint issues found (normal), 2 — import error (surfaced via window/showMessage).

Development

make build   # bin/easyp-lsp
make test    # parser unit tests

Sample project for manual testing: testdata/sample (deliberately invalid api/bad.proto).

End-to-end check:

EASYP_E2E=1 nvim --headless --clean -u testdata/minimal_init.lua testdata/sample/api/bad.proto

License

MIT

About

LSP-powered diagnostics for `.proto` files using the easyp linter.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages