Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bartek thindil Jasicki 2021-01-22 09:45:52 +01:00
commit 42bf5ca911
28 changed files with 358 additions and 55 deletions

View file

@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
\ }) \ })
endfor endfor
for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)')
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'col': l:match[3] + 0,
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': 'E',
\ })
endfor
return l:output return l:output
endfunction endfunction
function! ale_linters#dafny#dafny#GetCommand(buffer) abort
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
endfunction
call ale#Set('dafny_dafny_timelimit', 10)
call ale#linter#Define('dafny', { call ale#linter#Define('dafny', {
\ 'name': 'dafny', \ 'name': 'dafny',
\ 'executable': 'dafny', \ 'executable': 'dafny',
\ 'command': 'dafny %s /compile:0', \ 'command': function('ale_linters#dafny#dafny#GetCommand'),
\ 'callback': 'ale_linters#dafny#dafny#Handle', \ 'callback': 'ale_linters#dafny#dafny#Handle',
\ 'lint_file': 1, \ 'lint_file': 1,
\ }) \ })

View file

@ -45,6 +45,16 @@ function! ale_linters#elixir#credo#GetMode() abort
endif endif
endfunction endfunction
function! ale_linters#elixir#credo#GetConfigFile() abort
let l:config_file = get(g:, 'ale_elixir_credo_config_file', '')
if empty(l:config_file)
return ''
endif
return ' --config-file ' . l:config_file
endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort function! ale_linters#elixir#credo#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer) let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
let l:mode = ale_linters#elixir#credo#GetMode() let l:mode = ale_linters#elixir#credo#GetMode()
@ -52,6 +62,7 @@ function! ale_linters#elixir#credo#GetCommand(buffer) abort
return ale#path#CdString(l:project_root) return ale#path#CdString(l:project_root)
\ . 'mix help credo && ' \ . 'mix help credo && '
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode() \ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
\ . ale_linters#elixir#credo#GetConfigFile()
\ . ' --format=flycheck --read-from-stdin %s' \ . ' --format=flycheck --read-from-stdin %s'
endfunction endfunction

View file

@ -6,9 +6,9 @@ call ale#Set('julia_executable', 'julia')
function! ale_linters#julia#languageserver#GetCommand(buffer) abort function! ale_linters#julia#languageserver#GetCommand(buffer) abort
let l:julia_executable = ale#Var(a:buffer, 'julia_executable') let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);' let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);'
return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
endfunction endfunction
call ale#linter#Define('julia', { call ale#linter#Define('julia', {

View file

@ -17,7 +17,7 @@ endfunction
call ale#linter#Define('rust', { call ale#linter#Define('rust', {
\ 'name': 'analyzer', \ 'name': 'analyzer',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')}, \ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')},
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, \ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
\ 'command': function('ale_linters#rust#analyzer#GetCommand'), \ 'command': function('ale_linters#rust#analyzer#GetCommand'),
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'), \ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),

View file

@ -152,6 +152,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
\ || stridx(l:option, '-idirafter') == 0 \ || stridx(l:option, '-idirafter') == 0
\ || stridx(l:option, '-iframework') == 0 \ || stridx(l:option, '-iframework') == 0
\ || stridx(l:option, '-include') == 0 \ || stridx(l:option, '-include') == 0
\ || stridx(l:option, '-imacros') == 0
if stridx(l:option, '-I') == 0 && l:option isnot# '-I' if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
let l:arg = join(split(l:option, '\zs')[2:], '') let l:arg = join(split(l:option, '\zs')[2:], '')
let l:option = '-I' let l:option = '-I'

24
autoload/ale/dhall.vim Normal file
View file

@ -0,0 +1,24 @@
" Author: Pat Brisbin <pbrisbin@gmail.com>, toastal <toastal@protonmail.com>
" Description: Functions for working with Dhalls executable
call ale#Set('dhall_executable', 'dhall')
call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('dhall_options', '')
function! ale#dhall#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'dhall_executable')
" Dhall is written in Haskell and commonly installed with Stack
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall')
endfunction
function! ale#dhall#GetExecutableWithOptions(buffer) abort
let l:executable = ale#dhall#GetExecutable(a:buffer)
return l:executable
\ . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
endfunction
function! ale#dhall#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
endfunction

View file

