ruby-code-actions.nvim
Ruby code actions for null-ls in neovim.
Usage
Require in your favorite package manager and then specify as a source. e.g. in packer
use {
'jose-elias-alvarez/null-ls.nvim',
requires = {
{'nvim-lua/plenary.nvim'},
{"semanticart/ruby-code-actions.nvim"}
},
config = function()
local null_ls = require("null-ls")
local ruby_code_actions = require("ruby-code-actions")
local sources = {
-- require any built-ins you want
null_ls.builtins.formatting.rubocop,
null_ls.builtins.diagnostics.rubocop,
-- ...
-- now require any ruby-code-actions you want
ruby_code_actions.insert_frozen_string_literal,
ruby_code_actions.autocorrect_with_rubocop
}
null_ls.setup({sources = sources})
end
}You can invoke these code actions the same way you'd invoke any other code action in your setup. e.g. with telescope you can do :Telescope lsp_code_actions
Currently implemented
insert_frozen_string_literalfor insertion of the frozen string literal directiveautocorrect_with_rubocopfor correcting the current line, selected lines, or the entire file with RuboCop
Overriding action titles
You can override action titles by providing your own strings. See the spec works if the action title is overridden for an example.
Contributing
This is mostly an experiment on my part but I'll consider contributions. If you want to do some development, be aware that you can run existing plenary specs with make.
Further reading
On this page
Languages
Lua98.5%Makefile1.2%Vim Script0.3%
Contributors
MIT License
Created January 20, 2022
Updated June 12, 2024