summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--ale_linters/tex/textlint.vim9
-rw-r--r--autoload/ale/fix/registry.vim2
-rw-r--r--doc/ale-latex.txt6
-rw-r--r--doc/ale.txt3
-rw-r--r--test/command_callback/test_tex_textlint_command_callbacks.vader65
6 files changed, 84 insertions, 3 deletions
diff --git a/README.md b/README.md
index bdff1112..42bc554f 100644
--- a/README.md
+++ b/README.md
@@ -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) |
diff --git a/ale_linters/tex/textlint.vim b/ale_linters/tex/textlint.vim
new file mode 100644
index 00000000..0266ed85
--- /dev/null
+++ b/ale_linters/tex/textlint.vim
@@ -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',
+\})
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 90450b34..76580f23 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -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': {
diff --git a/doc/ale-latex.txt b/doc/ale-latex.txt
index 87fbd4e8..bedbabcd 100644
--- a/doc/ale-latex.txt
+++ b/doc/ale-latex.txt
@@ -9,4 +9,10 @@ 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:
diff --git a/doc/ale.txt b/doc/ale.txt
index c8ec6652..836ee29f 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -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`
diff --git a/test/command_callback/test_tex_textlint_command_callbacks.vader b/test/command_callback/test_tex_textlint_command_callbacks.vader
new file mode 100644
index 00000000..d1e2ab91
--- /dev/null
+++ b/test/command_callback/test_tex_textlint_command_callbacks.vader
@@ -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