@ -37,6 +37,27 @@ let s:default_registry = {
\ 'suggested_filetypes': ['d'], \ 'suggested_filetypes': ['d'],
\ 'description': 'Fix D files with dfmt.', \ 'description': 'Fix D files with dfmt.',
\ }, \ },
\ 'dhall': {
\ 'function': 'ale#fixers#dhall#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Fix Dhall files with dhall-format.',
\ },
\ 'dhall-format': {
\ 'function': 'ale#fixers#dhall_format#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language',
\ 'aliases': ['dhall'],
\ },
\ 'dhall-freeze': {
\ 'function': 'ale#fixers#dhall_freeze#Freeze',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language',
\ },
\ 'dhall-lint': {
\ 'function': 'ale#fixers#dhall_lint#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
\ },
\ 'fecs': { \ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix', \ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'], \ 'suggested_filetypes': ['javascript', 'css', 'html'],
@ -342,7 +363,7 @@ let s:default_registry = {
\ }, \ },
\ 'ktlint': { \ 'ktlint': {
\ 'function': 'ale#fixers#ktlint#Fix', \ 'function': 'ale#fixers#ktlint#Fix',
\ 'suggested_filetypes': ['kt'], \ 'suggested_filetypes': ['kt', 'kotlin'],
\ 'description': 'Fix Kotlin files with ktlint.', \ 'description': 'Fix Kotlin files with ktlint.',
\ }, \ },
\ 'styler': { \ 'styler': {
@ -390,16 +411,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['lua'], \ 'suggested_filetypes': ['lua'],
\ 'description': 'Fix Lua files with luafmt.', \ 'description': 'Fix Lua files with luafmt.',
\ }, \ },
\ 'dhall': {
\ 'function': 'ale#fixers#dhall#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Fix Dhall files with dhall-format.',
\ },
\ 'ormolu': { \ 'ormolu': {
\ 'function': 'ale#fixers#ormolu#Fix', \ 'function': 'ale#fixers#ormolu#Fix',
\ 'suggested_filetypes': ['haskell'], \ 'suggested_filetypes': ['haskell'],
\ 'description': 'A formatter for Haskell source code.', \ 'description': 'A formatter for Haskell source code.',
\ }, \ }
\} \}
" Reset the function registry to the default entries. " Reset the function registry to the default entries.

View file

@ -1,23 +0,0 @@
" Author: Pat Brisbin <pbrisbin@gmail.com>
" Description: Integration of dhall-format with ALE.
call ale#Set('dhall_format_executable', 'dhall')
function! ale#fixers#dhall#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'dhall_format_executable')
" Dhall is written in Haskell and commonly installed with Stack
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall')
endfunction
function! ale#fixers#dhall#Fix(buffer) abort
let l:executable = ale#fixers#dhall#GetExecutable(a:buffer)
return {
\ 'command': l:executable
\ . ' format'
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -0,0 +1,14 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls built-in formatter
"
function! ale#fixers#dhall_format#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' format'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -0,0 +1,18 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls package freezing
call ale#Set('dhall_freeze_options', '')
function! ale#fixers#dhall_freeze#Freeze(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' freeze'
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -0,0 +1,14 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls built-in linter/formatter
function! ale#fixers#dhall_lint#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' lint'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -85,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif endif
let l:info.syntax_loclist = l:thislist let l:info.syntax_loclist = l:thislist
else elseif a:error_type is# 'semantic'
if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0 if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0
let l:no_changes = 1 let l:no_changes = 1
endif endif
let l:info.semantic_loclist = l:thislist let l:info.semantic_loclist = l:thislist
else
if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0
let l:no_changes = 1
endif
let l:info.suggestion_loclist = l:thislist
endif endif
if l:no_changes if l:no_changes
@ -98,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif endif
let l:loclist = get(l:info, 'semantic_loclist', []) let l:loclist = get(l:info, 'semantic_loclist', [])
\ + get(l:info, 'suggestion_loclist', [])
\ + get(l:info, 'syntax_loclist', []) \ + get(l:info, 'syntax_loclist', [])
call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0) call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0)
@ -150,6 +157,10 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
elseif get(a:response, 'type', '') is# 'event' elseif get(a:response, 'type', '') is# 'event'
\&& get(a:response, 'event', '') is# 'syntaxDiag' \&& get(a:response, 'event', '') is# 'syntaxDiag'
call s:HandleTSServerDiagnostics(a:response, 'syntax') call s:HandleTSServerDiagnostics(a:response, 'syntax')
elseif get(a:response, 'type', '') is# 'event'
\&& get(a:response, 'event', '') is# 'suggestionDiag'
\&& get(g:, 'ale_lsp_suggestions', '1') == 1
call s:HandleTSServerDiagnostics(a:response, 'suggestion')
endif endif
endfunction endfunction

