Skip to content

Document code lens support #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,42 @@ If you want to pass configuration to lspconfig:
}
```

## Code Lens

This plugin provides code lens support for some Rails-specific features:

- `openFile` – Jump from a controller action to the corresponding view or route
definition.
- `runTest` – Run a test file or an individual test and display the output in a
split window.
- `runTask` – Run database migrations.

Code lens virtual text will be added where these features are available.

You can run available lens actions using `vim.lsp.codelens.run()`. Or, add a key
mapping:

```lua
{
'adam12/ruby-lsp.nvim',
ft = { 'ruby', 'eruby' },
...
keys = {
{
'<leader>cl',
function()
vim.lsp.codelens.run()
end,
desc = 'Run Code Lens',
},
},
}
```

Note: When you include a `keys` entry in your plugin spec, Lazy.nvim will treat the
plugin as lazy-loaded and only load it when one of those keys is pressed. To
ensure the plugin loads when editing Ruby files, use the `ft` (filetype) option.

## Disclaimer

This project is not officially connected to the Ruby LSP project, or officially
Expand Down
2 changes: 2 additions & 0 deletions doc/ruby-lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Features:

- Some conveniences around interacting with the Ruby LSP.

- Basic code lens support.

# Setup ~

This module needs a setup with `require('ruby-lsp').setup({})` (replace `{}`
Expand Down