Add textlint for tex (#2234)
This commit is contained in:
parent
79135dfe13
commit
03b25dd39b
6 changed files with 84 additions and 3 deletions
|
@ -148,7 +148,7 @@ formatting.
|
|||
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
|
||||
| Julia | [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions |
|
||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good), [textlint](https://textlint.github.io/) |
|
||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
||||
| Lua | [luac](https://www.lua.org/manual/5.1/luac.html), [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
|
|
9
ale_linters/tex/textlint.vim
Normal file
9
ale_linters/tex/textlint.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
" Author: TANIGUCHI Masaya <ta2gch@gmail.com>
|
||||
" Description: textlint for LaTeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'textlint',
|
||||
\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#textlint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||
\})
|
|
@ -177,7 +177,7 @@ let s:default_registry = {
|
|||
\ },
|
||||
\ 'textlint': {
|
||||
\ 'function': 'ale#fixers#textlint#Fix',
|
||||
\ 'suggested_filetypes': ['text','markdown','asciidoc'],
|
||||
\ 'suggested_filetypes': ['text','markdown','asciidoc','tex'],
|
||||
\ 'description': 'Fix text files with textlint --fix',
|
||||
\ },
|
||||
\ 'hackfmt': {
|
||||
|
|
|
@ -8,5 +8,11 @@ write-good *ale-latex-write-good*
|
|||
See |ale-write-good-options|
|
||||
|
||||
|
||||
===============================================================================
|
||||
textlint *ale-latex-textlint*
|
||||
|
||||
See |ale-text-textlint|
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -187,6 +187,7 @@ CONTENTS *ale-contents*
|
|||
languageserver......................|ale-kotlin-languageserver|
|
||||
latex.................................|ale-latex-options|
|
||||
write-good..........................|ale-latex-write-good|
|
||||
textlint............................|ale-latex-textlint|
|
||||
less..................................|ale-less-options|
|
||||
lessc...............................|ale-less-lessc|
|
||||
prettier............................|ale-less-prettier|
|
||||
|
@ -468,7 +469,7 @@ Notes:
|
|||
* JSON: `fixjson`, `jsonlint`, `jq`, `prettier`
|
||||
* Julia: `languageserver`
|
||||
* Kotlin: `kotlinc`!!, `ktlint`!!, `languageserver`
|
||||
* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good`
|
||||
* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good`, `textlint`
|
||||
* Less: `lessc`, `prettier`, `stylelint`
|
||||
* LLVM: `llc`
|
||||
* Lua: `luac`, `luacheck`
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
" Author: januswel, w0rp
|
||||
|
||||
Before:
|
||||
" This is just one language for the linter.
|
||||
call ale#assert#SetUpLinterTest('tex', 'textlint')
|
||||
|
||||
" The configuration is shared between many languages.
|
||||
Save g:ale_textlint_executable
|
||||
Save g:ale_textlint_use_global
|
||||
Save g:ale_textlint_options
|
||||
|
||||
let g:ale_textlint_executable = 'textlint'
|
||||
let g:ale_textlint_use_global = 0
|
||||
let g:ale_textlint_options = ''
|
||||
|
||||
unlet! b:ale_textlint_executable
|
||||
unlet! b:ale_textlint_use_global
|
||||
unlet! b:ale_textlint_options
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_textlint_executable
|
||||
unlet! b:ale_textlint_use_global
|
||||
unlet! b:ale_textlint_options
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'textlint',
|
||||
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_textlint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_textlint_options = '--something'
|
||||
|
||||
AssertLinter 'textlint',
|
||||
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The local executable from .bin should be used if available):
|
||||
call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt')
|
||||
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The local executable from textlint/bin should be used if available):
|
||||
call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt')
|
||||
|
||||
if has('win32')
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
||||
\ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
else
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
endif
|
Reference in a new issue