diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/rubocop.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lua/lspconfig/server_configurations/rubocop.lua b/lua/lspconfig/server_configurations/rubocop.lua index 62817b8f..0d494326 100644 --- a/lua/lspconfig/server_configurations/rubocop.lua +++ b/lua/lspconfig/server_configurations/rubocop.lua @@ -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 |