16
doc/ale-dafny.txt Normal file
View file

@ -0,0 +1,16 @@
===============================================================================
ALE Dafny Integration *ale-dafny-options*
===============================================================================
dafny *ale-dafny-dafny*
g:ale_dafny_dafny_timelimit *g:ale_dafny_dafny_timelimit*
*b:ale_dafny_dafny_timelimit*
Type: |Number|
Default: `10`
This variable sets the `/timeLimit` used for dafny.
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

52
doc/ale-dhall.txt Normal file
View file

@ -0,0 +1,52 @@
===============================================================================
ALE Dhall Integration *ale-dhall-options*
g:ale_dhall_executable *g:ale_dhall_executable*
*b:ale_dhall_executable*
Type: |String|
Default: `'dhall'`
g:ale_dhall_options g:ale_dhall_options
b:ale_dhall_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall` executable.
This is shared with `dhall-freeze` and `dhall-lint`.
>
let g:dhall_options = '--ascii'
<
===============================================================================
dhall-format *ale-dhall-format*
Dhall
(https://dhall-lang.org/)
===============================================================================
dhall-freeze *ale-dhall-freeze*
Dhall
(https://dhall-lang.org/)
g:ale_dhall_freeze_options g:ale_dhall_freeze_options
b:ale_dhall_freeze_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall freeze`
executable.
>
let g:dhall_freeze_options = '--all'
<
===============================================================================
dhall-lint *ale-dhall-lint*
Dhall
(https://dhall-lang.org/)
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -85,5 +85,12 @@ g:ale_elixir_credo_strict *g:ale_elixir_credo_strict*
Tells credo to run in strict mode or suggest mode. Set variable to 1 to Tells credo to run in strict mode or suggest mode. Set variable to 1 to
enable --strict mode. enable --strict mode.
g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file
Type: String
Default: ''
Tells credo to use a custom configuration file.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -122,6 +122,8 @@ Notes:
* `language_server` * `language_server`
* Dhall * Dhall
* `dhall-format` * `dhall-format`
* `dhall-freeze`
* `dhall-lint`
* Dockerfile * Dockerfile
* `dockerfile_lint` * `dockerfile_lint`
* `hadolint` * `hadolint`

View file

@ -1708,6 +1708,15 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity*
`'disabled'` - Doesn't display any information at all. `'disabled'` - Doesn't display any information at all.
g:ale_lsp_suggestions *g:ale_lsp_suggestions*
Type: |Number|
Default: 1
This variable defines if suggestions must be collected from LSP or tsserver
and shown.
g:ale_lsp_root *g:ale_lsp_root* g:ale_lsp_root *g:ale_lsp_root*
*b:ale_lsp_root* *b:ale_lsp_root*
@ -2653,9 +2662,15 @@ documented in additional help files.
dfmt..................................|ale-d-dfmt| dfmt..................................|ale-d-dfmt|
dls...................................|ale-d-dls| dls...................................|ale-d-dls|
uncrustify............................|ale-d-uncrustify| uncrustify............................|ale-d-uncrustify|
dafny...................................|ale-dafny-options|
dafny.................................|ale-dafny-dafny|
dart....................................|ale-dart-options| dart....................................|ale-dart-options|
dartanalyzer..........................|ale-dart-dartanalyzer| dartanalyzer..........................|ale-dart-dartanalyzer|
dartfmt...............................|ale-dart-dartfmt| dartfmt...............................|ale-dart-dartfmt|
dhall...................................|ale-dhall-options|
dhall-format..........................|ale-dhall-format|
dhall-freeze..........................|ale-dhall-freeze|
dhall-lint............................|ale-dhall-lint|
dockerfile..............................|ale-dockerfile-options| dockerfile..............................|ale-dockerfile-options|
dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint|
hadolint..............................|ale-dockerfile-hadolint| hadolint..............................|ale-dockerfile-hadolint|

View file

@ -131,6 +131,8 @@ formatting.
* [language_server](https://github.com/natebosch/dart_language_server) * [language_server](https://github.com/natebosch/dart_language_server)
* Dhall * Dhall
* [dhall-format](https://github.com/dhall-lang/dhall-lang) * [dhall-format](https://github.com/dhall-lang/dhall-lang)
* [dhall-freeze](https://github.com/dhall-lang/dhall-lang)
* [dhall-lint](https://github.com/dhall-lang/dhall-lang)
* Dockerfile * Dockerfile
* [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)
* [hadolint](https://github.com/hadolint/hadolint) * [hadolint](https://github.com/hadolint/hadolint)

View file

@ -38,3 +38,10 @@ Execute(Builds credo command with suggest mode when set to 0):
AssertLinter 'mix', AssertLinter 'mix',
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project')) \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
\ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
Execute(Builds credo command with a custom config file):
let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
AssertLinter 'mix',
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
\ . 'mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'

View file

@ -11,16 +11,16 @@ After:
Execute(The default executable path should be correct): Execute(The default executable path should be correct):
AssertLinter 'julia', AssertLinter 'julia',
\ ale#Escape('julia') . \ ale#Escape('julia') .
\' --startup-file=no --history-file=no -e ' . \' --project=@. --startup-file=no --history-file=no -e ' .
\ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);') \ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);')
Execute(The executable should be configurable): Execute(The executable should be configurable):
let g:ale_julia_executable = 'julia-new' let g:ale_julia_executable = 'julia-new'
AssertLinter 'julia-new', AssertLinter 'julia-new',
\ ale#Escape('julia-new') . \ ale#Escape('julia-new') .
\' --startup-file=no --history-file=no -e ' . \' --project=@. --startup-file=no --history-file=no -e ' .
\ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);') \ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);')
Execute(The project root should be detected correctly): Execute(The project root should be detected correctly):
AssertLSPProject '' AssertLSPProject ''

View file

@ -16,5 +16,5 @@ Execute(The project root should be detected correctly):
Execute(Should accept configuration settings): Execute(Should accept configuration settings):
AssertLSPConfig {} AssertLSPConfig {}
let b:ale_rust_analyzer_config = {'rust': {'clippy_preference': 'on'}} let b:ale_rust_analyzer_config = {'diagnostics': {'disabled': ['unresolved-import']}}
AssertLSPConfig {'rust': {'clippy_preference': 'on'}} AssertLSPOptions {'diagnostics': {'disabled': ['unresolved-import']}}

View file

@ -1,11 +0,0 @@
Before:
call ale#assert#SetUpFixerTest('dhall', 'dhall')
After:
call ale#assert#TearDownFixerTest()
Execute(The default command should be correct):
AssertFixer
\ { 'read_temporary_file': 1,
\ 'command': ale#Escape('dhall') . ' format --inplace %t'
\ }

View file

@ -0,0 +1,24 @@
Before:
Save g:ale_dhall_executable
Save g:ale_dhall_options
" Use an invalid global executable, so we dont match it.
let g:ale_dhall_executable = 'odd-dhall'
let g:ale_dhall_options = '--ascii'
call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format')
After:
call ale#assert#TearDownFixerTest()
Execute(The dhall-format callback should return the correct options):
call ale#test#SetFilename('../dhall_files/testfile.dhall')
AssertFixer
\ {
\ 'command': ale#Escape('odd-dhall')
\ . ' --ascii'
\ . ' format'
\ . ' --inplace %t',
\ 'read_temporary_file': 1,
\ }

View file

@ -0,0 +1,24 @@
Before:
Save g:ale_dhall_executable
Save g:ale_dhall_options
" Use an invalid global executable, so we dont match it.
let g:ale_dhall_executable = 'odd-dhall'
let g:ale_dhall_options = '--ascii'
let g:ale_dhall_freeze_options = '--all'
call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze')
After:
call ale#assert#TearDownFixerTest()
Execute(The dhall-freeze callback should return the correct options):
AssertFixer
\ {
\ 'command': ale#Escape('odd-dhall')
\ . ' --ascii'
\ . ' freeze'
\ . ' --all'
\ . ' --inplace %t',
\ 'read_temporary_file': 1,
\ }

View file

@ -0,0 +1,22 @@
Before:
Save g:ale_dhall_executable
Save g:ale_dhall_options
" Use an invalid global executable, so we dont match it.
let g:ale_dhall_executable = 'odd-dhall'
let g:ale_dhall_options = '--ascii'
call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint')
After:
call ale#assert#TearDownFixerTest()
Execute(The dhall-lint callback should return the correct options):
AssertFixer
\ {
\ 'command': ale#Escape('odd-dhall')
\ . ' --ascii'
\ . ' lint'
\ . ' --inplace %t',
\ 'read_temporary_file': 1,
\ }

View file

@ -20,9 +20,17 @@ Execute(The Dafny handler should parse output correctly):
\ 'lnum': 678, \ 'lnum': 678,
\ 'text': 'This is the precondition that might not hold.', \ 'text': 'This is the precondition that might not hold.',
\ 'type': 'W' \ 'type': 'W'
\ } \ },
\ {
\ 'bufnr': 0,
\ 'col': 45,
\ 'lnum': 123,
\ 'text': "Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds",
\ 'type': 'E'
\ },
\ ], \ ],
\ ale_linters#dafny#dafny#Handle(0, [ \ ale_linters#dafny#dafny#Handle(0, [
\ 'File.dfy(123,45): Error BP5002: A precondition for this call might not hold.', \ 'File.dfy(123,45): Error BP5002: A precondition for this call might not hold.',
\ 'File.dfy(678,90): Related location: This is the precondition that might not hold.' \ 'File.dfy(678,90): Related location: This is the precondition that might not hold.',
\ "File.dfy(123,45): Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds",
\ ]) \ ])

