Skip to content

Commit

Permalink
fix(rubocop) support projects that do not use bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
gongfarmer committed Jul 7, 2023
1 parent 51739a8 commit ec025b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/lspconfig/server_configurations/rubocop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ local util = require 'lspconfig.util'

return {
default_config = {
cmd = { 'bundle', 'exec', 'rubocop', '--lsp' },
cmd = { 'rubocop', '--lsp' },
filetypes = { 'ruby' },
root_dir = util.root_pattern('Gemfile', '.git'),
},
on_new_config = function(config, root_dir)
-- prepend 'bundle exec' to cmd if bundler is being used
local gemfile_path = util.path.join(root_dir, 'Gemfile')
if util.path.exists(gemfile_path) then
config.cmd = { 'bundle', 'exec', unpack(config.cmd) }
end
end,
docs = {
description = [[
https://github.com/rubocop/rubocop
Expand Down

0 comments on commit ec025b8

Please sign in to comment.