An in-process Neovim LSP server for Rails test fixture completion, hover, and go-to-definition. Runs entirely as Lua inside your Neovim session with no external process.
- Neovim 0.11+
- Fixture files in
test/fixtures/orspec/fixtures/
Install via your preferred plugin manager. The following example uses lazy.nvim.
{
'wassimk/rails-fixture-ls.nvim',
version = '*',
ft = 'ruby',
config = function()
vim.lsp.enable('rails_fixture_ls')
end,
}All features are scoped to test files (paths containing /test/ or /spec/).
| Feature | On fixture name (:bob) |
On fixture type (users) |
|---|---|---|
| Completion | Names with YAML attribute preview | Type names, inserts users( |
| Hover | Fixture's YAML attributes | Available fixture names and file path |
| Go-to-definition | Jumps to entry in YAML file | Jumps to YAML file |
The server uses Neovim's in-process LSP support, passing a Lua function as the
cmd parameter instead of spawning an external process. It only activates in
projects that have a test/fixtures/ or spec/fixtures/ directory under the
project root (Gemfile, Rakefile, or .git). If no fixture directory exists,
the server does not start.
Fixture YAML files are parsed in a single pass with simple pattern matching.
Data is cached per project root, so multi-project workspaces are fully
supported. Files using ERB (<%= %> tags) work correctly since ERB only appears
in attribute values, not fixture names.
Run tests and lint:
make test
make lintGenerate vimdoc from README:
make docsEnable the local git hooks (one-time setup):
git config core.hooksPath .githooksThis activates a pre-commit hook that checks stylua formatting and
auto-generates doc/rails-fixture-ls.nvim.txt from README.md whenever the
README is staged. Requires pandoc.