View file

@ -482,6 +482,7 @@ Execute(We should include several important flags):
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter')) \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework')) \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar')) \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
\ . ' -Dmacro="value"' \ . ' -Dmacro="value"'
\ . ' -DGoal=9' \ . ' -DGoal=9'
\ . ' -D macro2' \ . ' -D macro2'
@ -511,6 +512,8 @@ Execute(We should include several important flags):
\ 'incframework', \ 'incframework',
\ '-include', \ '-include',
\ '''foo bar''', \ '''foo bar''',
\ '-imacros',
\ 'incmacros',
\ '-Dmacro="value"', \ '-Dmacro="value"',
\ '-DGoal=9', \ '-DGoal=9',
\ '-D', \ '-D',
@ -559,6 +562,7 @@ Execute(We should quote the flags we need to quote):
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter')) \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework')) \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar')) \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
\ . ' ' . ale#Escape('-Dmacro="value"') \ . ' ' . ale#Escape('-Dmacro="value"')
\ . ' -DGoal=9' \ . ' -DGoal=9'
\ . ' -D macro2' \ . ' -D macro2'
@ -591,6 +595,8 @@ Execute(We should quote the flags we need to quote):
\ 'incframework', \ 'incframework',
\ '-include', \ '-include',
\ '''foo bar''', \ '''foo bar''',
\ '-imacros',
\ 'incmacros',
\ '-Dmacro="value"', \ '-Dmacro="value"',
\ '-DGoal=9', \ '-DGoal=9',
\ '-D', \ '-D',

View file

@ -111,7 +111,7 @@ Execute(An initial list of semantic errors should be handled):
Assert g:ale_handle_loclist_called Assert g:ale_handle_loclist_called
Execute(Subsequent empty lists should be ignored): Execute(Subsequent empty lists should be ignored - semantic):
let g:ale_buffer_info[bufnr('')].semantic_loclist = [] let g:ale_buffer_info[bufnr('')].semantic_loclist = []
call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', '')) call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
@ -138,3 +138,31 @@ Execute(Non-empty then non-empty semantic errors should be handled):
call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x')) call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
Assert g:ale_handle_loclist_called Assert g:ale_handle_loclist_called
Execute(Subsequent empty lists should be ignored - suggestion):
let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
Assert !g:ale_handle_loclist_called
Execute(Empty then non-empty suggestion messages should be handled):
let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
Assert g:ale_handle_loclist_called
Execute(Non-empty then empt suggestion messages should be handled):
let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
Assert g:ale_handle_loclist_called
Execute(Non-empty then non-empty suggestion messages should be handled):
let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
Assert g:ale_handle_loclist_called