-
Notifications
You must be signed in to change notification settings - Fork 214
IDE: neovim
Justin Searls edited this page Nov 14, 2024
·
2 revisions
In addition to standard vim support, Neovim's built-in support of language server protocol enables native use of Standard's --lsp
server mode.
A configuration like the following could be used to set it up (borrows from @will's comment here):
vim.opt.signcolumn = "yes" -- otherwise it bounces in and out, not strictly needed though
vim.api.nvim_create_autocmd("FileType", {
pattern = "ruby",
group = vim.api.nvim_create_augroup("RubyLSP", { clear = true }), -- also this is not /needed/ but it's good practice
callback = function()
vim.lsp.start {
name = "standard",
cmd = { "~/.rbenv/shims/standardrb", "--lsp" },
}
end,
})
This will provide inline feedback like the following:
To set standard as the linter and formatter for Ruby files, you can use the init_options key when setting up Ruby LSP:
local lspconfig = require('lspconfig')
lspconfig.ruby_lsp.setup({
init_options = {
formatter = 'standard',
linters = { 'standard' },
},
})