summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--ale_linters/go/golangci_lint.vim2
-rw-r--r--ale_linters/julia/languageserver.vim21
-rw-r--r--ale_linters/nasm/nasm.vim2
-rw-r--r--ale_linters/ruby/brakeman.vim12
-rw-r--r--ale_linters/ruby/rails_best_practices.vim14
-rw-r--r--ale_linters/ruby/reek.vim13
-rw-r--r--ale_linters/ruby/rubocop.vim12
-rw-r--r--ale_linters/thrift/thrift.vim2
-rw-r--r--autoload/ale/completion.vim18
-rw-r--r--autoload/ale/cursor.vim79
-rw-r--r--autoload/ale/events.vim6
-rw-r--r--autoload/ale/fixers/eslint.vim2
-rw-r--r--autoload/ale/fixers/rubocop.vim10
-rw-r--r--autoload/ale/handlers/eslint.vim7
-rw-r--r--autoload/ale/handlers/rubocop.vim6
-rw-r--r--autoload/ale/handlers/ruby.vim7
-rw-r--r--autoload/ale/julia.vim19
-rw-r--r--autoload/ale/lsp_linter.vim16
-rw-r--r--autoload/ale/preview.vim2
-rw-r--r--doc/ale-julia.txt20
-rw-r--r--doc/ale-ruby.txt27
-rw-r--r--doc/ale-rust.txt4
-rw-r--r--doc/ale-thrift.txt2
-rw-r--r--doc/ale.txt64
-rw-r--r--plugin/ale.vim7
-rw-r--r--test/command_callback/julia-languageserver-project/REQUIRE0
-rw-r--r--test/command_callback/julia-languageserver-project/test.jl0
-rw-r--r--test/command_callback/test_brakeman_command_callback.vader17
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader6
-rw-r--r--test/command_callback/test_julia_languageserver_callbacks.vader30
-rw-r--r--test/command_callback/test_nasm_nasm_command_callbacks.vader6
-rw-r--r--test/command_callback/test_reek_command_callback.vader30
-rw-r--r--test/command_callback/test_thrift_command_callback.vader10
-rw-r--r--test/completion/test_completion_filtering.vader26
-rw-r--r--test/completion/test_lsp_completion_parsing.vader24
-rw-r--r--test/completion/test_tsserver_completion_parsing.vader18
-rw-r--r--test/fixers/test_eslint_fixer_callback.vader7
-rw-r--r--test/handler/test_eslint_handler.vader12
-rw-r--r--test/test_redundant_tsserver_rendering_avoided.vader136
40 files changed, 581 insertions, 118 deletions
diff --git a/README.md b/README.md
index 26ca9b14..06575e35 100644
--- a/README.md
+++ b/README.md
@@ -135,6 +135,7 @@ formatting.
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac), [uncrustify](https://github.com/uncrustify/uncrustify) |
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
| 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) |
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
@@ -168,7 +169,7 @@ formatting.
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Re:VIEW | [redpen](http://redpen.cc/) |
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
-| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph]([solargraph](https://solargraph.org) |
+| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph](https://solargraph.org) |
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
diff --git a/ale_linters/go/golangci_lint.vim b/ale_linters/go/golangci_lint.vim
index b44a6239..dd9a3c64 100644
--- a/ale_linters/go/golangci_lint.vim
+++ b/ale_linters/go/golangci_lint.vim
@@ -18,7 +18,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . '%e run '
- \ . ale#util#EscapePCRE(l:filename)
+ \ . ale#Escape(l:filename)
\ . ' ' . l:options
endfunction
diff --git a/ale_linters/julia/languageserver.vim b/ale_linters/julia/languageserver.vim
new file mode 100644
index 00000000..b5d90bff
--- /dev/null
+++ b/ale_linters/julia/languageserver.vim
@@ -0,0 +1,21 @@
+" Author: Bartolomeo Stellato <bartolomeo.stellato@gmail.com>
+" Description: A language server for Julia
+
+" Set julia executable variable
+call ale#Set('julia_executable', 'julia')
+
+function! ale_linters#julia#languageserver#GetCommand(buffer) abort
+ let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
+ let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(stdin, stdout, false); server.runlinter = true; run(server);'
+
+ return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
+endfunction
+
+call ale#linter#Define('julia', {
+\ 'name': 'languageserver',
+\ 'lsp': 'stdio',
+\ 'executable_callback': ale#VarFunc('julia_executable'),
+\ 'command_callback': 'ale_linters#julia#languageserver#GetCommand',
+\ 'language': 'julia',
+\ 'project_root_callback': 'ale#julia#FindProjectRoot',
+\})
diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim
index 29d19e62..cb2119a6 100644
--- a/ale_linters/nasm/nasm.vim
+++ b/ale_linters/nasm/nasm.vim
@@ -8,10 +8,12 @@ function! ale_linters#nasm#nasm#GetCommand(buffer) abort
" Note that NASM requires a trailing slash for the -I option.
let l:separator = has('win32') ? '\' : '/'
let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
+ let l:output_null = has('win32') ? 'NUL' : '/dev/null'
return '%e -X gnu -I ' . ale#Escape(l:path)
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
\ . ' %s'
+ \ . ' -o ' . l:output_null
endfunction
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim
index 85cfc184..122e0b5b 100644
--- a/ale_linters/ruby/brakeman.vim
+++ b/ale_linters/ruby/brakeman.vim
@@ -1,8 +1,9 @@
" Author: Eddie Lebow https://github.com/elebow
" Description: Brakeman, a static analyzer for Rails security
-let g:ale_ruby_brakeman_options =
-\ get(g:, 'ale_ruby_brakeman_options', '')
+call ale#Set('ruby_brakeman_options', '')
+call ale#Set('ruby_brakeman_executable', 'brakeman')
+call ale#Set('ruby_brakeman_options', '')
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
let l:output = []
@@ -33,14 +34,17 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
return ''
endif
- return 'brakeman -f json -q '
+ let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
+
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
+ \ . ' -f json -q '
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
\ . ' -p ' . ale#Escape(l:rails_root)
endfunction
call ale#linter#Define('ruby', {
\ 'name': 'brakeman',
-\ 'executable': 'brakeman',
+\ 'executable_callback': ale#VarFunc('ruby_brakeman_executable'),
\ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand',
\ 'callback': 'ale_linters#ruby#brakeman#Handle',
\ 'lint_file': 1,
diff --git a/ale_linters/ruby/rails_best_practices.vim b/ale_linters/ruby/rails_best_practices.vim
index 4ba1f3fe..20cadca8 100644
--- a/ale_linters/ruby/rails_best_practices.vim
+++ b/ale_linters/ruby/rails_best_practices.vim
@@ -22,26 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
return l:output
endfunction
-function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
-endfunction
-
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
- let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'bundle$'
- \ ? ' exec rails_best_practices'
- \ : ''
-
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
if l:rails_root is? ''
return ''
endif
+ let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout '
let l:cat_file = ale#Has('win32') ? '; type %t' : ''
- return ale#Escape(l:executable) . l:exec_args
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
\ . ' --silent -f json --output-file ' . l:output_file
\ . ale#Var(a:buffer, 'ruby_rails_best_practices_options')
\ . ale#Escape(l:rails_root)
@@ -50,7 +42,7 @@ endfunction
call ale#linter#Define('ruby', {
\ 'name': 'rails_best_practices',
-\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
+\ 'executable_callback': ale#VarFunc('ruby_rails_best_practices_executable'),
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
\ 'lint_file': 1,
diff --git a/ale_linters/ruby/reek.vim b/ale_linters/ruby/reek.vim
index aa5d8d70..eefc4ecf 100644
--- a/ale_linters/ruby/reek.vim
+++ b/ale_linters/ruby/reek.vim
@@ -3,6 +3,8 @@
call ale#Set('ruby_reek_show_context', 0)
call ale#Set('ruby_reek_show_wiki_link', 0)
+call ale#Set('ruby_reek_options', '')
+call ale#Set('ruby_reek_executable', 'reek')
function! ale_linters#ruby#reek#VersionCheck(buffer) abort
" If we have previously stored the version number in a cache, then
@@ -12,18 +14,23 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort
return ''
endif
- return 'reek --version'
+ let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
+
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
+ \ . ' --version'
endfunction
function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort
let l:version = ale#semver#GetVersion('reek', a:version_output)
+ let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
" Tell reek what the filename is if the version of reek is new enough.
let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0])
\ ? ' --stdin-filename %s'
\ : ''
- return 'reek -f json --no-progress --no-color'
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
+ \ . ' -f json --no-progress --no-color'
\ . l:display_name_args
endfunction
@@ -62,7 +69,7 @@ endfunction
call ale#linter#Define('ruby', {
\ 'name': 'reek',
-\ 'executable': 'reek',
+\ 'executable_callback': ale#VarFunc('ruby_reek_executable'),
\ 'command_chain': [
\ {'callback': 'ale_linters#ruby#reek#VersionCheck'},
\ {'callback': 'ale_linters#ruby#reek#GetCommand'},
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 777f457a..45218394 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -1,13 +1,13 @@
" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
" Description: RuboCop, a code style analyzer for Ruby files
+call ale#Set('ruby_rubocop_executable', 'rubocop')
+call ale#Set('ruby_rubocop_options', '')
+
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
- let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'bundle$'
- \ ? ' exec rubocop'
- \ : ''
+ let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
- return ale#Escape(l:executable) . l:exec_args
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
@@ -55,7 +55,7 @@ endfunction
call ale#linter#Define('ruby', {
\ 'name': 'rubocop',
-\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable',
+\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'),
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
\})
diff --git a/ale_linters/thrift/thrift.vim b/ale_linters/thrift/thrift.vim
index 396a2355..36a8656e 100644
--- a/ale_linters/thrift/thrift.vim
+++ b/ale_linters/thrift/thrift.vim
@@ -2,7 +2,7 @@
call ale#Set('thrift_thrift_executable', 'thrift')
call ale#Set('thrift_thrift_generators', ['cpp'])
-call ale#Set('thrift_thrift_includes', [])
+call ale#Set('thrift_thrift_includes', ['.'])
call ale#Set('thrift_thrift_options', '-strict')
function! ale_linters#thrift#thrift#GetCommand(buffer) abort
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index bded12b1..9dd913f5 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -98,14 +98,15 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
return ''
endfunction
-function! ale#completion#Filter(buffer, suggestions, prefix) abort
+function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort
let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words')
+ let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype)
" For completing...
" foo.
" ^
" We need to include all of the given suggestions.
- if a:prefix is# '.'
+ if index(l:triggers, a:prefix) >= 0
let l:filtered_suggestions = a:suggestions
else
let l:filtered_suggestions = []
@@ -264,7 +265,7 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
call add(l:documentationParts, l:part.text)
endfor
- if l:suggestion.kind is# 'clasName'
+ if l:suggestion.kind is# 'className'
let l:kind = 'f'
elseif l:suggestion.kind is# 'parameterName'
let l:kind = 'f'
@@ -359,17 +360,23 @@ function! ale#completion#ParseLSPCompletions(response) abort
let l:kind = 'v'
endif
+ let l:doc = get(l:item, 'documentation', '')
+
+ if type(l:doc) is v:t_dict && has_key(l:doc, 'value')
+ let l:doc = l:doc.value
+ endif
+
call add(l:results, {
\ 'word': l:word,
\ 'kind': l:kind,
\ 'icase': 1,
\ 'menu': get(l:item, 'detail', ''),
- \ 'info': get(l:item, 'documentation', ''),
+ \ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
\})
endfor
if has_key(l:info, 'prefix')
- return ale#completion#Filter(l:buffer, l:results, l:info.prefix)
+ return ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix)
endif
return l:results
@@ -390,6 +397,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
if l:command is# 'completions'
let l:names = ale#completion#Filter(
\ l:buffer,
+ \ &filetype,
\ ale#completion#ParseTSServerCompletions(a:response),
\ b:ale_completion_info.prefix,
\)[: g:ale_completion_max_suggestions - 1]
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 3fa4e5ba..c3b48ca3 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -1,4 +1,6 @@
+scriptencoding utf-8
" Author: w0rp <devw0rp@gmail.com>
+" Author: João Paulo S. de Souza <joao.paulo.silvasouza@hotmail.com>
" Description: Echoes lint message for the current line, if any
" Controls the milliseconds delay before echoing a message.
@@ -37,12 +39,11 @@ function! ale#cursor#TruncatedEcho(original_message) abort
endtry
endfunction
-function! s:FindItemAtCursor() abort
- let l:buf = bufnr('')
- let l:info = get(g:ale_buffer_info, l:buf, {})
+function! s:FindItemAtCursor(buffer) abort
+ let l:info = get(g:ale_buffer_info, a:buffer, {})
let l:loclist = get(l:info, 'loclist', [])
let l:pos = getcurpos()
- let l:index = ale#util#BinarySearch(l:loclist, l:buf, l:pos[1], l:pos[2])
+ let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
return [l:info, l:loc]
@@ -56,7 +57,9 @@ function! s:StopCursorTimer() abort
endfunction
function! ale#cursor#EchoCursorWarning(...) abort
- if !g:ale_echo_cursor
+ let l:buffer = bufnr('')
+
+ if !g:ale_echo_cursor && !g:ale_cursor_detail
return
endif
@@ -65,28 +68,39 @@ function! ale#cursor#EchoCursorWarning(...) abort
return
endif
- if ale#ShouldDoNothing(bufnr(''))
+ if ale#ShouldDoNothing(l:buffer)
return
endif
- let l:buffer = bufnr('')
- let [l:info, l:loc] = s:FindItemAtCursor()
+ let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
+
+ if g:ale_echo_cursor
+ if !empty(l:loc)
+ let l:format = ale#Var(l:buffer, 'echo_msg_format')
+ let l:msg = ale#GetLocItemMessage(l:loc, l:format)
+ call ale#cursor#TruncatedEcho(l:msg)
+ let l:info.echoed = 1
+ elseif get(l:info, 'echoed')
+ " We'll only clear the echoed message when moving off errors once,
+ " so we don't continually clear the echo line.
+ execute 'echo'
+ let l:info.echoed = 0
+ endif
+ endif
- if !empty(l:loc)
- let l:format = ale#Var(l:buffer, 'echo_msg_format')
- let l:msg = ale#GetLocItemMessage(l:loc, l:format)
- call ale#cursor#TruncatedEcho(l:msg)
- let l:info.echoed = 1
- elseif get(l:info, 'echoed')
- " We'll only clear the echoed message when moving off errors once,
- " so we don't continually clear the echo line.
- execute 'echo'
- let l:info.echoed = 0
+ if g:ale_cursor_detail
+ if !empty(l:loc)
+ call s:ShowCursorDetailForItem(l:loc, {'stay_here': 1})
+ else
+ call ale#preview#CloseIfTypeMatches('ale-preview')
+ endif
endif
endfunction
function! ale#cursor#EchoCursorWarningWithDelay() abort
- if !g:ale_echo_cursor
+ let l:buffer = bufnr('')
+
+ if !g:ale_echo_cursor && !g:ale_cursor_detail
return
endif
@@ -104,7 +118,7 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
" we should echo something. Otherwise we can end up doing processing
" the echo message far too frequently.
if l:pos != s:last_pos
- let l:delay = ale#Var(bufnr(''), 'echo_delay')
+ let l:delay = ale#Var(l:buffer, 'echo_delay')
let s:last_pos = l:pos
let s:cursor_timer = timer_start(
@@ -114,24 +128,37 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
endif
endfunction
+function! s:ShowCursorDetailForItem(loc, options) abort
+ let l:stay_here = get(a:options, 'stay_here', 0)
+
+ let s:last_detailed_line = line('.')
+ let l:message = get(a:loc, 'detail', a:loc.text)
+ let l:lines = split(l:message, "\n")
+ call ale#preview#Show(l:lines, {'stay_here': l:stay_here})
+
+ " Clear the echo message if we manually displayed details.
+ if !l:stay_here
+ execute 'echo'
+ endif
+endfunction
+
function! ale#cursor#ShowCursorDetail() abort
+ let l:buffer = bufnr('')
+
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
return
endif
- if ale#ShouldDoNothing(bufnr(''))
+ if ale#ShouldDoNothing(l:buffer)
return
endif
call s:StopCursorTimer()
- let [l:info, l:loc] = s:FindItemAtCursor()
+ let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
if !empty(l:loc)
- let l:message = get(l:loc, 'detail', l:loc.text)
-
- call ale#preview#Show(split(l:message, "\n"))
- execute 'echo'
+ call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0})
endif
endfunction
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim
index 300aefcc..e48ad488 100644
--- a/autoload/ale/events.vim
+++ b/autoload/ale/events.vim
@@ -131,13 +131,17 @@ function! ale#events#Init() abort
autocmd InsertLeave * call ale#Queue(0)
endif
- if g:ale_echo_cursor
+ if g:ale_echo_cursor || g:ale_cursor_detail
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif
" Look for a warning to echo as soon as we leave Insert mode.
" The script's position variable used when moving the cursor will
" not be changed here.
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
endif
+
+ if g:ale_close_preview_on_insert
+ autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif
+ endif
endif
augroup END
endfunction
diff --git a/autoload/ale/fixers/eslint.vim b/autoload/ale/fixers/eslint.vim
index 36f47510..ea5b2a63 100644
--- a/autoload/ale/fixers/eslint.vim
+++ b/autoload/ale/fixers/eslint.vim
@@ -25,7 +25,7 @@ endfunction
function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort
" If the output is an error message, don't use it.
for l:line in a:output[:10]
- if l:line =~# '^Error:'
+ if l:line =~# '\v^Error:|^Could not connect'
return []
endif
endfor
diff --git a/autoload/ale/fixers/rubocop.vim b/autoload/ale/fixers/rubocop.vim
index 0a39ef62..a4613817 100644
--- a/autoload/ale/fixers/rubocop.vim
+++ b/autoload/ale/fixers/rubocop.vim
@@ -1,12 +1,12 @@
+call ale#Set('ruby_rubocop_options', '')
+call ale#Set('ruby_rubocop_executable', 'rubocop')
+
function! ale#fixers#rubocop#GetCommand(buffer) abort
- let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'bundle$'
- \ ? ' exec rubocop'
- \ : ''
+ let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
- return ale#Escape(l:executable) . l:exec_args
+ return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --auto-correct %t'
diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim
index bc10ec21..eda033e4 100644
--- a/autoload/ale/handlers/eslint.vim
+++ b/autoload/ale/handlers/eslint.vim
@@ -99,6 +99,13 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort
\}]
endif
+ if a:lines == ['Could not connect']
+ return [{
+ \ 'lnum': 1,
+ \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
+ \}]
+ endif
+
" Matches patterns line the following:
"
" /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
diff --git a/autoload/ale/handlers/rubocop.vim b/autoload/ale/handlers/rubocop.vim
deleted file mode 100644
index f6367cf5..00000000
--- a/autoload/ale/handlers/rubocop.vim
+++ /dev/null
@@ -1,6 +0,0 @@
-call ale#Set('ruby_rubocop_options', '')
-call ale#Set('ruby_rubocop_executable', 'rubocop')
-
-function! ale#handlers#rubocop#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'ruby_rubocop_executable')
-endfunction
diff --git a/autoload/ale/handlers/ruby.vim b/autoload/ale/handlers/ruby.vim
index 110fe156..c28b8b75 100644
--- a/autoload/ale/handlers/ruby.vim
+++ b/autoload/ale/handlers/ruby.vim
@@ -37,3 +37,10 @@ function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort
return s:HandleSyntaxError(a:buffer, a:lines)
endfunction
+function! ale#handlers#ruby#EscapeExecutable(executable, bundle_exec) abort
+ let l:exec_args = a:executable =~? 'bundle'
+ \ ? ' exec ' . a:bundle_exec
+ \ : ''
+
+ return ale#Escape(a:executable) . l:exec_args
+endfunction
diff --git a/autoload/ale/julia.vim b/autoload/ale/julia.vim
new file mode 100644
index 00000000..18dd9ad7
--- /dev/null
+++ b/autoload/ale/julia.vim
@@ -0,0 +1,19 @@
+" Author: Bartolomeo Stellato bartolomeo.stellato@gmail.com
+" Description: Functions for integrating with Julia tools
+
+" Find the nearest dir containing a julia project
+let s:__ale_julia_project_filenames = ['REQUIRE', 'Manifest.toml', 'Project.toml']
+
+function! ale#julia#FindProjectRoot(buffer) abort
+ for l:project_filename in s:__ale_julia_project_filenames
+ let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename)
+
+ if !empty(l:full_path)
+ let l:path = fnamemodify(l:full_path, ':p:h')
+
+ return l:path
+ endif
+ endfor
+
+ return ''
+endfunction
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index 8fbad12f..a11c76bc 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -55,16 +55,29 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:thislist = ale#lsp#response#ReadTSServerDiagnostics(a:response)
+ let l:no_changes = 0
" tsserver sends syntax and semantic errors in separate messages, so we
" have to collect the messages separately for each buffer and join them
" back together again.
if a:error_type is# 'syntax'
+ if len(l:thislist) is 0 && len(get(l:info, 'syntax_loclist', [])) is 0
+ let l:no_changes = 1
+ endif
+
let l:info.syntax_loclist = l:thislist
else
+ if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0
+ let l:no_changes = 1
+ endif
+
let l:info.semantic_loclist = l:thislist
endif
+ if l:no_changes
+ return
+ endif
+
let l:loclist = get(l:info, 'semantic_loclist', [])
\ + get(l:info, 'syntax_loclist', [])
@@ -99,9 +112,10 @@ endfunction
function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
let l:method = get(a:response, 'method', '')
- let l:linter_name = get(s:lsp_linter_map, a:conn_id, '')
if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error')
+ let l:linter_name = get(s:lsp_linter_map, a:conn_id, '')
+
call s:HandleLSPErrorMessage(l:linter_name, a:response)
elseif l:method is# 'textDocument/publishDiagnostics'
call s:HandleLSPDiagnostics(a:conn_id, a:response)
diff --git a/autoload/ale/preview.vim b/autoload/ale/preview.vim
index aefbb691..180a37d0 100644
--- a/autoload/ale/preview.vim
+++ b/autoload/ale/preview.vim
@@ -15,13 +15,13 @@ function! ale#preview#Show(lines, ...) abort
setlocal modifiable
setlocal noreadonly
setlocal nobuflisted
- let &l:filetype = get(l:options, 'filetype', 'ale-preview')
setlocal buftype=nofile
setlocal bufhidden=wipe
:%d
call setline(1, a:lines)
setlocal nomodifiable
setlocal readonly
+ let &l:filetype = get(l:options, 'filetype', 'ale-preview')
if get(l:options, 'stay_here')
wincmd p
diff --git a/doc/ale-julia.txt b/doc/ale-julia.txt
new file mode 100644
index 00000000..51532419
--- /dev/null
+++ b/doc/ale-julia.txt
@@ -0,0 +1,20 @@
+===============================================================================
+ALE Julia Integration *ale-julia-options*
+
+===============================================================================
+languageserver *ale-julia-languageserver*
+
+To enable Julia LSP linter you need to install the LanguageServer.jl package
+within julia.
+
+g:ale_julia_executable *g:ale_julia_executable*
+ *b:ale_julia_executable*
+
+ Type: |String|
+ Default: 'julia'
+
+ Path to the julia exetuable.
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
+
diff --git a/doc/ale-ruby.txt b/doc/ale-ruby.txt
index ec7b07cf..810a1d45 100644
--- a/doc/ale-ruby.txt
+++ b/doc/ale-ruby.txt
@@ -5,6 +5,15 @@ ALE Ruby Integration *ale-ruby-options*
===============================================================================
brakeman *ale-ruby-brakeman*
+g:ale_ruby_brakeman_executable *g:ale_ruby_brakeman_executable*
+ *b:ale_ruby_brakeman_executable*
+ Type: String
+ Default: `'brakeman'`
+
+ Override the invoked brakeman binary. Set this to `'bundle'` to invoke
+ `'bundle` `exec` brakeman'.
+
+
g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options*
*b:ale_ruby_brakeman_options*
Type: |String|
@@ -20,10 +29,11 @@ g:ale_ruby_rails_best_practices_executable
*g:ale_ruby_rails_best_practices_executable*
*b:ale_ruby_rails_best_practices_executable*
Type: String
- Default: 'rails_best_practices'
+ Default: `'rails_best_practices'`
Override the invoked rails_best_practices binary. Set this to `'bundle'` to
- invoke `'bundle` `exec` `rails_best_practices'`.
+ invoke `'bundle` `exec` rails_best_practices'.
+
g:ale_ruby_rails_best_practices_options
*g:ale_ruby_rails_best_practices_options*
@@ -37,6 +47,15 @@ g:ale_ruby_rails_best_practices_options
===============================================================================
reek *ale-ruby-reek*
+g:ale_ruby_reek_executable *g:ale_ruby_reek_executable*
+ *b:ale_ruby_reek_executable*
+ Type: String
+ Default: `'reek'`
+
+ Override the invoked reek binary. Set this to `'bundle'` to invoke
+ `'bundle` `exec` reek'.
+
+
g:ale_ruby_reek_show_context *g:ale_ruby_reek_show_context*
*b:ale_ruby_reek_show_context*
Type: |Number|
@@ -63,8 +82,8 @@ g:ale_ruby_rubocop_executable *g:ale_ruby_rubocop_executable*
Type: String
Default: `'rubocop'`
- Override the invoked rubocop binary. This is useful for running rubocop
- from binstubs or a bundle.
+ Override the invoked rubocop binary. Set this to `'bundle'` to invoke
+ `'bundle` `exec` rubocop'.
g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options*
diff --git a/doc/ale-rust.txt b/doc/ale-rust.txt
index a6bd59ad..13e5f6f0 100644
--- a/doc/ale-rust.txt
+++ b/doc/ale-rust.txt
@@ -115,8 +115,8 @@ g:ale_rust_cargo_avoid_whole_workspace *g:ale_rust_cargo_avoid_whole_workspace*
Default: `1`
When set to 1, and ALE is used to edit a crate that is part of a Cargo
- workspace, avoid building the entire entire workspace by invoking
- `cargo` directly in the crate's directory. Otherwise, behave as usual.
+ workspace, avoid building the entire workspace by invoking `cargo` directly
+ in the crate's directory. Otherwise, behave as usual.
===============================================================================
diff --git a/doc/ale-thrift.txt b/doc/ale-thrift.txt
index ed858db8..bb2ec058 100644
--- a/doc/ale-thrift.txt
+++ b/doc/ale-thrift.txt
@@ -28,7 +28,7 @@ g:ale_thrift_thrift_generators *g:ale_thrift_thrift_generators*
g:ale_thrift_thrift_includes *g:ale_thrift_thrift_includes*
*b:ale_thrift_thrift_includes*
Type: |List| of |String|s
- Default: `[]`
+ Default: `['.']`
This list contains paths that will be searched for thrift `include`
directives.
diff --git a/doc/ale.txt b/doc/ale.txt
index 1799f413..9a81b237 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -152,6 +152,8 @@ CONTENTS *ale-contents*
jsonlint............................|ale-json-jsonlint|
jq..................................|ale-json-jq|
prettier............................|ale-json-prettier|
+ julia.................................|ale-julia-options|
+ languageserver......................|ale-julia-languageserver|
kotlin................................|ale-kotlin-options|
kotlinc.............................|ale-kotlin-kotlinc|
ktlint..............................|ale-kotlin-ktlint|
@@ -411,6 +413,7 @@ Notes:
* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify`
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo`
* JSON: `fixjson`, `jsonlint`, `jq`, `prettier`
+* Julia: `languageserver`
* Kotlin: `kotlinc`!!, `ktlint`!!, `languageserver`
* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good`
* Less: `lessc`, `prettier`, `stylelint`
@@ -524,12 +527,13 @@ circumstances.
ALE will report problems with your code in the following ways, listed with
their relevant options.
-* By updating loclist. (On by default) - |g:ale_set_loclist|
-* By updating quickfix. (Off by default) - |g:ale_set_quickfix|
-* By setting error highlights. - |g:ale_set_highlights|
-* By creating signs in the sign column. - |g:ale_set_signs|
-* By echoing messages based on your cursor. - |g:ale_echo_cursor|
-* By showing balloons for your mouse cursor - |g:ale_set_balloons|
+* By updating loclist. (On by default) - |g:ale_set_loclist|
+* By updating quickfix. (Off by default) - |g:ale_set_quickfix|
+* By setting error highlights. - |g:ale_set_highlights|
+* By creating signs in the sign column. - |g:ale_set_signs|
+* By echoing messages based on your cursor. - |g:ale_echo_cursor|
+* By displaying the preview based on your cursor. - |g:ale_cursor_detail|
+* By showing balloons for your mouse cursor - |g:ale_set_balloons|
Please consult the documentation for each option, which can reveal some other
ways of tweaking the behaviour of each way of displaying problems. You can
@@ -802,6 +806,20 @@ g:ale_change_sign_column_color *g:ale_change_sign_column_color*
windows.
+g:ale_close_preview_on_insert *g:ale_close_preview_on_insert*
+
+ Type: |Number|
+ Default: `0`
+
+ When this option is set to `1`, ALE's |preview-window| will be automatically
+ closed upon entering Insert Mode. This option can be used in combination
+ with |g:ale_cursor_detail| for automatically displaying the preview window
+ on problem lines, and automatically closing it again when editing text.
+
+ This setting must be set to `1` before ALE is loaded for this behavior
+ to be enabled. See |ale-lint-settings-on-startup|.
+
+
g:ale_command_wrapper *g:ale_command_wrapper*
*b:ale_command_wrapper*
Type: |String|
@@ -890,6 +908,27 @@ g:ale_completion_max_suggestions *g:ale_completion_max_suggestions*
Adjust this option as needed, depending on the complexity of your codebase
and your available processing power.
+g:ale_cursor_detail *g:ale_cursor_detail*
+
+ Type: |Number|
+ Default: `0`
+
+ When this option is set to `1`, ALE's |preview-window| will be automatically
+ opened when the cursor moves onto lines with problems. ALE will search for
+ problems using the same logic that |g:ale_echo_cursor| uses. The preview
+ window will be closed automatically when you move away from the line.
+
+ Messages are only displayed after a short delay. See |g:ale_echo_delay|.
+
+ The preview window is opened without stealing focus, which means your cursor
+ will stay in the same buffer as it currently is.
+
+ The preview window can be closed automatically upon entering Insert mode
+ by setting |g:ale_close_preview_on_insert| to `1`.
+
+ Either this setting or |g:ale_echo_cursor| must be set to `1` before ALE is
+ loaded for messages to be displayed. See |ale-lint-settings-on-startup|.
+
g:ale_echo_cursor *g:ale_echo_cursor*
@@ -900,11 +939,14 @@ g:ale_echo_cursor *g:ale_echo_cursor*
cursor is near a warning or error. ALE will attempt to find the warning or
error at a column nearest to the cursor when the cursor is resting on a line
which contains a warning or error. This option can be set to `0` to disable
- this behaviour.
- The format of the message can be customizable in |g:ale_echo_msg_format|.
+ this behavior.
- You should set this setting once before ALE is loaded, and restart Vim if
- you want to change your preferences. See |ale-lint-settings-on-startup|.
+ Messages are only displayed after a short delay. See |g:ale_echo_delay|.
+
+ The format of the message can be customized with |g:ale_echo_msg_format|.
+
+ Either this setting or |g:ale_cursor_detail| must be set to `1` before ALE
+ is loaded for messages to be displayed. See |ale-lint-settings-on-startup|.
g:ale_echo_delay *g:ale_echo_delay*
@@ -913,7 +955,7 @@ g:ale_echo_delay *g:ale_echo_delay*
Default: `10`
Given any integer, this option controls the number of milliseconds before
- ALE will echo a message for a problem near the cursor.
+ ALE will echo or preview a message for a problem near the cursor.
The value can be increased to decrease the amount of processing ALE will do
for files displaying a large number of problems.
diff --git a/plugin/ale.vim b/plugin/ale.vim
index a49ea039..888120fe 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -109,6 +109,13 @@ let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax'))
" This flag can be set to 0 to disable echoing when the cursor moves.
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
+" This flag can be set to 1 to automatically show errors in the preview window.
+let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0)
+
+" This flag can be set to 1 to automatically close the preview window upon
+" entering Insert Mode.
+let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0)
+
" This flag can be set to 0 to disable balloon support.
let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running'))
diff --git a/test/command_callback/julia-languageserver-project/REQUIRE b/test/command_callback/julia-languageserver-project/REQUIRE
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/julia-languageserver-project/REQUIRE
diff --git a/test/command_callback/julia-languageserver-project/test.jl b/test/command_callback/julia-languageserver-project/test.jl
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/julia-languageserver-project/test.jl
diff --git a/test/command_callback/test_brakeman_command_callback.vader b/test/command_callback/test_brakeman_command_callback.vader
index 61be4caf..15dbbe1c 100644
--- a/test/command_callback/test_brakeman_command_callback.vader
+++ b/test/command_callback/test_brakeman_command_callback.vader
@@ -12,7 +12,8 @@ Execute(The brakeman command callback should detect absence of a valid Rails app
Execute(The brakeman command callback should find a valid Rails app root):
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
- AssertLinter 'brakeman', 'brakeman -f json -q -p '
+ AssertLinter 'brakeman', ale#Escape('brakeman')
+ \ . ' -f json -q -p '
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app'))
Execute(The brakeman command callback should include configured options):
@@ -20,5 +21,17 @@ Execute(The brakeman command callback should include configured options):
let g:ale_ruby_brakeman_options = '--combobulate'
- AssertLinter 'brakeman', 'brakeman -f json -q --combobulate -p '
+ AssertLinter 'brakeman', ale#Escape('brakeman')
+ \ . ' -f json -q --combobulate -p '
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app'))
+
+Execute(Setting bundle appends 'exec brakeman'):
+ call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
+
+ let g:ale_ruby_brakeman_executable = 'bundle'
+ let g:ale_ruby_brakeman_options = '--combobulate'
+
+ AssertLinter 'bundle', ale#Escape('bundle')
+ \ . ' exec brakeman'
+ \ . ' -f json -q --combobulate -p '
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app'))
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
index 6cb73246..b3805f3a 100644
--- a/test/command_callback/test_golangci_lint_command_callback.vader
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -9,7 +9,7 @@ Execute(The golangci-lint defaults should be correct):
AssertLinter 'golangci-lint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('golangci-lint')
- \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
Execute(The golangci-lint callback should use a configured executable):
@@ -18,7 +18,7 @@ Execute(The golangci-lint callback should use a configured executable):
AssertLinter 'something else',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('something else')
- \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
Execute(The golangci-lint callback should use configured options):
@@ -27,7 +27,7 @@ Execute(The golangci-lint callback should use configured options):
AssertLinter 'golangci-lint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('golangci-lint')
- \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --foobar'
Execute(The golangci-lint `lint_package` option should use the correct command):
diff --git a/test/command_callback/test_julia_languageserver_callbacks.vader b/test/command_callback/test_julia_languageserver_callbacks.vader
new file mode 100644
index 00000000..22c6cefe
--- /dev/null
+++ b/test/command_callback/test_julia_languageserver_callbacks.vader
@@ -0,0 +1,30 @@
+Before:
+ Save g:ale_julia_executable
+
+ call ale#assert#SetUpLinterTest('julia', 'languageserver')
+
+After:
+ Restore
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default executable path should be correct):
+ AssertLinter 'julia',
+ \ ale#Escape('julia') .
+ \' --startup-file=no --history-file=no -e ' .
+ \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(stdin, stdout, false); server.runlinter = true; run(server);')
+
+Execute(The executable should be configurable):
+ let g:ale_julia_executable = 'julia-new'
+
+ AssertLinter 'julia-new',
+ \ ale#Escape('julia-new') .
+ \' --startup-file=no --history-file=no -e ' .
+ \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(stdin, stdout, false); server.runlinter = true; run(server);')
+
+Execute(The project root should be detected correctly):
+ AssertLSPProject ''
+
+ call ale#test#SetFilename('julia-languageserver-project/test.jl')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/julia-languageserver-project')
diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader
index 0d3e572a..8e077306 100644
--- a/test/command_callback/test_nasm_nasm_command_callbacks.vader
+++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader
@@ -2,9 +2,9 @@ Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm')
let b:command_tail =
- \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
let b:command_tail_opt =
- \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
After:
unlet! b:command_tail
@@ -23,7 +23,7 @@ Execute(The options should be configurable):
let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm')
- \ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s'
+ \ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
Execute(The options should be used in command):
let b:ale_nasm_nasm_options = '-w+orphan-labels'
diff --git a/test/command_callback/test_reek_command_callback.vader b/test/command_callback/test_reek_command_callback.vader
index 059e5e36..963247aa 100644
--- a/test/command_callback/test_reek_command_callback.vader
+++ b/test/command_callback/test_reek_command_callback.vader
@@ -7,8 +7,8 @@ After:
Execute(The reek callbacks should return the correct default values):
WithChainResults ['reek 5.0.0']
AssertLinter 'reek', [
- \ 'reek --version',
- \ 'reek -f json --no-progress --no-color --stdin-filename %s',
+ \ ale#Escape('reek') . ' --version',
+ \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s',
\]
" Try with older versions.
@@ -16,19 +16,35 @@ Execute(The reek callbacks should return the correct default values):
WithChainResults ['reek 4.8.2']
AssertLinter 'reek', [
- \ 'reek --version',
- \ 'reek -f json --no-progress --no-color',
+ \ ale#Escape('reek') . ' --version',
+ \ ale#Escape('reek') . ' -f json --no-progress --no-color',
\]
+Execute(Setting bundle appends 'exec reek'):
+ let g:ale_ruby_reek_executable = 'bundle'
+
+ WithChainResults ['reek 5.0.0']
+ AssertLinter 'bundle', ale#Escape('bundle')
+ \ . ' exec reek'
+ \ . ' -f json --no-progress --no-color --stdin-filename %s',
+
+ " Try with older versions.
+ call ale#semver#ResetVersionCache()
+
+ WithChainResults ['reek 4.8.2']
+ AssertLinter 'bundle', ale#Escape('bundle')
+ \ . ' exec reek'
+ \ . ' -f json --no-progress --no-color'
+
Execute(The reek version check should be cached):
WithChainResults ['reek 5.0.0']
AssertLinter 'reek', [
- \ 'reek --version',
- \ 'reek -f json --no-progress --no-color --stdin-filename %s',
+ \ ale#Escape('reek') . ' --version',
+ \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s',
\]
WithChainResults []
AssertLinter 'reek', [
\ '',
- \ 'reek -f json --no-progress --no-color --stdin-filename %s',
+ \ ale#Escape('reek') . ' -f json --no-progress --no-color --stdin-filename %s',
\]
diff --git a/test/command_callback/test_thrift_command_callback.vader b/test/command_callback/test_thrift_command_callback.vader
index ea217259..cbada818 100644
--- a/test/command_callback/test_thrift_command_callback.vader
+++ b/test/command_callback/test_thrift_command_callback.vader
@@ -23,22 +23,22 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
- AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -strict' . b:suffix
+ AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix
Execute(The executable should be configurable):
let b:ale_thrift_thrift_executable = 'foobar'
- AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -strict' . b:suffix
+ AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -I . -strict' . b:suffix
Execute(The list of generators should be configurable):
let b:ale_thrift_thrift_generators = ['java', 'py:dynamic']
AssertLinter 'thrift', ale#Escape('thrift')
- \ . ' --gen java --gen py:dynamic -strict' . b:suffix
+ \ . ' --gen java --gen py:dynamic -I . -strict' . b:suffix
let b:ale_thrift_thrift_generators = []
- AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -strict' . b:suffix
+ AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix
Execute(The list of include paths should be configurable):
let b:ale_thrift_thrift_includes = ['included/path']
@@ -50,4 +50,4 @@ Execute(The string of compiler options should be configurable):
let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts'
AssertLinter 'thrift', ale#Escape('thrift')
- \ . ' --gen cpp -strict --allow-64bit-consts' . b:suffix
+ \ . ' --gen cpp -I . -strict --allow-64bit-consts' . b:suffix
diff --git a/test/completion/test_completion_filtering.vader b/test/completion/test_completion_filtering.vader
index ae91a952..ffb313ef 100644
--- a/test/completion/test_completion_filtering.vader
+++ b/test/completion/test_completion_filtering.vader
@@ -12,16 +12,17 @@ After:
Execute(Prefix filtering should work for Lists of strings):
AssertEqual
\ ['FooBar', 'foo'],
- \ ale#completion#Filter(bufnr(''), ['FooBar', 'FongBar', 'baz', 'foo'], 'foo')
+ \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], 'foo')
AssertEqual
\ ['FooBar', 'FongBar', 'baz', 'foo'],
- \ ale#completion#Filter(bufnr(''), ['FooBar', 'FongBar', 'baz', 'foo'], '.')
+ \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '.')
Execute(Prefix filtering should work for completion items):
AssertEqual
\ [{'word': 'FooBar'}, {'word': 'foo'}],
\ ale#completion#Filter(
\ bufnr(''),
+ \ '',
\ [
\ {'word': 'FooBar'},
\ {'word': 'FongBar'},
@@ -40,6 +41,7 @@ Execute(Prefix filtering should work for completion items):
\ ],
\ ale#completion#Filter(
\ bufnr(''),
+ \ '',
\ [
\ {'word': 'FooBar'},
\ {'word': 'FongBar'},
@@ -56,6 +58,7 @@ Execute(Excluding words from completion results should work):
\ [{'word': 'Italian'}],
\ ale#completion#Filter(
\ bufnr(''),
+ \ '',
\ [
\ {'word': 'Italian'},
\ {'word': 'it'},
@@ -67,6 +70,7 @@ Execute(Excluding words from completion results should work):
\ [{'word': 'Deutsch'}],
\ ale#completion#Filter(
\ bufnr(''),
+ \ '',
\ [
\ {'word': 'describe'},
\ {'word': 'Deutsch'},
@@ -78,6 +82,7 @@ Execute(Excluding words from completion results should work):
\ [{'word': 'Deutsch'}],
\ ale#completion#Filter(
\ bufnr(''),
+ \ '',
\ [
\ {'word': 'describe'},
\ {'word': 'Deutsch'},
@@ -90,19 +95,26 @@ Execute(Excluding words from completion results should work with lists of String
AssertEqual
\ ['Italian'],
- \ ale#completion#Filter(bufnr(''), ['Italian', 'it'], 'it')
+ \ ale#completion#Filter(bufnr(''), '', ['Italian', 'it'], 'it')
AssertEqual
\ ['Deutsch'],
- \ ale#completion#Filter(bufnr(''), ['describe', 'Deutsch'], 'de')
+ \ ale#completion#Filter(bufnr(''), '', ['describe', 'Deutsch'], 'de')
AssertEqual
\ ['Deutsch'],
- \ ale#completion#Filter(bufnr(''), ['describe', 'Deutsch'], '.')
+ \ ale#completion#Filter(bufnr(''), '', ['describe', 'Deutsch'], '.')
Execute(Filtering shouldn't modify the original list):
let b:ale_completion_excluded_words = ['it', 'describe']
let b:suggestions = [{'word': 'describe'}]
- AssertEqual [], ale#completion#Filter(bufnr(''), b:suggestions, '.')
+ AssertEqual [], ale#completion#Filter(bufnr(''), '', b:suggestions, '.')
AssertEqual b:suggestions, [{'word': 'describe'}]
- AssertEqual [], ale#completion#Filter(bufnr(''), b:suggestions, 'de')
+ AssertEqual [], ale#completion#Filter(bufnr(''), '', b:suggestions, 'de')
AssertEqual b:suggestions, [{'word': 'describe'}]
+
+Execute(Filtering should respect filetype triggers):
+ let b:suggestions = [{'word': 'describe'}]
+
+ AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), '', b:suggestions, '.')
+ AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), 'rust', b:suggestions, '.')
+ AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), 'rust', b:suggestions, '::')
diff --git a/test/completion/test_lsp_completion_parsing.vader b/test/completion/test_lsp_completion_parsing.vader
index d5a45b54..71e53ab6 100644
--- a/test/completion/test_lsp_completion_parsing.vader
+++ b/test/completion/test_lsp_completion_parsing.vader
@@ -447,3 +447,27 @@ Execute(Should handle missing keys):
\ ]
\ }
\ })
+
+Execute(Should handle documentation in the markdown format):
+ AssertEqual
+ \ [
+ \ {'word': 'migrations', 'menu': 'xxx', 'info': 'Markdown documentation', 'kind': 'f', 'icase': 1},
+ \ ],
+ \ ale#completion#ParseLSPCompletions({
+ \ 'jsonrpc': '2.0',
+ \ 'id': 6,
+ \ 'result': {
+ \ 'isIncomplete': v:false,
+ \ 'items': [
+ \ {
+ \ 'label': 'migrations',
+ \ 'kind': 3,
+ \ 'detail': 'xxx',
+ \ 'documentation': {
+ \ 'kind': 'markdown',
+ \ 'value': 'Markdown documentation',
+ \ },
+ \ },
+ \ ],
+ \ },
+ \ })
diff --git a/test/completion/test_tsserver_completion_parsing.vader b/test/completion/test_tsserver_completion_parsing.vader
index c8e2c993..dbc4f9e2 100644
--- a/test/completion/test_tsserver_completion_parsing.vader
+++ b/test/completion/test_tsserver_completion_parsing.vader
@@ -32,6 +32,13 @@ Execute(TypeScript completion details responses should be parsed correctly):
\ 'kind': 'f',
\ 'icase': 1,
\ },
+ \ {
+ \ 'word': 'ghi',
+ \ 'menu': '(class) Foo',
+ \ 'info': '',
+ \ 'kind': 'f',
+ \ 'icase': 1,
+ \ },
\ ],
\ ale#completion#ParseTSServerCompletionEntryDetails({
\ 'body': [
@@ -74,6 +81,17 @@ Execute(TypeScript completion details responses should be parsed correctly):
\ {'text': 'baz'},
\ ],
\ },
+ \ {
+ \ 'name': 'ghi',
+ \ 'kind': 'className',
+ \ 'displayParts': [
+ \ {'text': '('},
+ \ {'text': 'class'},
+ \ {'text': ')'},
+ \ {'text': ' '},
+ \ {'text': 'Foo'},
+ \ ],
+ \ },
\ ],
\})
diff --git a/test/fixers/test_eslint_fixer_callback.vader b/test/fixers/test_eslint_fixer_callback.vader
index be33825c..774595e3 100644
--- a/test/fixers/test_eslint_fixer_callback.vader
+++ b/test/fixers/test_eslint_fixer_callback.vader
@@ -170,3 +170,10 @@ Execute(The eslint_d post-processor should handle error messages correctly):
\ ale#fixers#eslint#ProcessEslintDOutput(bufnr(''), [
\ 'Error: No ESLint configuration found.',
\ ])
+
+Execute(The eslint_d post-processor should handle failing to connect properly):
+ AssertEqual
+ \ [],
+ \ ale#fixers#eslint#ProcessEslintDOutput(bufnr(''), [
+ \ 'Could not connect',
+ \ ])
diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader
index 2e8bfd2a..4a57927b 100644
--- a/test/handler/test_eslint_handler.vader
+++ b/test/handler/test_eslint_handler.vader
@@ -365,3 +365,15 @@ Execute(eslint should handle react errors correctly):
\ ale#handlers#eslint#Handle(bufnr(''), [
\ '/path/editor-help.jsx:59:9: Property should be placed on the same line as the component declaration [Error/react/jsx-first-prop-new-line]',
\ ])
+
+Execute(Failing to connect to eslint_d should be handled correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
+ \ },
+ \ ],
+ \ ale#handlers#eslint#Handle(bufnr(''), [
+ \ 'Could not connect',
+ \ ])
diff --git a/test/test_redundant_tsserver_rendering_avoided.vader b/test/test_redundant_tsserver_rendering_avoided.vader
new file mode 100644
index 00000000..41cbe5e0
--- /dev/null
+++ b/test/test_redundant_tsserver_rendering_avoided.vader
@@ -0,0 +1,136 @@
+Before:
+ Save g:ale_buffer_info
+
+ function! CreateError(type, message) abort
+ let l:diagnostics = []
+
+ if !empty(a:message)
+ let l:diagnostics = [{
+ \ 'start': {'line': 1, 'offset': 1},
+ \ 'end': {'line': 1, 'offset':1},
+ \ 'text': a:message,
+ \ 'code': 1005,
+ \}]
+ endif
+
+ return {
+ \ 'seq': 0,
+ \ 'type': 'event',
+ \ 'event': a:type,
+ \ 'body': {'file': expand('%:p'), 'diagnostics': l:diagnostics},
+ \}
+ endfunction
+
+ function! CreateLoclist(message) abort
+ let l:list = []
+
+ if !empty(a:message)
+ let l:list = [{
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'end_lnum': 1,
+ \ 'end_col': 1,
+ \ 'text': a:message,
+ \}]
+ endif
+
+ return l:list
+ endfunction
+
+ call ale#test#SetDirectory('/testplugin/test')
+ call ale#test#SetFilename('filename.ts')
+
+ runtime autoload/ale/engine.vim
+
+ let g:ale_buffer_info = {bufnr(''): {'loclist': []}}
+ let g:ale_handle_loclist_called = 0
+
+ function! ale#engine#HandleLoclist(linter_name, buffer, loclist) abort
+ let g:ale_handle_loclist_called = 1
+ endfunction
+
+After:
+ Restore
+
+ delfunction CreateError
+ delfunction CreateLoclist
+
+ call ale#test#RestoreDirectory()
+
+ runtime autoload/ale/engine.vim
+
+Execute(An initial empty list of syntax errors should be ignored):
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
+
+ Assert !g:ale_handle_loclist_called
+
+Execute(An initial list of syntax errors should be handled):
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Subsequent empty lists should be ignored):
+ let g:ale_buffer_info[bufnr('')].syntax_loclist = []
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
+
+ Assert !g:ale_handle_loclist_called
+
+Execute(Empty then non-empty syntax errors should be handled):
+ let g:ale_buffer_info[bufnr('')].syntax_loclist = []
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Non-empty then empty syntax errors should be handled):
+ let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Non-empty then non-empty syntax errors should be handled):
+ let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(An initial empty list of semantic errors should be ignored):
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
+
+ Assert !g:ale_handle_loclist_called
+
+Execute(An initial list of semantic errors should be handled):
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Subsequent empty lists should be ignored):
+ let g:ale_buffer_info[bufnr('')].semantic_loclist = []
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
+
+ Assert !g:ale_handle_loclist_called
+
+Execute(Empty then non-empty semantic errors should be handled):
+ let g:ale_buffer_info[bufnr('')].semantic_loclist = []
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Non-empty then empty semantic errors should be handled):
+ let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
+
+ Assert g:ale_handle_loclist_called
+
+Execute(Non-empty then non-empty semantic errors should be handled):
+ let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
+
+ call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
+
+ Assert g:ale_handle_loclist_called