Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
42bf5ca911
28 changed files with 358 additions and 55 deletions
|
@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
|||
\ })
|
||||
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
|
||||
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', {
|
||||
\ 'name': 'dafny',
|
||||
\ 'executable': 'dafny',
|
||||
\ 'command': 'dafny %s /compile:0',
|
||||
\ 'command': function('ale_linters#dafny#dafny#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ })
|
||||
|
|
|
@ -45,6 +45,16 @@ function! ale_linters#elixir#credo#GetMode() abort
|
|||
endif
|
||||
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
|
||||
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
|
||||
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)
|
||||
\ . 'mix help credo && '
|
||||
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||
\ . ale_linters#elixir#credo#GetConfigFile()
|
||||
\ . ' --format=flycheck --read-from-stdin %s'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ 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(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
|
||||
|
||||
call ale#linter#Define('julia', {
|
||||
|
|
|
@ -17,7 +17,7 @@ endfunction
|
|||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'analyzer',
|
||||
\ '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')},
|
||||
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
|
||||
|
|
|
@ -152,6 +152,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
|
|||
\ || stridx(l:option, '-idirafter') == 0
|
||||
\ || stridx(l:option, '-iframework') == 0
|
||||
\ || stridx(l:option, '-include') == 0
|
||||
\ || stridx(l:option, '-imacros') == 0
|
||||
if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
|
||||
let l:arg = join(split(l:option, '\zs')[2:], '')
|
||||
let l:option = '-I'
|
||||
|
|
24
autoload/ale/dhall.vim
Normal file
24
autoload/ale/dhall.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
" Author: Pat Brisbin <pbrisbin@gmail.com>, toastal <toastal@protonmail.com>
|
||||
" Description: Functions for working with Dhall’s 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
|
|
@ -37,6 +37,27 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['d'],
|
||||
\ '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': {
|
||||
\ 'function': 'ale#fixers#fecs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
|
||||
|
@ -342,7 +363,7 @@ let s:default_registry = {
|
|||
\ },
|
||||
\ 'ktlint': {
|
||||
\ 'function': 'ale#fixers#ktlint#Fix',
|
||||
\ 'suggested_filetypes': ['kt'],
|
||||
\ 'suggested_filetypes': ['kt', 'kotlin'],
|
||||
\ 'description': 'Fix Kotlin files with ktlint.',
|
||||
\ },
|
||||
\ 'styler': {
|
||||
|
@ -390,16 +411,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with luafmt.',
|
||||
\ },
|
||||
\ 'dhall': {
|
||||
\ 'function': 'ale#fixers#dhall#Fix',
|
||||
\ 'suggested_filetypes': ['dhall'],
|
||||
\ 'description': 'Fix Dhall files with dhall-format.',
|
||||
\ },
|
||||
\ 'ormolu': {
|
||||
\ 'function': 'ale#fixers#ormolu#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'A formatter for Haskell source code.',
|
||||
\ },
|
||||
\ }
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
|
|
@ -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
|
14
autoload/ale/fixers/dhall_format.vim
Normal file
14
autoload/ale/fixers/dhall_format.vim
Normal file
|
@ -0,0 +1,14 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Description: Dhall’s 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
|
18
autoload/ale/fixers/dhall_freeze.vim
Normal file
18
autoload/ale/fixers/dhall_freeze.vim
Normal file
|
@ -0,0 +1,18 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Description: Dhall’s 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
|
14
autoload/ale/fixers/dhall_lint.vim
Normal file
14
autoload/ale/fixers/dhall_lint.vim
Normal file
|
@ -0,0 +1,14 @@
|
|||
" Author: toastal <toastal@protonmail.com>
|
||||
" Description: Dhall’s 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
|
|
@ -85,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
|||
endif
|
||||
|
||||
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
|
||||
let l:no_changes = 1
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
if l:no_changes
|
||||
|
@ -98,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
|||
endif
|
||||
|
||||
let l:loclist = get(l:info, 'semantic_loclist', [])
|
||||
\ + get(l:info, 'suggestion_loclist', [])
|
||||
\ + get(l:info, 'syntax_loclist', [])
|
||||
|
||||
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'
|
||||
\&& get(a:response, 'event', '') is# 'syntaxDiag'
|
||||
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
|
||||
endfunction
|
||||
|
||||
|
|
16
doc/ale-dafny.txt
Normal file
16
doc/ale-dafny.txt
Normal 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
52
doc/ale-dhall.txt
Normal 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:
|
|
@ -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
|
||||
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:
|
||||
|
|
|
@ -122,6 +122,8 @@ Notes:
|
|||
* `language_server`
|
||||
* Dhall
|
||||
* `dhall-format`
|
||||
* `dhall-freeze`
|
||||
* `dhall-lint`
|
||||
* Dockerfile
|
||||
* `dockerfile_lint`
|
||||
* `hadolint`
|
||||
|
|
15
doc/ale.txt
15
doc/ale.txt
|
@ -1708,6 +1708,15 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity*
|
|||
`'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*
|
||||
*b:ale_lsp_root*
|
||||
|
||||
|
@ -2653,9 +2662,15 @@ documented in additional help files.
|
|||
dfmt..................................|ale-d-dfmt|
|
||||
dls...................................|ale-d-dls|
|
||||
uncrustify............................|ale-d-uncrustify|
|
||||
dafny...................................|ale-dafny-options|
|
||||
dafny.................................|ale-dafny-dafny|
|
||||
dart....................................|ale-dart-options|
|
||||
dartanalyzer..........................|ale-dart-dartanalyzer|
|
||||
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_lint.......................|ale-dockerfile-dockerfile_lint|
|
||||
hadolint..............................|ale-dockerfile-hadolint|
|
||||
|
|
|
@ -131,6 +131,8 @@ formatting.
|
|||
* [language_server](https://github.com/natebosch/dart_language_server)
|
||||
* Dhall
|
||||
* [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_lint](https://github.com/projectatomic/dockerfile_lint)
|
||||
* [hadolint](https://github.com/hadolint/hadolint)
|
||||
|
|
|
@ -38,3 +38,10 @@ Execute(Builds credo command with suggest mode when set to 0):
|
|||
AssertLinter 'mix',
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
||||
\ . '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'
|
||||
|
|
|
@ -11,16 +11,16 @@ After:
|
|||
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(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);')
|
||||
\' --project=@. --startup-file=no --history-file=no -e ' .
|
||||
\ 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):
|
||||
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(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);')
|
||||
\' --project=@. --startup-file=no --history-file=no -e ' .
|
||||
\ 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):
|
||||
AssertLSPProject ''
|
||||
|
|
|
@ -16,5 +16,5 @@ Execute(The project root should be detected correctly):
|
|||
|
||||
Execute(Should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_rust_analyzer_config = {'rust': {'clippy_preference': 'on'}}
|
||||
AssertLSPConfig {'rust': {'clippy_preference': 'on'}}
|
||||
let b:ale_rust_analyzer_config = {'diagnostics': {'disabled': ['unresolved-import']}}
|
||||
AssertLSPOptions {'diagnostics': {'disabled': ['unresolved-import']}}
|
||||
|
|
|
@ -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'
|
||||
\ }
|
24
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
24
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
|
@ -0,0 +1,24 @@
|
|||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t 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,
|
||||
\ }
|
24
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
24
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
|
@ -0,0 +1,24 @@
|
|||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t 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,
|
||||
\ }
|
22
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
22
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
|
@ -0,0 +1,22 @@
|
|||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t 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,
|
||||
\ }
|
|
@ -20,9 +20,17 @@ Execute(The Dafny handler should parse output correctly):
|
|||
\ 'lnum': 678,
|
||||
\ 'text': 'This is the precondition that might not hold.',
|
||||
\ '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, [
|
||||
\ '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",
|
||||
\ ])
|
||||
|
|
|
@ -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'))
|
||||
\ . ' -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'))
|
||||
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
||||
\ . ' -Dmacro="value"'
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
|
@ -511,6 +512,8 @@ Execute(We should include several important flags):
|
|||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-imacros',
|
||||
\ 'incmacros',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-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'))
|
||||
\ . ' -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'))
|
||||
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
||||
\ . ' ' . ale#Escape('-Dmacro="value"')
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
|
@ -591,6 +595,8 @@ Execute(We should quote the flags we need to quote):
|
|||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-imacros',
|
||||
\ 'incmacros',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-D',
|
||||
|
|
|
@ -111,7 +111,7 @@ Execute(An initial list of semantic errors should be handled):
|
|||
|
||||
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 = []
|
||||
|
||||
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'))
|
||||
|
||||
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
|
||||
|
|
Reference in a new issue