Add textlint for Asciidoc and add it to Fixers (#2193)

* Add textlint for asciidoc
* Add textlint --fix
This commit is contained in:
TANIGUCHI Masaya
2019-01-11 03:53:45 +09:00
committed by w0rp
parent 721183116e
commit fabebb3a47
9 changed files with 145 additions and 2 deletions

View File

@@ -170,6 +170,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['rust'],
\ 'description': 'Fix Rust files with Rustfmt.',
\ },
\ 'textlint': {
\ 'function': 'ale#fixers#textlint#Fix',
\ 'suggested_filetypes': ['text','markdown','asciidoc'],
\ 'description': 'Fix text files with textlint --fix',
\ },
\ 'hackfmt': {
\ 'function': 'ale#fixers#hackfmt#Fix',
\ 'suggested_filetypes': ['hack'],

View File

@@ -0,0 +1,15 @@
" Author: TANIGUCHI Masaya <ta2gch@gmail.com>
" Description: Integration of textlint with ALE.
function! ale#fixers#textlint#Fix(buffer) abort
let l:executable = ale#handlers#textlint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'textlint_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' --fix'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction