summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-03-26 10:35:10 +0100
committerw0rp <devw0rp@gmail.com>2018-03-26 10:35:10 +0100
commit27c5faeafe055954b6e3164467844e78f7a07e55 (patch)
tree40f20da84b584b8acc51471fecc9e09f65122593
parent8e9ae59e5e583e00df3d1a4075b5dd08cdd4de76 (diff)
downloadale-27c5faeafe055954b6e3164467844e78f7a07e55.zip
Use the --stdin-filename option for textlint, so configuration files will be discovered better
-rw-r--r--autoload/ale/handlers/textlint.vim4
-rw-r--r--test/command_callback/test_textlint_command_callbacks.vader24
-rw-r--r--test/command_callback/textlint_paths/with_config_path/.textlintrc0
3 files changed, 10 insertions, 18 deletions
diff --git a/autoload/ale/handlers/textlint.vim b/autoload/ale/handlers/textlint.vim
index c06daa01..4e56e127 100644
--- a/autoload/ale/handlers/textlint.vim
+++ b/autoload/ale/handlers/textlint.vim
@@ -14,13 +14,11 @@ endfunction
function! ale#handlers#textlint#GetCommand(buffer) abort
let l:executable = ale#handlers#textlint#GetExecutable(a:buffer)
- let l:config = ale#path#FindNearestFile(a:buffer, '.textlintrc')
let l:options = ale#Var(a:buffer, 'textlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
- \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '')
- \ . ' -f json %t'
+ \ . ' -f json --stdin --stdin-filename %s'
endfunction
function! ale#handlers#textlint#HandleTextlintOutput(buffer, lines) abort
diff --git a/test/command_callback/test_textlint_command_callbacks.vader b/test/command_callback/test_textlint_command_callbacks.vader
index 6a1a3d58..212f34d3 100644
--- a/test/command_callback/test_textlint_command_callbacks.vader
+++ b/test/command_callback/test_textlint_command_callbacks.vader
@@ -36,13 +36,13 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
- \ ale#Escape('textlint') . ' -f json %t',
+ \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s',
\ ale#handlers#textlint#GetCommand(bufnr(''))
let b:ale_textlint_executable = 'foobar'
AssertEqual
- \ ale#Escape('foobar') . ' -f json %t',
+ \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s',
\ ale#handlers#textlint#GetCommand(bufnr(''))
\
@@ -50,7 +50,7 @@ Execute(The options should be configurable):
let b:ale_textlint_options = '--something'
AssertEqual
- \ ale#Escape('textlint') . ' --something -f json %t',
+ \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s',
\ ale#handlers#textlint#GetCommand(bufnr(''))
Execute(The local executable from .bin should be used if available):
@@ -61,7 +61,8 @@ Execute(The local executable from .bin should be used if available):
\ ale#handlers#textlint#GetExecutable(bufnr(''))
AssertEqual
- \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint')) . ' -f json %t',
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
+ \ . ' -f json --stdin --stdin-filename %s',
\ ale#handlers#textlint#GetCommand(bufnr(''))
Execute(The local executable from textlint/bin should be used if available):
@@ -73,19 +74,12 @@ Execute(The local executable from textlint/bin should be used if available):
if has('win32')
AssertEqual
- \ 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 %t',
+ \ 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',
\ ale#handlers#textlint#GetCommand(bufnr(''))
else
AssertEqual
- \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) . ' -f json %t',
+ \ 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',
\ ale#handlers#textlint#GetCommand(bufnr(''))
endif
-
-Execute(Configuration files should be discovered):
- call ale#test#SetFilename('textlint_paths/with_config_path/foo.txt')
-
- AssertEqual
- \ ale#Escape('textlint')
- \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_config_path/.textlintrc'))
- \ . ' -f json %t',
- \ ale#handlers#textlint#GetCommand(bufnr(''))
diff --git a/test/command_callback/textlint_paths/with_config_path/.textlintrc b/test/command_callback/textlint_paths/with_config_path/.textlintrc
deleted file mode 100644
index e69de29b..00000000
--- a/test/command_callback/textlint_paths/with_config_path/.textlintrc
+++ /dev/null