summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/engine.vim50
-rw-r--r--doc/ale.txt16
-rw-r--r--plugin/ale.vim4
3 files changed, 17 insertions, 53 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index a5bf3096..7d22ad11 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -284,6 +284,14 @@ function! ale#engine#EscapeCommandPart(command_part) abort
return substitute(a:command_part, '%', '%%', 'g')
endfunction
+function! s:TemporaryFilename(buffer) abort
+ " Create a temporary filename, <temp_dir>/<original_basename>
+ " The file itself will not be created by this function.
+ return tempname()
+ \ . (has('win32') ? '\' : '/')
+ \ . fnamemodify(bufname(a:buffer), ':t')
+endfunction
+
" Given a command string, replace every...
" %s -> with the current filename
" %t -> with the name of an unused file in a temporary directory
@@ -306,11 +314,7 @@ function! ale#engine#FormatCommand(buffer, command) abort
if l:command =~# '%t'
" Create a temporary filename, <temp_dir>/<original_basename>
" The file itself will not be created by this function.
- let l:temporary_file =
- \ tempname()
- \ . (has('win32') ? '\' : '/')
- \ . fnamemodify(bufname(a:buffer), ':t')
-
+ let l:temporary_file = s:TemporaryFilename(a:buffer)
let l:command = substitute(l:command, '%t', '\=fnameescape(l:temporary_file)', 'g')
endif
@@ -348,6 +352,14 @@ function! s:RunJob(options) abort
let [l:temporary_file, l:command] = ale#engine#FormatCommand(l:buffer, l:command)
+ if l:read_buffer && empty(l:temporary_file)
+ " If we are to send the Vim buffer to a command, we'll do it
+ " in the shell. We'll write out the file to a temporary file,
+ " and then read it back in, in the shell.
+ let l:temporary_file = s:TemporaryFilename(l:buffer)
+ let l:command = l:command . ' < ' . fnameescape(l:temporary_file)
+ endif
+
if s:CreateTemporaryFileForJob(l:buffer, l:temporary_file)
" If a temporary filename has been formatted in to the command, then
" we do not need to send the Vim buffer to the command.
@@ -401,15 +413,6 @@ function! s:RunJob(options) abort
\ ? 'cmd /c ' . l:command
\ : split(&shell) + split(&shellcmdflag) + [l:command]
- if l:read_buffer && !g:ale_use_ch_sendraw
- " Send the buffer via internal Vim 8 mechanisms, rather than
- " by reading and sending it ourselves.
- " On Unix machines, we can send the Vim buffer directly.
- " This is faster than reading the lines ourselves.
- let l:job_options.in_io = 'buffer'
- let l:job_options.in_buf = l:buffer
- endif
-
" Vim 8 will read the stdin from the file's buffer.
let l:job = job_start(l:command, l:job_options)
endif
@@ -426,25 +429,6 @@ function! s:RunJob(options) abort
\ 'output': [],
\ 'next_chain_index': l:next_chain_index,
\}
-
- if l:read_buffer
- if has('nvim')
- " In NeoVim, we have to send the buffer lines ourselves.
- let l:input = join(getbufline(l:buffer, 1, '$'), "\n") . "\n"
-
- call jobsend(l:job, l:input)
- call jobclose(l:job, 'stdin')
- elseif g:ale_use_ch_sendraw
- " On some Vim versions, we have to send the buffer data ourselves.
- let l:input = join(getbufline(l:buffer, 1, '$'), "\n") . "\n"
- let l:channel = job_getchannel(l:job)
-
- if ch_status(l:channel) ==# 'open'
- call ch_sendraw(l:channel, l:input)
- call ch_close_in(l:channel)
- endif
- endif
- endif
endif
endfunction
diff --git a/doc/ale.txt b/doc/ale.txt
index 3695de77..9e0c414f 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -398,22 +398,6 @@ g:ale_statusline_format *g:ale_statusline_format*
- The 3rd element is for when no errors are detected
-g:ale_use_ch_sendraw *g:ale_use_ch_sendraw*
-
- Type: |Number|
- Default: `has('win32')`
-
- This option only applies to Vim, and is ignored when the plugin is run
- in NeoVim.
-
- When this option is set to `1`, ALE will use |ch_sendraw()| for sending text
- buffers to jobs, instead of setting the `in_io` option to `'buffer'` for
- |job_start()|. See |in_io-buffer| for more information on this Vim option.
-
- Using |ch_sendraw()| instead may lead to better performance or stability in
- some cases. Typically for Linux users, `in_io` seems to be a better option.
-
-
g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace*
Type: |Number|
diff --git a/plugin/ale.vim b/plugin/ale.vim
index 13c681a0..d65a99cb 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -66,10 +66,6 @@ let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 0)
" should be used instead.
let g:ale_enabled = get(g:, 'ale_enabled', 1)
-" This flag can be used to force ALE to send buffer data using ch_sendraw
-" in Vim 8. This works better for some users.
-let g:ale_use_ch_sendraw = get(g:, 'ale_use_ch_sendraw', has('win32'))
-
" These flags dictates if ale uses the quickfix or the loclist (loclist is the
" default, quickfix overrides loclist).
let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1)