aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorFraser Hanson <fraser.hanson@gmail.com>2023-07-07 18:19:57 -0700
committerGitHub <noreply@github.com>2023-07-08 09:19:57 +0800
commit3c0915f57f443aa656d682db3df9d8f867c627ad (patch)
treef7aafe389c5b3cc7bbd9831851ea40e953e806f1 /lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar.gz
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar.bz2
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar.lz
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar.xz
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.tar.zst
nvim-lspconfig-3c0915f57f443aa656d682db3df9d8f867c627ad.zip
fix(rubocop): support projects that do not use bundler (#2706)
Co-authored-by: Fraser Hanson <fraser.hanson@netapp.com>
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/rubocop.lua9
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