summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Leinweber <will@bitfission.com>2020-10-20 21:54:45 -0700
committerWill Leinweber <will@bitfission.com>2020-10-20 23:13:53 -0700
commitcafe8621e2e94c8eff37a430fdccb0b87788620a (patch)
tree25bb4ff1b09a821b20aeb78e976597f9a15f7371
parent557a1ed5da70cb443a8650766f4e8ea95e8c0da3 (diff)
downloadale-cafe8621e2e94c8eff37a430fdccb0b87788620a.zip
Add Ruby sorbet option to enable watchman
-rw-r--r--ale_linters/ruby/sorbet.vim5
-rw-r--r--doc/ale-ruby.txt10
-rw-r--r--test/command_callback/test_sorbet_command_callback.vader7
3 files changed, 21 insertions, 1 deletions
diff --git a/ale_linters/ruby/sorbet.vim b/ale_linters/ruby/sorbet.vim
index cae0683c..c67e20cc 100644
--- a/ale_linters/ruby/sorbet.vim
+++ b/ale_linters/ruby/sorbet.vim
@@ -1,14 +1,17 @@
call ale#Set('ruby_sorbet_executable', 'srb')
call ale#Set('ruby_sorbet_options', '')
+call ale#Set('ruby_sorbet_enable_watchman', 0)
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
let l:options = ale#Var(a:buffer, 'ruby_sorbet_options')
+ let l:enable_watchman = ale#Var(a:buffer, 'ruby_sorbet_enable_watchman')
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . (!empty(l:options) ? ' ' . l:options : '')
- \ . ' --lsp --disable-watchman'
+ \ . ' --lsp'
+ \ . (l:enable_watchman ? '' : ' --disable-watchman')
endfunction
call ale#linter#Define('ruby', {
diff --git a/doc/ale-ruby.txt b/doc/ale-ruby.txt
index 8815404a..edc6144a 100644
--- a/doc/ale-ruby.txt
+++ b/doc/ale-ruby.txt
@@ -177,6 +177,16 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options*
This variable can be changed to modify flags given to sorbet.
+g:ale_ruby_sorbet_enable_watchman *g:ale_ruby_sorbet_enable_watchman*
+ *b:ale_ruby_sorbet_enable_watchman*
+ Type: |Number|
+ Default: `0`
+
+ Whether or not to use watchman to let the LSP server to know about changes
+ to files from outside of vim. Defaults to disable watchman because it
+ requires watchman to be installed separately from sorbet.
+
+
===============================================================================
standardrb *ale-ruby-standardrb*
diff --git a/test/command_callback/test_sorbet_command_callback.vader b/test/command_callback/test_sorbet_command_callback.vader
index b46e90a4..fe758635 100644
--- a/test/command_callback/test_sorbet_command_callback.vader
+++ b/test/command_callback/test_sorbet_command_callback.vader
@@ -5,6 +5,7 @@ Before:
let g:ale_ruby_sorbet_executable = 'srb'
let g:ale_ruby_sorbet_options = ''
+ let g:ale_ruby_sorbet_enable_watchman = 0
After:
call ale#assert#TearDownLinterTest()
@@ -13,6 +14,12 @@ Execute(Executable should default to srb):
AssertLinter 'srb', ale#Escape('srb')
\ . ' tc --lsp --disable-watchman'
+Execute(Able to enable watchman):
+ let g:ale_ruby_sorbet_enable_watchman = 1
+
+ AssertLinter 'srb', ale#Escape('srb')
+ \ . ' tc --lsp'
+
Execute(Should be able to set a custom executable):
let g:ale_ruby_sorbet_executable = 'bin/srb'