summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PULL_REQUEST_TEMPLATE.md3
-rw-r--r--README.md5
-rw-r--r--ale_linters/d/dmd.vim2
-rw-r--r--ale_linters/elm/make.vim170
-rw-r--r--ale_linters/nasm/nasm.vim50
-rw-r--r--ale_linters/po/msgfmt.vim22
-rw-r--r--ale_linters/sass/sasslint.vim5
-rw-r--r--ale_linters/scss/sasslint.vim14
-rw-r--r--autoload/ale/balloon.vim33
-rw-r--r--autoload/ale/fix/registry.vim7
-rw-r--r--autoload/ale/fixers/xo.vim23
-rw-r--r--autoload/ale/handlers/gcc.vim2
-rw-r--r--autoload/ale/handlers/sasslint.vim8
-rw-r--r--autoload/ale/hover.vim76
-rw-r--r--autoload/ale/linter.vim3
-rw-r--r--doc/ale-elm.txt2
-rw-r--r--doc/ale-nasm.txt26
-rw-r--r--doc/ale.txt27
-rw-r--r--plugin/ale.vim8
-rw-r--r--test/command_callback/test_nasm_nasm_command_callbacks.vader52
-rw-r--r--test/command_callback/test_sasslint_command_callback.vader12
-rw-r--r--test/elm-test-files/app/node_modules/.bin/elm (renamed from test/elm-test-files/app/node_modules/.bin/elm-make)0
-rw-r--r--test/fix/test_ale_fix_completion_filter.vader14
-rw-r--r--test/handler/test_elmmake_handler.vader246
-rw-r--r--test/handler/test_gcc_handler.vader14
-rw-r--r--test/handler/test_msgfmt_hander.vader24
-rw-r--r--test/handler/test_nasm_handler.vader30
-rw-r--r--test/smoke_test.vader2
-rw-r--r--test/test_ale_toggle.vader10
-rw-r--r--test/test_elm_executable_detection.vader8
30 files changed, 800 insertions, 98 deletions
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
index 94116532..e1ca94f6 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -12,7 +12,8 @@ READ THIS: Before creating a pull request, please consider the following first.
that ALE can work with, please add Vader tests for them. Look at existing
tests in the test/handler directory, etc.
* If you add or modify a function for computing a command line string for
- running a command, please add Vader tests for that.
+ running a command, please add Vader tests for that. Look at existing
+ tests in the test/command_callback directory, etc.
* Generally try and cover anything with Vader tests, although some things just
can't be tested with Vader, or at least they can be hard to test. Consider
breaking up your code so that some parts can be tested, and generally open up
diff --git a/README.md b/README.md
index 1183ad9a..0c3aba77 100644
--- a/README.md
+++ b/README.md
@@ -138,6 +138,7 @@ formatting.
| Markdown | [alex](https://github.com/wooorm/alex) !!, [markdownlint](https://github.com/DavidAnson/markdownlint) !!, [mdl](https://github.com/mivok/markdownlint), [prettier](https://github.com/prettier/prettier), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| Mercury | [mmc](http://mercurylang.org) !! |
+| NASM | [nasm](https://www.nasm.us/) !! |
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
@@ -515,6 +516,8 @@ There are 3 global options that allow customizing the echoed message.
- `g:ale_echo_msg_format` where:
* `%s` is the error message itself
+ * `%...code...%` is an optional error code, and most characters can be
+ written between the `%` characters.
* `%linter%` is the linter name
* `%severity` is the severity type
- `g:ale_echo_msg_error_str` is the string used for error severity.
@@ -532,6 +535,8 @@ Will give you:
![Echoed message](img/echo.png)
+See `:help g:ale_echo_msg_format` for more information.
+
<a name="faq-autocmd"></a>
### 5.viii. How can I execute some code when ALE starts or stops linting?
diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim
index b91238ae..d64b6c3d 100644
--- a/ale_linters/d/dmd.vim
+++ b/ale_linters/d/dmd.vim
@@ -46,7 +46,7 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
endif
endfor
- return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t'
+ return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
endfunction
function! ale_linters#d#dmd#Handle(buffer, lines) abort
diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim
index a665cef4..cc14fe4e 100644
--- a/ale_linters/elm/make.vim
+++ b/ale_linters/elm/make.vim
@@ -1,45 +1,26 @@
-" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod
+" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
-call ale#Set('elm_make_executable', 'elm-make')
+call ale#Set('elm_make_executable', 'elm')
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#elm#make#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'elm_make', [
- \ 'node_modules/.bin/elm-make',
+ \ 'node_modules/.bin/elm',
\])
endfunction
function! ale_linters#elm#make#Handle(buffer, lines) abort
let l:output = []
- let l:is_windows = has('win32')
- let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
let l:unparsed_lines = []
- for l:line in a:lines
- if l:line[0] is# '['
- let l:errors = json_decode(l:line)
-
- for l:error in l:errors
- " Check if file is from the temp directory.
- " Filters out any errors not related to the buffer.
- if l:is_windows
- let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir
- else
- let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir
- endif
- if l:file_is_buffer
- call add(l:output, {
- \ 'lnum': l:error.region.start.line,
- \ 'col': l:error.region.start.column,
- \ 'end_lnum': l:error.region.end.line,
- \ 'end_col': l:error.region.end.column,
- \ 'type': (l:error.type is? 'error') ? 'E' : 'W',
- \ 'text': l:error.overview,
- \ 'detail': l:error.overview . "\n\n" . l:error.details
- \})
- endif
- endfor
+ for l:line in a:lines
+ if l:line[0] is# '{'
+ " Elm 0.19
+ call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
+ elseif l:line[0] is# '['
+ " Elm 0.18
+ call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
elseif l:line isnot# 'Successfully generated /dev/null'
call add(l:unparsed_lines, l:line)
endif
@@ -57,23 +38,142 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
return l:output
endfunction
+function! ale_linters#elm#make#HandleElm019Line(line, output) abort
+ let l:report = json_decode(a:line)
+
+ if l:report.type is? 'error'
+ " General problem
+ let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
+
+ if empty(l:report.path)
+ let l:report.path = 'Elm'
+ endif
+
+ if ale_linters#elm#make#FileIsBuffer(l:report.path)
+ call add(a:output, {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': l:details,
+ \})
+ else
+ call add(a:output, {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': l:report.path .' - '. l:details,
+ \ 'detail': l:report.path ." ----------\n\n". l:details,
+ \})
+ endif
+ else
+ " Compilation errors
+ for l:error in l:report.errors
+ let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
+
+ for l:problem in l:error.problems
+ let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
+
+ if l:file_is_buffer
+ " Buffer module has problems
+ call add(a:output, {
+ \ 'lnum': l:problem.region.start.line,
+ \ 'col': l:problem.region.start.column,
+ \ 'end_lnum': l:problem.region.end.line,
+ \ 'end_col': l:problem.region.end.column,
+ \ 'type': 'E',
+ \ 'text': l:details,
+ \})
+ else
+ " Imported module has problems
+ let l:location = l:error.path .':'. l:problem.region.start.line
+ call add(a:output, {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': l:location .' - '. l:details,
+ \ 'detail': l:location ." ----------\n\n". l:details,
+ \})
+ endif
+ endfor
+ endfor
+ endif
+endfunction
+
+function! ale_linters#elm#make#HandleElm018Line(line, output) abort
+ let l:errors = json_decode(a:line)
+
+ for l:error in l:errors
+ let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
+
+ if l:file_is_buffer
+ " Current buffer has problems
+ call add(a:output, {
+ \ 'lnum': l:error.region.start.line,
+ \ 'col': l:error.region.start.column,
+ \ 'end_lnum': l:error.region.end.line,
+ \ 'end_col': l:error.region.end.column,
+ \ 'type': (l:error.type is? 'error') ? 'E' : 'W',
+ \ 'text': l:error.overview,
+ \ 'detail': l:error.overview . "\n\n" . l:error.details
+ \})
+ elseif l:error.type is? 'error'
+ " Imported module has errors
+ let l:location = l:error.file .':'. l:error.region.start.line
+
+ call add(a:output, {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': l:location .' - '. l:error.overview,
+ \ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
+ \})
+ endif
+ endfor
+endfunction
+
+function! ale_linters#elm#make#FileIsBuffer(path) abort
+ let l:is_windows = has('win32')
+ let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
+
+ if has('win32')
+ return a:path[0:len(l:temp_dir) - 1] is? l:temp_dir
+ else
+ return a:path[0:len(l:temp_dir) - 1] is# l:temp_dir
+ endif
+endfunction
+
+function! ale_linters#elm#make#ParseMessage(message) abort
+ return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
+endfunction
+
+function! ale_linters#elm#make#ParseMessageItem(item) abort
+ if type(a:item) == type('')
+ return a:item
+ else
+ return a:item.string
+ endif
+endfunction
+
" Return the command to execute the linter in the projects directory.
" If it doesn't, then this will fail when imports are needed.
function! ale_linters#elm#make#GetCommand(buffer) abort
- let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
+ let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
- if empty(l:elm_package)
+
+ if empty(l:elm_json)
+ " Fallback to Elm 0.18
+ let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
+ endif
+
+ if empty(l:elm_json)
let l:dir_set_cmd = ''
else
- let l:root_dir = fnamemodify(l:elm_package, ':p:h')
+ let l:root_dir = fnamemodify(l:elm_json, ':p:h')
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
endif
- " The elm-make compiler, at the time of this writing, uses '/dev/null' as
+ " The elm compiler, at the time of this writing, uses '/dev/null' as
" a sort of flag to tell the compiler not to generate an output file,
- " which is why this is hard coded here. It does not use NUL on Windows.
- " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
+ " which is why this is hard coded here.
+ " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
let l:elm_cmd = ale#Escape(l:elm_exe)
+ \ . ' make'
\ . ' --report=json'
\ . ' --output=/dev/null'
diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim
new file mode 100644
index 00000000..f4b2ca4b
--- /dev/null
+++ b/ale_linters/nasm/nasm.vim
@@ -0,0 +1,50 @@
+" Author: Oyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>
+" Description: NASM linter for asmsyntax nasm.
+
+call ale#Set('nasm_nasm_executable', 'nasm')
+call ale#Set('nasm_nasm_options', '')
+
+function! ale_linters#nasm#nasm#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'nasm_nasm_executable')
+endfunction
+
+function! ale_linters#nasm#nasm#GetOptions(buffer) abort
+ return ale#Var(a:buffer, 'nasm_nasm_options')
+endfunction
+
+function! ale_linters#nasm#nasm#GetCommand(buffer) abort
+ " Note that NASM require a trailing slash to the -I option.
+ let l:executable = ale#Escape(ale_linters#nasm#nasm#GetExecutable(a:buffer))
+ let l:separator = has('win32') ? '\' : '/'
+ let l:path = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h') . l:separator)
+ let l:options = ale_linters#nasm#nasm#GetOptions(a:buffer)
+
+ return l:executable
+ \ . ' -X gnu'
+ \ . ' -I ' . l:path
+ \ . ' ' . l:options
+ \ . ' %s'
+endfunction
+
+function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
+ " Note that we treat 'fatal' as errors.
+ let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
+ let l:output = []
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'type': l:match[2] =~? 'error\|fatal' ? 'E' : 'W',
+ \ 'text': l:match[3],
+ \})
+ endfor
+ return l:output
+endfunction
+
+call ale#linter#Define('nasm', {
+\ 'name': 'nasm',
+\ 'executable': 'nasm',
+\ 'output_stream': 'stderr',
+\ 'lint_file': 1,
+\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
+\ 'callback': 'ale_linters#nasm#nasm#Handle',
+\})
diff --git a/ale_linters/po/msgfmt.vim b/ale_linters/po/msgfmt.vim
index 578792bf..8279ccdc 100644
--- a/ale_linters/po/msgfmt.vim
+++ b/ale_linters/po/msgfmt.vim
@@ -1,10 +1,30 @@
" Author: Cian Butler https://github.com/butlerx
" Description: msgfmt for PO files
+function! ale_linters#po#msgfmt#Handle(buffer, lines) abort
+ let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines)
+ let l:index = 0
+
+ for l:item in l:results
+ if l:index > 0 && l:item.text =~? 'this is the location of the first definition'
+ let l:last_item = l:results[l:index - 1]
+
+ if l:last_item.text =~? 'duplicate message definition'
+ let l:last_item.text = 'duplicate of message at line ' . l:item.lnum
+ let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum
+ endif
+ endif
+
+ let l:index += 1
+ endfor
+
+ return l:results
+endfunction
+
call ale#linter#Define('po', {
\ 'name': 'msgfmt',
\ 'executable': 'msgfmt',
\ 'output_stream': 'stderr',
\ 'command': 'msgfmt --statistics --output-file=- %t',
-\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\ 'callback': 'ale_linters#po#msgfmt#Handle',
\})
diff --git a/ale_linters/sass/sasslint.vim b/ale_linters/sass/sasslint.vim
index bbe71255..4df56dfd 100644
--- a/ale_linters/sass/sasslint.vim
+++ b/ale_linters/sass/sasslint.vim
@@ -1,8 +1,9 @@
-" Author: KabbAmine - https://github.com/KabbAmine
+" Author: KabbAmine - https://github.com/KabbAmine,
+" Ben Falconer <ben@falconers.me.uk>
call ale#linter#Define('sass', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
-\ 'command': 'sass-lint -v -q -f compact %t',
+\ 'command_callback': 'ale#handlers#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
diff --git a/ale_linters/scss/sasslint.vim b/ale_linters/scss/sasslint.vim
index bd016465..f6075001 100644
--- a/ale_linters/scss/sasslint.vim
+++ b/ale_linters/scss/sasslint.vim
@@ -1,8 +1,18 @@
-" Author: KabbAmine - https://github.com/KabbAmine
+" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
+" <ben@falconers.me.uk>
+
+function! ale_linters#scss#sasslint#GetCommand(buffer) abort
+ return ale#path#BufferCdString(a:buffer)
+ \ . ale#Escape('sass-lint')
+ \ . ' -v'
+ \ . ' -q'
+ \ . ' -f compact'
+ \ . ' %t'
+endfunction
call ale#linter#Define('scss', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
-\ 'command': 'sass-lint -v -q -f compact %t',
+\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
diff --git a/autoload/ale/balloon.vim b/autoload/ale/balloon.vim
index 552ced82..d49dcbf9 100644
--- a/autoload/ale/balloon.vim
+++ b/autoload/ale/balloon.vim
@@ -12,7 +12,21 @@ function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
- return l:index >= 0 ? l:loclist[l:index].text : ''
+ " Show the diagnostics message if found, 'Hover' output otherwise
+ if l:index >= 0
+ return l:loclist[l:index].text
+ elseif exists('*balloon_show') || getbufvar(
+ \ a:bufnr,
+ \ 'ale_set_balloons_legacy_echo',
+ \ get(g:, 'ale_set_balloons_legacy_echo', 0)
+ \)
+ " Request LSP/tsserver hover information, but only if this version of
+ " Vim supports the balloon_show function, or if we turned a legacy
+ " setting on.
+ call ale#hover#Show(a:bufnr, a:lnum, a:col, {'called_from_balloonexpr': 1})
+ endif
+
+ return ''
endfunction
function! ale#balloon#Expr() abort
@@ -20,9 +34,22 @@ function! ale#balloon#Expr() abort
endfunction
function! ale#balloon#Disable() abort
- set noballooneval balloonexpr=
+ set noballooneval noballoonevalterm
+ set balloonexpr=
endfunction
function! ale#balloon#Enable() abort
- set ballooneval balloonexpr=ale#balloon#Expr()
+ if !has('balloon_eval') && !has('balloon_eval_term')
+ return
+ endif
+
+ if has('balloon_eval')
+ set ballooneval
+ endif
+
+ if has('balloon_eval_term')
+ set balloonevalterm
+ endif
+
+ set balloonexpr=ale#balloon#Expr()
endfunction
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 7e45e6ad..17532b3b 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -190,6 +190,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['perl'],
\ 'description': 'Fix Perl files with perltidy.',
\ },
+\ 'xo': {
+\ 'function': 'ale#fixers#xo#Fix',
+\ 'suggested_filetypes': ['javascript'],
+\ 'description': 'Fix JavaScript files using xo --fix.',
+\ },
\}
" Reset the function registry to the default entries.
@@ -327,7 +332,7 @@ endfunction
" Function that returns autocomplete candidates for ALEFix command
function! ale#fix#registry#CompleteFixers(ArgLead, CmdLine, CursorPos) abort
- return ale#fix#registry#GetApplicableFixers(&filetype)
+ return filter(ale#fix#registry#GetApplicableFixers(&filetype), 'v:val =~? a:ArgLead')
endfunction
" Suggest functions to use from the registry.
diff --git a/autoload/ale/fixers/xo.vim b/autoload/ale/fixers/xo.vim
new file mode 100644
index 00000000..882350be
--- /dev/null
+++ b/autoload/ale/fixers/xo.vim
@@ -0,0 +1,23 @@
+" Author: Albert Marquez - https://github.com/a-marquez
+" Description: Fixing files with XO.
+
+call ale#Set('javascript_xo_executable', 'xo')
+call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('javascript_xo_options', '')
+
+function! ale#fixers#xo#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
+ \ 'node_modules/xo/cli.js',
+ \ 'node_modules/.bin/xo',
+ \])
+endfunction
+
+function! ale#fixers#xo#Fix(buffer) abort
+ let l:executable = ale#fixers#xo#GetExecutable(a:buffer)
+
+ return {
+ \ 'command': ale#node#Executable(a:buffer, l:executable)
+ \ . ' --fix %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/handlers/gcc.vim b/autoload/ale/handlers/gcc.vim
index 9ec7b110..4b53652a 100644
--- a/autoload/ale/handlers/gcc.vim
+++ b/autoload/ale/handlers/gcc.vim
@@ -48,7 +48,7 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort
let l:item = {
\ 'lnum': str2nr(l:match[2]),
- \ 'type': l:match[4] is# 'error' ? 'E' : 'W',
+ \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W',
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
\}
diff --git a/autoload/ale/handlers/sasslint.vim b/autoload/ale/handlers/sasslint.vim
new file mode 100644
index 00000000..399bf47c
--- /dev/null
+++ b/autoload/ale/handlers/sasslint.vim
@@ -0,0 +1,8 @@
+" Author: KabbAmine - https://github.com/KabbAmine,
+" Ben Falconer <ben@falconers.me.uk>
+
+function! ale#handlers#sasslint#GetCommand(buffer) abort
+ return ale#path#BufferCdString(a:buffer)
+ \ . ale#Escape('sass-lint')
+ \ . ' -v -q -f compact %t'
+endfunction
diff --git a/autoload/ale/hover.vim b/autoload/ale/hover.vim
index 12af877d..3bf92488 100644
--- a/autoload/ale/hover.vim
+++ b/autoload/ale/hover.vim
@@ -24,7 +24,13 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
if get(a:response, 'success', v:false) is v:true
\&& get(a:response, 'body', v:null) isnot v:null
- call ale#util#ShowMessage(a:response.body.displayString)
+ if get(l:options, 'hover_from_balloonexpr', 0)
+ \&& exists('*balloon_show')
+ \&& ale#Var(l:options.buffer, 'set_balloons')
+ call balloon_show(a:response.body.displayString)
+ else
+ call ale#util#ShowMessage(a:response.body.displayString)
+ endif
endif
endif
endfunction
@@ -34,15 +40,18 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
\&& has_key(s:hover_map, a:response.id)
let l:options = remove(s:hover_map, a:response.id)
- let l:buffer = bufnr('')
- let [l:line, l:column] = getcurpos()[1:2]
- let l:end = len(getline(l:line))
-
- if l:buffer isnot l:options.buffer
- \|| l:line isnot l:options.line
- \|| min([l:column, l:end]) isnot min([l:options.column, l:end])
- " Cancel display the message if the cursor has moved.
- return
+ " If the call did __not__ come from balloonexpr...
+ if !get(l:options, 'hover_from_balloonexpr', 0)
+ let l:buffer = bufnr('')
+ let [l:line, l:column] = getcurpos()[1:2]
+ let l:end = len(getline(l:line))
+
+ if l:buffer isnot l:options.buffer
+ \|| l:line isnot l:options.line
+ \|| min([l:column, l:end]) isnot min([l:options.column, l:end])
+ " ... Cancel display the message if the cursor has moved.
+ return
+ endif
endif
" The result can be a Dictionary item, a List of the same, or null.
@@ -71,21 +80,24 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
let l:str = substitute(l:str, '^\s*\(.\{-}\)\s*$', '\1', '')
if !empty(l:str)
- call ale#util#ShowMessage(l:str)
+ if get(l:options, 'hover_from_balloonexpr', 0)
+ \&& exists('*balloon_show')
+ \&& ale#Var(l:options.buffer, 'set_balloons')
+ call balloon_show(l:str)
+ else
+ call ale#util#ShowMessage(l:str)
+ endif
endif
endif
endif
endfunction
-function! s:ShowDetails(linter) abort
- let l:buffer = bufnr('')
- let [l:line, l:column] = getcurpos()[1:2]
-
+function! s:ShowDetails(linter, buffer, line, column, opt) abort
let l:Callback = a:linter.lsp is# 'tsserver'
\ ? function('ale#hover#HandleTSServerResponse')
\ : function('ale#hover#HandleLSPResponse')
- let l:lsp_details = ale#linter#StartLSP(l:buffer, a:linter, l:Callback)
+ let l:lsp_details = ale#linter#StartLSP(a:buffer, a:linter, l:Callback)
if empty(l:lsp_details)
return 0
@@ -95,34 +107,46 @@ function! s:ShowDetails(linter) abort
let l:root = l:lsp_details.project_root
if a:linter.lsp is# 'tsserver'
+ let l:column = a:column
+
let l:message = ale#lsp#tsserver_message#Quickinfo(
- \ l:buffer,
- \ l:line,
+ \ a:buffer,
+ \ a:line,
\ l:column
\)
else
" Send a message saying the buffer has changed first, or the
" hover position probably won't make sense.
- call ale#lsp#Send(l:id, ale#lsp#message#DidChange(l:buffer), l:root)
+ call ale#lsp#Send(l:id, ale#lsp#message#DidChange(a:buffer), l:root)
- let l:column = min([l:column, len(getline(l:line))])
+ let l:column = min([a:column, len(getbufline(a:buffer, a:line)[0])])
- let l:message = ale#lsp#message#Hover(l:buffer, l:line, l:column)
+ let l:message = ale#lsp#message#Hover(a:buffer, a:line, l:column)
endif
let l:request_id = ale#lsp#Send(l:id, l:message, l:root)
let s:hover_map[l:request_id] = {
- \ 'buffer': l:buffer,
- \ 'line': l:line,
+ \ 'buffer': a:buffer,
+ \ 'line': a:line,
\ 'column': l:column,
+ \ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0),
\}
endfunction
-function! ale#hover#Show() abort
- for l:linter in ale#linter#Get(&filetype)
+" Obtain Hover information for the specified position
+" Pass optional arguments in the dictionary opt.
+" Currently, only one key/value is useful:
+" - called_from_balloonexpr, this flag marks if we want the result from this
+" ale#hover#Show to display in a balloon if possible
+"
+" Currently, the callbacks displays the info from hover :
+" - in the balloon if opt.called_from_balloonexpr and balloon_show is detected
+" - as status message otherwise
+function! ale#hover#Show(buffer, line, col, opt) abort
+ for l:linter in ale#linter#Get(getbufvar(a:buffer, '&filetype'))
if !empty(l:linter.lsp)
- call s:ShowDetails(l:linter)
+ call s:ShowDetails(l:linter, a:buffer, a:line, a:col, a:opt)
endif
endfor
endfunction
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index 1e0ec304..c791ba46 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -8,11 +8,14 @@ let s:linters = {}
" Default filetype aliases.
" The user defined aliases will be merged with this Dictionary.
+"
+" NOTE: Update the g:ale_linter_aliases documentation when modifying this.
let s:default_ale_linter_aliases = {
\ 'Dockerfile': 'dockerfile',
\ 'csh': 'sh',
\ 'plaintex': 'tex',
\ 'systemverilog': 'verilog',
+\ 'vimwiki': 'markdown',
\ 'zsh': 'sh',
\}
diff --git a/doc/ale-elm.txt b/doc/ale-elm.txt
index 32beab7b..de7d8939 100644
--- a/doc/ale-elm.txt
+++ b/doc/ale-elm.txt
@@ -34,7 +34,7 @@ elm-make *ale-elm-elm-make*
g:ale_elm_make_executable *g:ale_elm_make_executable*
*b:ale_elm_make_executable*
Type: |String|
- Default: `'elm-make'`
+ Default: `'elm'`
See |ale-integrations-local-executables|
diff --git a/doc/ale-nasm.txt b/doc/ale-nasm.txt
new file mode 100644
index 00000000..16c024a1
--- /dev/null
+++ b/doc/ale-nasm.txt
@@ -0,0 +1,26 @@
+===============================================================================
+ALE NASM Integration *ale-nasm-options*
+
+
+===============================================================================
+nasm *ale-nasm-nasm*
+
+g:ale_nasm_nasm_executable *g:ale_nasm_nasm_executable*
+ *b:ale_nasm_nasm_executable*
+
+ Type: |String|
+ Default `'nasm'`
+
+ This variable can be changed to use different executable for NASM.
+
+
+g:ale_nasm_nasm_options *g:ale_nasm_nasm_options*
+ *b:ale_nasm_nasm_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to NASM.
+
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale.txt b/doc/ale.txt
index 4a926386..8a75ec11 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -145,6 +145,8 @@ CONTENTS *ale-contents*
write-good..........................|ale-markdown-write-good|
mercury...............................|ale-mercury-options|
mmc.................................|ale-mercury-mmc|
+ nasm..................................|ale-nasm-options|
+ nasm................................|ale-nasm-nasm|
nroff.................................|ale-nroff-options|
write-good..........................|ale-nroff-write-good|
objc..................................|ale-objc-options|
@@ -360,6 +362,7 @@ Notes:
* Markdown: `alex`!!, `markdownlint`!!, `mdl`, `prettier`, `proselint`, `redpen`, `remark-lint`, `textlint`, `vale`, `write-good`
* MATLAB: `mlint`
* Mercury: `mmc`!!
+* NASM: `nasm`!!
* Nim: `nim check`!!
* nix: `nix-instantiate`
* nroff: `alex`!!, `proselint`, `write-good`
@@ -1106,8 +1109,12 @@ g:ale_linter_aliases *g:ale_linter_aliases*
following values: >
{
- \ 'zsh': 'sh',
+ \ 'Dockerfile': 'dockerfile',
\ 'csh': 'sh',
+ \ 'plaintex': 'tex',
+ \ 'systemverilog': 'verilog',
+ \ 'vimwiki': 'markdown',
+ \ 'zsh': 'sh',
\}
<
For example, if you wish to map a new filetype `'foobar'` to run the `'php'`
@@ -1347,7 +1354,8 @@ g:ale_set_balloons *g:ale_set_balloons*
*b:ale_set_balloons*
Type: |Number|
- Default: `has('balloon_eval')`
+ Default: `has('balloon_eval') && has('gui_running') ||`
+ `has('balloon_eval_term') && !has('gui_running')`
When this option is set to `1`, balloon messages will be displayed for
problems. Problems nearest to the cursor on the line the cursor is over will
@@ -1359,6 +1367,21 @@ g:ale_set_balloons *g:ale_set_balloons*
globally.
+g:ale_set_balloons_legacy_echo *g:ale_set_balloons_legacy_echo*
+ *b:ale_set_balloons_legacy_echo*
+ Type: |Number|
+ Default: undefined
+
+ If set to `1`, moving your mouse over documents in Vim will make ALE ask
+ `tsserver` or `LSP` servers for information about the symbol where the mouse
+ cursor is, and print that information into Vim's echo line. This is an
+ option for supporting older versions of Vim which do not properly support
+ balloons in an asynchronous manner.
+
+ If your version of Vim supports the |balloon_show| function, then this
+ option does nothing meaningful.
+
+
g:ale_set_highlights *g:ale_set_highlights*
Type: |Number|
diff --git a/plugin/ale.vim b/plugin/ale.vim
index d59ffd6b..48ff531c 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -174,7 +174,10 @@ let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
" This flag can be set to 0 to disable balloon support.
-call ale#Set('set_balloons', has('balloon_eval'))
+call ale#Set('set_balloons',
+\ has('balloon_eval') && has('gui_running') ||
+\ has('balloon_eval_term') && !has('gui_running')
+\)
" A deprecated setting for ale#statusline#Status()
" See :help ale#statusline#Count() for getting status reports.
@@ -275,7 +278,8 @@ command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1
command! -bar ALEFindReferences :call ale#references#Find()
" Get information for the cursor.
-command! -bar ALEHover :call ale#hover#Show()
+command! -bar ALEHover :call ale#hover#Show(bufnr(''), getcurpos()[1],
+ \ getcurpos()[2], {})
" <Plug> mappings for commands
nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return>
diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader
new file mode 100644
index 00000000..5053e536
--- /dev/null
+++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader
@@ -0,0 +1,52 @@
+Before:
+ Save g:ale_nasm_nasm_executable
+ Save g:ale_nasm_nasm_options
+
+ unlet! g:ale_nasm_nasm_executable
+ unlet! b:ale_nasm_nasm_executable
+ unlet! g:ale_nasm_nasm_options
+ unlet! b:ale_nasm_nasm_options
+
+ runtime ale_linters/nasm/nasm.vim
+
+ let b:command_tail =
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
+ let b:command_tail_opt =
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'
+
+After:
+ Restore
+ unlet! b:command_tail
+ unlet! b:command_tail_opt
+ unlet! b:ale_nasm_nasm_executable
+ unlet! b:ale_nasm_nasm_options
+ call ale#linter#Reset()
+
+Execute(The executable should be configurable):
+ AssertEqual 'nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
+
+ let b:ale_nasm_nasm_executable = '/opt/nasm/nasm'
+
+ AssertEqual '/opt/nasm/nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
+
+Execute(The executable should be used in the command):
+ AssertEqual
+ \ ale#Escape('nasm') . b:command_tail,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
+
+ let b:ale_nasm_nasm_executable = '~/nasm'
+
+ AssertEqual
+ \ ale#Escape('~/nasm') . b:command_tail,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
+
+Execute(The options should be configurable):
+ AssertEqual '', ale_linters#nasm#nasm#GetOptions(bufnr(''))
+ let b:ale_nasm_nasm_options = '-w-macro-params'
+ AssertEqual '-w-macro-params', ale_linters#nasm#nasm#GetOptions(bufnr(''))
+
+Execute(The options should be used in command):
+ let b:ale_nasm_nasm_options = '-w+orphan-labels'
+ AssertEqual
+ \ ale#Escape('nasm') . b:command_tail_opt,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_sasslint_command_callback.vader b/test/command_callback/test_sasslint_command_callback.vader
new file mode 100644
index 00000000..1db7e5fb
--- /dev/null
+++ b/test/command_callback/test_sasslint_command_callback.vader
@@ -0,0 +1,12 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('test.sass')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(The default sasslint command should be correct):
+ AssertEqual
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('sass-lint') . ' -v -q -f compact %t',
+ \ ale#handlers#sasslint#GetCommand(bufnr(''))
diff --git a/test/elm-test-files/app/node_modules/.bin/elm-make b/test/elm-test-files/app/node_modules/.bin/elm
index e69de29b..e69de29b 100644
--- a/test/elm-test-files/app/node_modules/.bin/elm-make
+++ b/test/elm-test-files/app/node_modules/.bin/elm
diff --git a/test/fix/test_ale_fix_completion_filter.vader b/test/fix/test_ale_fix_completion_filter.vader
new file mode 100644
index 00000000..536b7138
--- /dev/null
+++ b/test/fix/test_ale_fix_completion_filter.vader
@@ -0,0 +1,14 @@
+Before:
+ call ale#fix#registry#Clear()
+ call ale#test#SetFilename('test.js')
+ call ale#fix#registry#Add('prettier', '', ['javascript'], 'prettier')
+ call ale#fix#registry#Add('eslint', '', ['javascript'], 'eslint')
+ setfiletype javascript
+
+Execute(completeFixers returns all of the applicable fixers without an arglead):
+ AssertEqual ['eslint', 'prettier'],
+ \ ale#fix#registry#CompleteFixers('', 'ALEFix ', 7)
+
+Execute(completeFixers returns all of the applicable fixers without an arglead):
+ AssertEqual ['prettier'],
+ \ ale#fix#registry#CompleteFixers('pre', 'ALEFix ', 10)
diff --git a/test/handler/test_elmmake_handler.vader b/test/handler/test_elmmake_handler.vader
index f3424b4b..41c9646f 100644
--- a/test/handler/test_elmmake_handler.vader
+++ b/test/handler/test_elmmake_handler.vader
@@ -9,7 +9,139 @@ After:
call ale#linter#Reset()
-Execute(The elm-make handler should parse lines correctly):
+
+" Elm 0.19
+
+Execute(The elm-make handler should parse Elm 0.19 general problems correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "error details\n\nstyled details"
+ \ }
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '{
+ \ "type": "error",
+ \ "path": "' . b:tmp . '/Module.elm",
+ \ "title": "UNKNOWN IMPORT",
+ \ "message": ["error details\n\n", { "string": "styled details" }]
+ \ }'
+ \ ])
+
+Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 404,
+ \ 'col': 1,
+ \ 'end_lnum': 408,
+ \ 'end_col': 18,
+ \ 'type': 'E',
+ \ 'text': "error details 1\n\nstyled details"
+ \ },
+ \ {
+ \ 'lnum': 406,
+ \ 'col': 5,
+ \ 'end_lnum': 407,
+ \ 'end_col': 17,
+ \ 'type': 'E',
+ \ 'text': "error details 2",
+ \ },
+ \ {
+ \ 'lnum': 406,
+ \ 'col': 5,
+ \ 'end_lnum': 406,
+ \ 'end_col': 93,
+ \ 'type': 'E',
+ \ 'text': "error details 3",
+ \ },
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '{
+ \ "type": "compile-errors",
+ \ "errors": [
+ \ {
+ \ "path": "' . b:tmp . '/Module.elm",
+ \ "problems": [
+ \ {
+ \ "title": "TYPE MISMATCH",
+ \ "message": ["error details 1\n\n", { "string": "styled details" }],
+ \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ },
+ \ {
+ \ "title": "TYPE MISMATCH",
+ \ "message": ["error details 2"],
+ \ "region": { "start": {"line": 406, "column": 5}, "end": {"line": 407, "column": 17 } }
+ \ },
+ \ {
+ \ "title": "TYPE MISMATCH",
+ \ "message": ["error details 3"],
+ \ "region": { "start": { "line": 406, "column": 5}, "end": {"line": 406, "column": 93 } }
+ \ }
+ \ ]
+ \ }
+ \ ]
+ \ }'
+ \ ])
+
+Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "src/Module.elm - error details\n\nstyled details",
+ \ 'detail': "src/Module.elm ----------\n\nerror details\n\nstyled details"
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "Elm - error details\n\nstyled details",
+ \ 'detail': "Elm ----------\n\nerror details\n\nstyled details"
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "src/Module.elm:404 - error details\n\nstyled details",
+ \ 'detail': "src/Module.elm:404 ----------\n\nerror details\n\nstyled details"
+ \ },
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '{
+ \ "type": "error",
+ \ "path": "src/Module.elm",
+ \ "title": "UNKNOWN IMPORT",
+ \ "message": ["error details\n\n", { "string": "styled details" }]
+ \ }',
+ \ '{
+ \ "type": "error",
+ \ "path": null,
+ \ "title": "UNKNOWN IMPORT",
+ \ "message": ["error details\n\n", { "string": "styled details" }]
+ \ }',
+ \ '{
+ \ "type": "compile-errors",
+ \ "errors": [
+ \ {
+ \ "path": "src/Module.elm",
+ \ "problems": [
+ \ {
+ \ "title": "TYPE MISMATCH",
+ \ "message": ["error details\n\n", { "string": "styled details" }],
+ \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ }
+ \ ]
+ \ }
+ \ ]
+ \ }'
+ \ ])
+
+
+" Elm 0.18
+
+Execute(The elm-make handler should parse Elm 0.18 compilation errors correctly):
AssertEqual
\ [
\ {
@@ -50,21 +182,90 @@ Execute(The elm-make handler should parse lines correctly):
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '[{"tag":"unused import","overview":"warning overview","details":"warning details","region":{"start":{"line":33,"column":1},"end":{"line":33,"column":19}},"type":"warning","file":"' . b:tmp . 'Module.elm"}]',
- \ '[{"tag":"TYPE MISMATCH","overview":"error overview 1","subregion":{"start":{"line":406,"column":5},"end":{"line":408,"column":18}},"details":"error details 1","region":{"start":{"line":404,"column":1},"end":{"line":408,"column":18}},"type":"error","file":"' . b:tmp . 'Module.elm"},{"tag":"TYPE MISMATCH","overview":"error overview 2","subregion":{"start":{"line":407,"column":12},"end":{"line":407,"column":17}},"details":"error details 2","region":{"start":{"line":406,"column":5},"end":{"line":407,"column":17}},"type":"error","file":"' . b:tmp . 'Module.elm"},{"tag":"TYPE MISMATCH","overview":"error overview 3","subregion":{"start":{"line":406,"column":88},"end":{"line":406,"column":93}},"details":"error details 3","region":{"start":{"line":406,"column":5},"end":{"line":406,"column":93}},"type":"error","file":"' . b:tmp . 'Module.elm"}]'
+ \ '[
+ \ {
+ \ "tag": "unused import",
+ \ "overview": "warning overview",
+ \ "details": "warning details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "warning",
+ \ "file": "' . b:tmp . '/Module.elm"
+ \ }
+ \ ]',
+ \ '[
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 1",
+ \ "subregion": { "start": { "line": 406, "column": 5 }, "end": { "line": 408, "column": 18 } },
+ \ "details": "error details 1",
+ \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } },
+ \ "type": "error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ },
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 2",
+ \ "subregion": { "start": { "line": 407, "column": 12 }, "end": { "line": 407, "column": 17 } },
+ \ "details": "error details 2",
+ \ "region": { "start": { "line": 406, "column": 5}, "end": { "line": 407, "column": 17 } },
+ \ "type":"error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ },
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 3",
+ \ "subregion": { "start": { "line": 406, "column": 88 }, "end": { "line": 406, "column": 93 } },
+ \ "details": "error details 3",
+ \ "region": { "start": { "line": 406, "column": 5 }, "end": { "line": 406, "column": 93 } },
+ \ "type":"error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ }
+ \ ]'
\ ])
+Execute(The elm-make handler should handle errors in Elm 0.18 imported modules):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "src/Module.elm:33 - error overview",
+ \ 'detail': "src/Module.elm:33 ----------\n\nerror overview\n\nerror details"
+ \ }
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '[
+ \ {
+ \ "tag": "unused import",
+ \ "overview": "warning overview",
+ \ "details": "warning details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "warning",
+ \ "file": "src/Module.elm"
+ \ },
+ \ {
+ \ "tag": "type error",
+ \ "overview": "error overview",
+ \ "details": "error details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "error",
+ \ "file": "src/Module.elm"
+ \ }
+ \ ]',
+ \ ])
+
+" Generic
+
Execute(The elm-make handler should put an error on the first line if a line cannot be parsed):
AssertEqual
\ [
\ {
- \ 'lnum': 33,
+ \ 'lnum': 404,
\ 'col': 1,
- \ 'end_lnum': 33,
- \ 'end_col': 19,
- \ 'type': 'W',
- \ 'text': 'warning overview',
- \ 'detail': "warning overview\n\nwarning details",
+ \ 'end_lnum': 408,
+ \ 'end_col': 18,
+ \ 'type': 'E',
+ \ 'text': "error details 1\n\nstyled details"
\ },
\ {
\ 'lnum': 1,
@@ -74,7 +275,28 @@ Execute(The elm-make handler should put an error on the first line if a line can
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '[{"tag":"unused import","overview":"warning overview","details":"warning details","region":{"start":{"line":33,"column":1},"end":{"line":33,"column":19}},"type":"warning","file":"' . b:tmp . 'Module.elm"}]',
- \ "Not JSON",
- \ "Also not JSON",
+ \ '{
+ \ "type": "compile-errors",
+ \ "errors": [
+ \ {
+ \ "path": "' . b:tmp . '/Module.elm",
+ \ "problems": [
+ \ {
+ \ "title": "TYPE MISMATCH",
+ \ "message": ["error details 1\n\n", { "string": "styled details" }],
+ \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ }
+ \ ]
+ \ }
+ \ ]
+ \ }',
+ \ 'Not JSON',
+ \ 'Also not JSON',
+ \ ])
+
+Execute(The elm-make handler should ignore success lines):
+ AssertEqual
+ \ [],
+ \ ale_linters#elm#make#Handle(347, [
+ \ 'Successfully generated /dev/null',
\ ])
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
index 79f17899..678d3f42 100644
--- a/test/handler/test_gcc_handler.vader
+++ b/test/handler/test_gcc_handler.vader
@@ -148,3 +148,17 @@ Execute(The GCC handler should interpret - as being the current file):
\ ale#handlers#gcc#HandleGCCFormat(347, [
\ '-:6:12: error: Some error',
\ ])
+
+Execute(The GCC handler should handle fatal error messages due to missing files):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 12,
+ \ 'type': 'E',
+ \ 'text': 'foo.h: No such file or directory'
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ '<stdin>:3:12: fatal error: foo.h: No such file or directory',
+ \ ])
diff --git a/test/handler/test_msgfmt_hander.vader b/test/handler/test_msgfmt_hander.vader
new file mode 100644
index 00000000..1a67dbc6
--- /dev/null
+++ b/test/handler/test_msgfmt_hander.vader
@@ -0,0 +1,24 @@
+Before:
+ runtime ale_linters/po/msgfmt.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(Duplicate messages should be made easier to navigate):
+ AssertEqual
+ \ [
+ \ {'lnum': 14, 'col': 0, 'type': 'W', 'text': 'some other thing'},
+ \ {'lnum': 1746, 'col': 0, 'type': 'W', 'text': 'duplicate of message at line 262'},
+ \ {'lnum': 262, 'col': 0, 'type': 'W', 'text': 'first location of duplicate of message at line 1746'},
+ \ {'lnum': 666, 'col': 0, 'type': 'W', 'text': 'duplicate message definition...'},
+ \ {'lnum': 888, 'col': 0, 'type': 'W', 'text': 'some other thing'},
+ \ {'lnum': 999, 'col': 0, 'type': 'W', 'text': '...this is the location of the first definition'},
+ \ ],
+ \ ale_linters#po#msgfmt#Handle(bufnr(''), [
+ \ '/tmp/v6GMUFf/16/foo.po:14: some other thing',
+ \ '/tmp/v6GMUFf/16/foo.po:1746: duplicate message definition...',
+ \ '/tmp/v6GMUFf/16/foo.po:262: ...this is the location of the first definition',
+ \ '/tmp/v6GMUFf/16/foo.po:666: duplicate message definition...',
+ \ '/tmp/v6GMUFf/16/foo.po:888: some other thing',
+ \ '/tmp/v6GMUFf/16/foo.po:999: ...this is the location of the first definition',
+ \ ])
diff --git a/test/handler/test_nasm_handler.vader b/test/handler/test_nasm_handler.vader
new file mode 100644
index 00000000..9c7d9650
--- /dev/null
+++ b/test/handler/test_nasm_handler.vader
@@ -0,0 +1,30 @@
+Before:
+ runtime ale_linters/nasm/nasm.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The nasm handler should parse GCC style output from nasm correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'text': "label alone on a line without a colon might be in error",
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'text': "invalid combination of opcode and operands",
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 7,
+ \ 'text': "unable to open include file `bar.asm'",
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#nasm#nasm#Handle(bufnr(''), [
+ \ "tmp.asm:2: warning: label alone on a line without a colon might be in error",
+ \ "tmp.asm:4: error: invalid combination of opcode and operands",
+ \ "tmp.asm:7: fatal: unable to open include file `bar.asm'"
+ \ ])
diff --git a/test/smoke_test.vader b/test/smoke_test.vader
index f6d0be56..843bddab 100644
--- a/test/smoke_test.vader
+++ b/test/smoke_test.vader
@@ -93,7 +93,7 @@ Execute(Linters should run in PowerShell too):
\})
call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ call ale#engine#WaitForJobs(4000)
AssertEqual [
\ {
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index ca8b25d5..427000b6 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -12,7 +12,9 @@ Before:
let g:ale_run_synchronously = 1
let g:ale_pattern_options = {}
let g:ale_pattern_options_enabled = 1
- let g:ale_set_balloons = has('balloon_eval')
+ let g:ale_set_balloons =
+ \ has('balloon_eval') && has('gui_running') ||
+ \ has('balloon_eval_term') && !has('gui_running')
unlet! b:ale_enabled
@@ -349,7 +351,8 @@ Execute(ALEResetBuffer should reset everything for a buffer):
Execute(Disabling ALE should disable balloons):
" These tests won't run in the console, but we can run them manually in GVim.
- if has('balloon_eval')
+ if has('balloon_eval') && has('gui_running') ||
+ \ has('balloon_eval_term') && !has('gui_running')
call ale#linter#Reset()
" Enable balloons, so we can check the expr value.
@@ -367,7 +370,8 @@ Execute(Disabling ALE should disable balloons):
endif
Execute(Enabling ALE should enable balloons if the setting is on):
- if has('balloon_eval')
+ if has('balloon_eval') && has('gui_running') ||
+ \ has('balloon_eval_term') && !has('gui_running')
call ale#linter#Reset()
call ale#balloon#Disable()
ALEDisable
diff --git a/test/test_elm_executable_detection.vader b/test/test_elm_executable_detection.vader
index 4227cbfa..9146eea6 100644
--- a/test/test_elm_executable_detection.vader
+++ b/test/test_elm_executable_detection.vader
@@ -12,7 +12,7 @@ Execute(should get valid executable with default params):
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
AssertEqual
- \ ale#path#Simplify(g:dir . '/elm-test-files/app/node_modules/.bin/elm-make'),
+ \ ale#path#Simplify(g:dir . '/elm-test-files/app/node_modules/.bin/elm'),
\ ale_linters#elm#make#GetExecutable(bufnr(''))
Execute(should get valid executable with 'use_global' params):
@@ -21,16 +21,16 @@ Execute(should get valid executable with 'use_global' params):
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
AssertEqual
- \ 'elm-make',
+ \ 'elm',
\ ale_linters#elm#make#GetExecutable(bufnr(''))
Execute(should get valid executable with 'use_global' and 'executable' params):
- let g:ale_elm_make_executable = 'other-elm-make'
+ let g:ale_elm_make_executable = 'other-elm'
let g:ale_elm_make_use_global = 1
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
AssertEqual
- \ 'other-elm-make',
+ \ 'other-elm',
\ ale_linters#elm#make#GetExecutable(bufnr(''))