languagetools: stop auto-appending --autoDetect (#2616)
Options are now configurable for languagetools, and `--autoDetect` can be removed by changing the options.
This commit is contained in:
parent
34f2943fdd
commit
05ba522c9a
3 changed files with 20 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
" Description: languagetool for markdown files
|
" Description: languagetool for markdown files
|
||||||
"
|
"
|
||||||
call ale#Set('languagetool_executable', 'languagetool')
|
call ale#Set('languagetool_executable', 'languagetool')
|
||||||
|
call ale#Set('languagetool_options', '--autoDetect')
|
||||||
|
|
||||||
function! ale#handlers#languagetool#GetExecutable(buffer) abort
|
function! ale#handlers#languagetool#GetExecutable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'languagetool_executable')
|
return ale#Var(a:buffer, 'languagetool_executable')
|
||||||
|
@ -9,8 +10,10 @@ endfunction
|
||||||
|
|
||||||
function! ale#handlers#languagetool#GetCommand(buffer) abort
|
function! ale#handlers#languagetool#GetCommand(buffer) abort
|
||||||
let l:executable = ale#handlers#languagetool#GetExecutable(a:buffer)
|
let l:executable = ale#handlers#languagetool#GetExecutable(a:buffer)
|
||||||
|
let l:options = ale#Var(a:buffer, 'languagetool_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' --autoDetect %s'
|
return ale#Escape(l:executable)
|
||||||
|
\ . (empty(l:options) ? '' : ' ' . l:options) . ' %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort
|
function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort
|
||||||
|
|
|
@ -1967,6 +1967,14 @@ g:ale_languagetool_executable *g:ale_languagetool_executable*
|
||||||
The executable to run for languagetool.
|
The executable to run for languagetool.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_languagetool_options *g:ale_languagetool_options*
|
||||||
|
*b:ale_languagetool_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'--autoDetect'`
|
||||||
|
|
||||||
|
This variable can be set to pass additional options to languagetool.
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
7.3. Options for write-good *ale-write-good-options*
|
7.3. Options for write-good *ale-write-good-options*
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,11 @@ Execute(Should be able to set a custom executable):
|
||||||
let g:ale_languagetool_executable = 'foobar'
|
let g:ale_languagetool_executable = 'foobar'
|
||||||
|
|
||||||
AssertLinter 'foobar' , ale#Escape('foobar')
|
AssertLinter 'foobar' , ale#Escape('foobar')
|
||||||
\ . ' --autoDetect %s'
|
\ . ' --autoDetect %s'
|
||||||
|
|
||||||
|
Execute(Should be able to include custom languagetool options):
|
||||||
|
let g:ale_languagetool_options = '--language en'
|
||||||
|
|
||||||
|
" is now 'foobar' based on above global
|
||||||
|
AssertLinter 'foobar', ale#Escape('foobar')
|
||||||
|
\ . ' --language en %s'
|
||||||
|
|
Reference in a new issue