Add RuboCop lsp mode.

This commit is contained in:
mikoto2000
2023-08-18 20:48:57 +09:00
committed by mattn
parent 13fc03c695
commit 976d858968
5 changed files with 65 additions and 0 deletions

View File

@@ -155,6 +155,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| Ruby | solargraph | Yes | Yes |
| Ruby | steep | Yes | Yes |
| Ruby | typeprof | Yes | Yes |
| Ruby | rubocop (lsp mode) | Yes | No |
| Rust | rls | Yes | No |
| Rust | rust-analyzer | Yes | Yes |
| Sphinx | esbonio | Yes | Yes |
@@ -299,6 +300,10 @@ To use older version `golangci-lint`, please run `:LspSettingsGlobalEdit` and pu
}
```
### [rubocop lsp mode (Ruby)](https://docs.rubocop.org/rubocop/usage/lsp.html)
To use rubocop-lsp-mode, you need to install rubocop in your Ruby project using bundler.
## Extra Configurations
Most of the configurations are not required.

View File

@@ -0,0 +1,18 @@
@echo off
echo @echo off ^
setlocal ^
set TARGET_DIR=%%1 ^
shift ^
cd %%TARGET_DIR%% ^
bundle exec rubocop %%* ^
> rubocop-lsp-mode.cmd
echo Install Done.
echo **You need add rubocop dependencies in Gemfile.**

View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
cat <<EOF >rubocop-lsp-mode
#!/bin/sh
TARGET_DIR=\$1
shift
cd \${TARGET_DIR}
bundle exec rubocop \$*
EOF
chmod +x rubocop-lsp-mode
echo 'Install Done.'
echo '**You need add rubocop dependencies in Gemfile.**'

View File

@@ -1335,6 +1335,17 @@
"requires": [
"gem"
]
},
{
"command": "rubocop-lsp-mode",
"url": "https://github.com/rubocop/rubocop",
"description": "A Ruby static code analyzer and formatter, based on the community Ruby style guide.",
"requires": [
"bundle"
],
"root_uri_patterns": [
"Gemfile"
]
}
],
"rust": [

View File

@@ -0,0 +1,14 @@
augroup vim_lsp_settings_rubocop_vim_ls
au!
LspRegisterServer {
\ 'name': 'rubocop-lsp-mode',
\ 'cmd': {server_info->lsp_settings#get('rubocop-lsp-mode', 'cmd', [lsp_settings#exec_path('rubocop-lsp-mode'), lsp#utils#uri_to_path(lsp_settings#root_uri('rubocop-lsp-mode')), '--lsp'])+lsp_settings#get('rubocop-lsp-mode', 'args', [])},
\ 'root_uri':{server_info->lsp_settings#get('rubocop-lsp-mode', 'root_uri', lsp_settings#root_uri('rubocop-lsp-mode'))},
\ 'initialization_options': lsp_settings#get('rubocop-lsp-mode', 'initialization_options', v:null),
\ 'allowlist': lsp_settings#get('rubocop-lsp-mode', 'allowlist', ['ruby']),
\ 'blocklist': lsp_settings#get('rubocop-lsp-mode', 'blocklist', []),
\ 'config': lsp_settings#get('rubocop-lsp-mode', 'config', lsp_settings#server_config('rubocop-lsp-mode')),
\ 'workspace_config': lsp_settings#get('rubocop-lsp-mode', 'workspace_config', {}),
\ 'semantic_highlight': lsp_settings#get('rubocop-lsp-mode', 'semantic_highlight', {}),
\ }
augroup END