summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md11
-rw-r--r--ale_linters/elixir/credo.vim13
-rw-r--r--ale_linters/elm/elm_lsp.vim22
-rw-r--r--ale_linters/json/jsonlint.vim23
-rw-r--r--ale_linters/mail/languagetool.vim5
-rw-r--r--ale_linters/markdown/languagetool.vim5
-rw-r--r--ale_linters/php/langserver.vim6
-rw-r--r--ale_linters/powershell/psscriptanalyzer.vim105
-rw-r--r--ale_linters/text/languagetool.vim4
-rw-r--r--autoload/ale.vim4
-rw-r--r--autoload/ale/completion.vim59
-rw-r--r--autoload/ale/engine/ignore.vim6
-rw-r--r--autoload/ale/fix/registry.vim4
-rw-r--r--autoload/ale/handlers/alex.vim5
-rw-r--r--autoload/ale/handlers/languagetool.vim74
-rw-r--r--autoload/ale/handlers/redpen.vim4
-rw-r--r--autoload/ale/handlers/rust.vim2
-rw-r--r--autoload/ale/handlers/sml.vim1
-rw-r--r--autoload/ale/handlers/writegood.vim4
-rw-r--r--autoload/ale/linter.vim2
-rw-r--r--autoload/ale/list.vim2
-rw-r--r--autoload/ale/path.vim9
-rw-r--r--autoload/ale/references.vim16
-rw-r--r--autoload/ale/semver.vim4
-rw-r--r--autoload/ale/sign.vim15
-rw-r--r--doc/ale-cuda.txt7
-rw-r--r--doc/ale-elixir.txt12
-rw-r--r--doc/ale-elm.txt18
-rw-r--r--doc/ale-json.txt16
-rw-r--r--doc/ale-powershell.txt62
-rw-r--r--doc/ale-supported-languages-and-tools.txt7
-rw-r--r--doc/ale.txt405
-rw-r--r--plugin/ale.vim2
-rw-r--r--supported-tools.md9
-rw-r--r--test/command_callback/php-langserver-project/with-composer/composer.json0
-rwxr-xr-xtest/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php0
-rwxr-xr-xtest/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php0
-rw-r--r--test/command_callback/test_elixir_credo.vader28
-rw-r--r--test/command_callback/test_elm_lsp_command_callbacks.vader29
-rw-r--r--test/command_callback/test_languagetool_command_callback.vader15
-rw-r--r--test/command_callback/test_php_langserver_callbacks.vader15
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader7
-rw-r--r--test/completion/test_completion_events.vader58
-rw-r--r--test/completion/test_lsp_completion_messages.vader10
-rw-r--r--test/completion/test_lsp_completion_parsing.vader31
-rw-r--r--test/handler/test_languagetool_handler.vader62
-rw-r--r--test/handler/test_psscriptanalyzer_handler.vader42
-rw-r--r--test/handler/test_redpen_handler.vader7
-rw-r--r--test/handler/test_rust_handler.vader18
-rw-r--r--test/jsonlint-test-files/app-without-jsonlint/src/app.json0
-rw-r--r--test/jsonlint-test-files/app/node_modules/.bin/jsonlint0
-rw-r--r--test/jsonlint-test-files/app/src/app.json0
-rw-r--r--test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js0
-rw-r--r--test/test_ale_complete_command.vader26
-rw-r--r--test/test_find_references.vader17
-rw-r--r--test/test_ignoring_linters.vader45
-rw-r--r--test/test_jsonlint_executable_detection.vader46
-rw-r--r--test/test_path_uri.vader49
-rw-r--r--test/test_semver_utils.vader3
59 files changed, 942 insertions, 509 deletions
diff --git a/README.md b/README.md
index 047f9691..49f30af4 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,7 @@ other content at [w0rp.com](https://w0rp.com).
15. [How can I configure my C or C++ project?](#faq-c-configuration)
16. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
17. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
+ 18. [How can I see what ALE has configured for the current file?](#faq-get-info)
<a name="supported-languages"></a>
@@ -779,3 +780,13 @@ To set a default height for the error list, use the `g:ale_list_window_size` var
" Show 5 lines of errors (default: 10)
let g:ale_list_window_size = 5
```
+
+<a name="faq-get-info"></a>
+
+### 5.xviii. How can I see what ALE has configured for the current file?
+
+Run the following to see what is currently configured:
+
+```vim
+:ALEInfo
+```
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 8431c0df..317ecab3 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -37,11 +37,22 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
return l:output
endfunction
+function! ale_linters#elixir#credo#GetMode() abort
+ if get(g:, 'ale_elixir_credo_strict', 0)
+ return '--strict'
+ else
+ return 'suggest'
+ endif
+endfunction
+
function! ale_linters#elixir#credo#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
+ let l:mode = ale_linters#elixir#credo#GetMode()
return ale#path#CdString(l:project_root)
- \ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
+ \ . 'mix help credo && '
+ \ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
+ \ . ' --format=flycheck --read-from-stdin %s'
endfunction
call ale#linter#Define('elixir', {
diff --git a/ale_linters/elm/elm_lsp.vim b/ale_linters/elm/elm_lsp.vim
new file mode 100644
index 00000000..2259286f
--- /dev/null
+++ b/ale_linters/elm/elm_lsp.vim
@@ -0,0 +1,22 @@
+" Author: antew - https://github.com/antew
+" Description: LSP integration for elm, currently supports diagnostics (linting)
+
+call ale#Set('elm_lsp_executable', 'elm-lsp')
+call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! elm_lsp#GetRootDir(buffer) abort
+ let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
+
+ return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
+endfunction
+
+call ale#linter#Define('elm', {
+\ 'name': 'elm_lsp',
+\ 'lsp': 'stdio',
+\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [
+\ 'node_modules/.bin/elm-lsp',
+\ ])},
+\ 'command': '%e --stdio',
+\ 'project_root': function('elm_lsp#GetRootDir'),
+\ 'language': 'elm'
+\})
diff --git a/ale_linters/json/jsonlint.vim b/ale_linters/json/jsonlint.vim
index f01553d6..f677b488 100644
--- a/ale_linters/json/jsonlint.vim
+++ b/ale_linters/json/jsonlint.vim
@@ -1,4 +1,21 @@
-" Author: KabbAmine <amine.kabb@gmail.com>
+" Author: KabbAmine <amine.kabb@gmail.com>, David Sierra <https://github.com/davidsierradz>
+
+call ale#Set('json_jsonlint_executable', 'jsonlint')
+call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0))
+
+function! ale_linters#json#jsonlint#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [
+ \ 'node_modules/.bin/jsonlint',
+ \ 'node_modules/jsonlint/lib/cli.js',
+ \])
+endfunction
+
+function! ale_linters#json#jsonlint#GetCommand(buffer) abort
+ let l:executable = ale_linters#json#jsonlint#GetExecutable(a:buffer)
+
+ return ale#node#Executable(a:buffer, l:executable)
+ \ . ' --compact -'
+endfunction
function! ale_linters#json#jsonlint#Handle(buffer, lines) abort
" Matches patterns like the following:
@@ -19,8 +36,8 @@ endfunction
call ale#linter#Define('json', {
\ 'name': 'jsonlint',
-\ 'executable': 'jsonlint',
+\ 'executable': function('ale_linters#json#jsonlint#GetExecutable'),
\ 'output_stream': 'stderr',
-\ 'command': 'jsonlint --compact -',
+\ 'command': function('ale_linters#json#jsonlint#GetCommand'),
\ 'callback': 'ale_linters#json#jsonlint#Handle',
\})
diff --git a/ale_linters/mail/languagetool.vim b/ale_linters/mail/languagetool.vim
new file mode 100644
index 00000000..330fb8ec
--- /dev/null
+++ b/ale_linters/mail/languagetool.vim
@@ -0,0 +1,5 @@
+" Author: Vincent (wahrwolf [ät] wolfpit.net)
+" Description: languagetool for mails
+
+
+call ale#handlers#languagetool#DefineLinter('mail')
diff --git a/ale_linters/markdown/languagetool.vim b/ale_linters/markdown/languagetool.vim
new file mode 100644
index 00000000..d6bca22e
--- /dev/null
+++ b/ale_linters/markdown/languagetool.vim
@@ -0,0 +1,5 @@
+" Author: Vincent (wahrwolf [ät] wolfpit.net)
+" Description: languagetool for markdown files
+
+
+call ale#handlers#languagetool#DefineLinter('markdown')
diff --git a/ale_linters/php/langserver.vim b/ale_linters/php/langserver.vim
index c88281c4..fdd1bf2b 100644
--- a/ale_linters/php/langserver.vim
+++ b/ale_linters/php/langserver.vim
@@ -5,6 +5,12 @@ call ale#Set('php_langserver_executable', 'php-language-server.php')
call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
+ let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
+
+ if (!empty(l:composer_path))
+ return fnamemodify(l:composer_path, ':h')
+ endif
+
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
diff --git a/ale_linters/powershell/psscriptanalyzer.vim b/ale_linters/powershell/psscriptanalyzer.vim
new file mode 100644
index 00000000..8d1804f8
--- /dev/null
+++ b/ale_linters/powershell/psscriptanalyzer.vim
@@ -0,0 +1,105 @@
+" Author: Jesse Harris - https://github.com/zigford
+" Description: This file adds support for lintng powershell scripts
+" using the PSScriptAnalyzer module.
+
+" let g:ale_powershell_psscriptanalyzer_exclusions =
+" \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars'
+call ale#Set('powershell_psscriptanalyzer_exclusions', '')
+call ale#Set('powershell_psscriptanalyzer_executable', 'pwsh')
+call ale#Set('powershell_psscriptanalyzer_module',
+\ 'psscriptanalyzer')
+
+function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable')
+endfunction
+
+" Write a powershell script to a temp file for execution
+" return the command used to execute it
+function! s:TemporaryPSScript(buffer, input) abort
+ let l:filename = 'script.ps1'
+ " Create a temp dir to house our temp .ps1 script
+ " a temp dir is needed as powershell needs the .ps1
+ " extension
+ let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/')
+ let l:tempscript = l:tempdir . l:filename
+ " Create the temporary directory for the file, unreadable by 'other'
+ " users.
+ call mkdir(l:tempdir, '', 0750)
+ " Automatically delete the directory later.
+ call ale#command#ManageDirectory(a:buffer, l:tempdir)
+ " Write the script input out to a file.
+ call ale#util#Writefile(a:buffer, a:input, l:tempscript)
+
+ return l:tempscript
+endfunction
+
+function! ale_linters#powershell#psscriptanalyzer#RunPowerShell(buffer, command) abort
+ let l:executable = ale_linters#powershell#psscriptanalyzer#GetExecutable(
+ \ a:buffer)
+ let l:tempscript = s:TemporaryPSScript(a:buffer, a:command)
+
+ return ale#Escape(l:executable)
+ \ . ' -Exe Bypass -NoProfile -File '
+ \ . ale#Escape(l:tempscript)
+ \ . ' %t'
+endfunction
+
+" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines
+" for each parsing
+function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort
+ let l:exclude_option = ale#Var(
+ \ a:buffer, 'powershell_psscriptanalyzer_exclusions')
+ let l:module = ale#Var(
+ \ a:buffer, 'powershell_psscriptanalyzer_module')
+ let l:script = ['Param($Script);
+ \ Invoke-ScriptAnalyzer "$Script" '
+ \ . (!empty(l:exclude_option) ? '-Exclude ' . l:exclude_option : '')
+ \ . '| ForEach-Object {
+ \ $_.Line;
+ \ $_.Severity;
+ \ $_.Message;
+ \ $_.RuleName}']
+
+ return ale_linters#powershell#psscriptanalyzer#RunPowerShell(
+ \ a:buffer, l:script)
+endfunction
+
+" add every 4 lines to an item(Dict) and every item to a list
+" return the list
+function! ale_linters#powershell#psscriptanalyzer#Handle(buffer, lines) abort
+ let l:output = []
+ let l:lcount = 0
+
+ for l:line in a:lines
+ if l:lcount is# 0
+ " the very first line
+ let l:item = {'lnum': str2nr(l:line)}
+ elseif l:lcount is# 1
+ if l:line is# 'Error'
+ let l:item['type'] = 'E'
+ elseif l:line is# 'Information'
+ let l:item['type'] = 'I'
+ else
+ let l:item['type'] = 'W'
+ endif
+ elseif l:lcount is# 2
+ let l:item['text'] = l:line
+ elseif l:lcount is# 3
+ let l:item['code'] = l:line
+ call add(l:output, l:item)
+ let l:lcount = -1
+ endif
+
+ let l:lcount = l:lcount + 1
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('powershell', {
+\ 'name': 'psscriptanalyzer',
+\ 'executable_callback': 'ale_linters#powershell#psscriptanalyzer#GetExecutable',
+\ 'command_callback': 'ale_linters#powershell#psscriptanalyzer#GetCommand',
+\ 'output_stream': 'stdout',
+\ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle',
+\})
diff --git a/ale_linters/text/languagetool.vim b/ale_linters/text/languagetool.vim
new file mode 100644
index 00000000..58c99ba2
--- /dev/null
+++ b/ale_linters/text/languagetool.vim
@@ -0,0 +1,4 @@
+" Author: Vincent (wahrwolf [ät] wolfpit.net)
+" Description: languagetool for text files
+
+call ale#handlers#languagetool#DefineLinter('text')
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 5aa5fbfc..bcb89095 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -8,6 +8,7 @@ let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
" Ignoring linters, for disabling some, or ignoring LSP diagnostics.
let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {})
+let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0)
let s:lint_timer = -1
let s:getcmdwintype_exists = exists('*getcmdwintype')
@@ -90,8 +91,9 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort
" Apply ignore lists for linters only if needed.
let l:ignore_config = ale#Var(a:buffer, 'linters_ignore')
+ let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp')
let l:linters = !empty(l:ignore_config)
- \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config)
+ \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp)
\ : l:linters
" Tell other sources that they can start checking the buffer now.
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 782a68e4..682f4c43 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -39,6 +39,9 @@ let s:LSP_COMPLETION_COLOR_KIND = 16
let s:LSP_COMPLETION_FILE_KIND = 17
let s:LSP_COMPLETION_REFERENCE_KIND = 18
+let s:LSP_INSERT_TEXT_FORMAT_PLAIN = 1
+let s:LSP_INSERT_TEXT_FORMAT_SNIPPET = 2
+
let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$'
" Regular expressions for checking the characters in the line before where
@@ -165,14 +168,18 @@ function! s:ReplaceCompletionOptions() abort
let &l:omnifunc = 'ale#completion#OmniFunc'
- if !exists('b:ale_old_completopt')
- let b:ale_old_completopt = &l:completeopt
- endif
+ let l:info = get(b:, 'ale_completion_info', {})
- if &l:completeopt =~# 'preview'
- let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
- else
- let &l:completeopt = 'menu,menuone,noselect,noinsert'
+ if !get(l:info, 'manual')
+ if !exists('b:ale_old_completeopt')
+ let b:ale_old_completeopt = &l:completeopt
+ endif
+
+ if &l:completeopt =~# 'preview'
+ let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
+ else
+ let &l:completeopt = 'menu,menuone,noselect,noinsert'
+ endif
endif
endfunction
@@ -186,9 +193,9 @@ function! ale#completion#RestoreCompletionOptions() abort
unlet b:ale_old_omnifunc
endif
- if exists('b:ale_old_completopt')
- let &l:completeopt = b:ale_old_completopt
- unlet b:ale_old_completopt
+ if exists('b:ale_old_completeopt')
+ let &l:completeopt = b:ale_old_completeopt
+ unlet b:ale_old_completeopt
endif
endfunction
@@ -346,7 +353,14 @@ function! ale#completion#ParseLSPCompletions(response) abort
continue
endif
- let l:word = matchstr(l:item.label, '\v^[^(]+')
+ if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
+ \&& type(get(l:item, 'textEdit')) is v:t_dict
+ let l:text = l:item.textEdit.newText
+ else
+ let l:text = l:item.label
+ endif
+
+ let l:word = matchstr(l:text, '\v^[^(]+')
if empty(l:word)
continue
@@ -385,10 +399,10 @@ function! ale#completion#ParseLSPCompletions(response) abort
endfor
if has_key(l:info, 'prefix')
- return ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix)
+ let l:results = ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix)
endif
- return l:results
+ return l:results[: g:ale_completion_max_suggestions - 1]
endfunction
function! ale#completion#HandleTSServerResponse(conn_id, response) abort
@@ -503,22 +517,14 @@ function! s:OnReady(linter, lsp_details) abort
endif
endfunction
-function! ale#completion#GetCompletions() abort
- if !g:ale_completion_enabled
- return
- endif
-
- call ale#completion#AlwaysGetCompletions(1)
-endfunction
-
" This function can be used to manually trigger autocomplete, even when
" g:ale_completion_enabled is set to false
-function! ale#completion#AlwaysGetCompletions(need_prefix) abort
+function! ale#completion#GetCompletions(manual) abort
let [l:line, l:column] = getpos('.')[1:2]
let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column)
- if a:need_prefix && empty(l:prefix)
+ if !a:manual && empty(l:prefix)
return
endif
@@ -531,6 +537,7 @@ function! ale#completion#AlwaysGetCompletions(need_prefix) abort
\ 'prefix': l:prefix,
\ 'conn_id': 0,
\ 'request_id': 0,
+ \ 'manual': a:manual,
\}
let l:buffer = bufnr('')
@@ -544,6 +551,10 @@ function! ale#completion#AlwaysGetCompletions(need_prefix) abort
endfunction
function! s:TimerHandler(...) abort
+ if !g:ale_completion_enabled
+ return
+ endif
+
let s:timer_id = -1
let [l:line, l:column] = getpos('.')[1:2]
@@ -551,7 +562,7 @@ function! s:TimerHandler(...) abort
" When running the timer callback, we have to be sure that the cursor
" hasn't moved from where it was when we requested completions by typing.
if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i'
- call ale#completion#GetCompletions()
+ call ale#completion#GetCompletions(0)
endif
endfunction
diff --git a/autoload/ale/engine/ignore.vim b/autoload/ale/engine/ignore.vim
index 2db2c6c1..80574656 100644
--- a/autoload/ale/engine/ignore.vim
+++ b/autoload/ale/engine/ignore.vim
@@ -22,7 +22,7 @@ function! ale#engine#ignore#GetList(filetype, config) abort
endfunction
" Given a List of linter descriptions, exclude the linters to be ignored.
-function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort
+function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort
let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config)
let l:filtered_linters = []
@@ -37,6 +37,10 @@ function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort
endif
endfor
+ if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# ''
+ let l:should_include = 0
+ endif
+
if l:should_include
call add(l:filtered_linters, l:linter)
endif
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 34cb771f..7118c44a 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -142,8 +142,8 @@ let s:default_registry = {
\ },
\ 'clang-format': {
\ 'function': 'ale#fixers#clangformat#Fix',
-\ 'suggested_filetypes': ['c', 'cpp'],
-\ 'description': 'Fix C/C++ files with clang-format.',
+\ 'suggested_filetypes': ['c', 'cpp', 'cuda'],
+\ 'description': 'Fix C/C++ and cuda files with clang-format.',
\ },
\ 'cmakeformat': {
\ 'function': 'ale#fixers#cmakeformat#Fix',
diff --git a/autoload/ale/handlers/alex.vim b/autoload/ale/handlers/alex.vim
index 9cb546ec..190a7f86 100644
--- a/autoload/ale/handlers/alex.vim
+++ b/autoload/ale/handlers/alex.vim
@@ -1,3 +1,4 @@
+scriptencoding utf-8
" Author: Johannes Wienke <languitar@semipol.de>
" Description: Error handling for errors in alex output format
@@ -44,8 +45,8 @@ function! ale#handlers#alex#DefineLinter(filetype, flags) abort
call ale#linter#Define(a:filetype, {
\ 'name': 'alex',
- \ 'executable_callback': 'ale#handlers#alex#GetExecutable',
- \ 'command_callback': ale#handlers#alex#CreateCommandCallback(a:flags),
+ \ 'executable': function('ale#handlers#alex#GetExecutable'),
+ \ 'command': ale#handlers#alex#CreateCommandCallback(a:flags),
\ 'output_stream': 'stderr',
\ 'callback': 'ale#handlers#alex#Handle',
\ 'lint_file': 1,
diff --git a/autoload/ale/handlers/languagetool.vim b/autoload/ale/handlers/languagetool.vim
new file mode 100644
index 00000000..10e049df
--- /dev/null
+++ b/autoload/ale/handlers/languagetool.vim
@@ -0,0 +1,74 @@
+" Author: Vincent (wahrwolf [at] wolfpit.net)
+" Description: languagetool for markdown files
+"
+call ale#Set('languagetool_executable', 'languagetool')
+
+function! ale#handlers#languagetool#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'languagetool_executable')
+endfunction
+
+function! ale#handlers#languagetool#GetCommand(buffer) abort
+ let l:executable = ale#handlers#languagetool#GetExecutable(a:buffer)
+
+ return ale#Escape(l:executable) . ' --autoDetect %s'
+endfunction
+
+function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort
+ " Match lines like:
+ " 1.) Line 5, column 1, Rule ID:
+ let l:head_pattern = '^\v.+.\) Line (\d+), column (\d+), Rule ID. (.+)$'
+ let l:head_matches = ale#util#GetMatches(a:lines, l:head_pattern)
+
+ " Match lines like:
+ " Message: Did you forget a comma after a conjunctive/linking adverb?
+ let l:message_pattern = '^\vMessage. (.+)$'
+ let l:message_matches = ale#util#GetMatches(a:lines, l:message_pattern)
+
+ " Match lines like:
+ " ^^^^^ "
+ let l:markers_pattern = '^\v *(\^+) *$'
+ let l:markers_matches = ale#util#GetMatches(a:lines, l:markers_pattern)
+
+ let l:output = []
+
+
+ " Okay tbh I was to lazy to figure out a smarter solution here
+ " We just check that the arrays are same sized and merge everything
+ " together
+ let l:i = 0
+
+ while l:i < len(l:head_matches)
+ \ && (
+ \ (len(l:head_matches) == len(l:markers_matches))
+ \ && (len(l:head_matches) == len(l:message_matches))
+ \ )
+ let l:item = {
+ \ 'lnum' : str2nr(l:head_matches[l:i][1]),
+ \ 'col' : str2nr(l:head_matches[l:i][2]),
+ \ 'end_col' : str2nr(l:head_matches[l:i][2]) + len(l:markers_matches[l:i][1])-1,
+ \ 'type' : 'W',
+ \ 'code' : l:head_matches[l:i][3],
+ \ 'text' : l:message_matches[l:i][1]
+ \}
+ call add(l:output, l:item)
+ let l:i+=1
+ endwhile
+
+ return l:output
+endfunction
+
+" Define the languagetool linter for a given filetype.
+" TODO:
+" - Add language detection settings based on user env (for mothertongue)
+" - Add fixer
+" - Add config options for rules
+function! ale#handlers#languagetool#DefineLinter(filetype) abort
+ call ale#linter#Define(a:filetype, {
+ \ 'name': 'languagetool',
+ \ 'executable': function('ale#handlers#languagetool#GetExecutable'),
+ \ 'command': function('ale#handlers#languagetool#GetCommand'),
+ \ 'output_stream': 'stdout',
+ \ 'callback': 'ale#handlers#languagetool#HandleOutput',
+ \ 'lint_file': 1,
+ \})
+endfunction
diff --git a/autoload/ale/handlers/redpen.vim b/autoload/ale/handlers/redpen.vim
index 84e331ed..195057ca 100644
--- a/autoload/ale/handlers/redpen.vim
+++ b/autoload/ale/handlers/redpen.vim
@@ -4,10 +4,10 @@
function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
" Only one file was passed to redpen. So response array has only one
" element.
- let l:res = json_decode(join(a:lines))[0]
+ let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {})
let l:output = []
- for l:err in l:res.errors
+ for l:err in get(l:res, 'errors', [])
let l:item = {
\ 'text': l:err.message,
\ 'type': 'W',
diff --git a/autoload/ale/handlers/rust.vim b/autoload/ale/handlers/rust.vim
index c6a4b670..dda6466e 100644
--- a/autoload/ale/handlers/rust.vim
+++ b/autoload/ale/handlers/rust.vim
@@ -60,7 +60,7 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort
\ 'lnum': l:span.line_start,
\ 'end_lnum': l:span.line_end,
\ 'col': l:span.column_start,
- \ 'end_col': l:span.column_end,
+ \ 'end_col': l:span.column_end-1,
\ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label),
\ 'type': toupper(l:error.level[0]),
\})
diff --git a/autoload/ale/handlers/sml.vim b/autoload/ale/handlers/sml.vim
index e5e528a5..594ee4f7 100644
--- a/autoload/ale/handlers/sml.vim
+++ b/autoload/ale/handlers/sml.vim
@@ -26,7 +26,6 @@ function! ale#handlers#sml#GetCmFile(buffer) abort
endfunction
" Only one of smlnj or smlnj-cm can be enabled at a time.
-" executable_callback is called before *every* lint attempt
function! s:GetExecutable(buffer, source) abort
if ale#handlers#sml#GetCmFile(a:buffer) is# ''
" No CM file found; only allow single-file mode to be enabled
diff --git a/autoload/ale/handlers/writegood.vim b/autoload/ale/handlers/writegood.vim
index aff66d5f..8ae61a38 100644
--- a/autoload/ale/handlers/writegood.vim
+++ b/autoload/ale/handlers/writegood.vim
@@ -65,8 +65,8 @@ function! ale#handlers#writegood#DefineLinter(filetype) abort
call ale#linter#Define(a:filetype, {
\ 'name': 'writegood',
\ 'aliases': ['write-good'],
- \ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
- \ 'command_callback': 'ale#handlers#writegood#GetCommand',
+ \ 'executable': function('ale#handlers#writegood#GetExecutable'),
+ \ 'command': function('ale#handlers#writegood#GetCommand'),
\ 'callback': 'ale#handlers#writegood#Handle',
\})
endfunction
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index 4937a6d7..d680391d 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -32,7 +32,7 @@ let s:default_ale_linter_aliases = {
" NOTE: Update the g:ale_linters documentation when modifying this.
let s:default_ale_linters = {
\ 'csh': ['shell'],
-\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
+\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'go vet'],
\ 'hack': ['hack'],
\ 'help': [],
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim
index 3417575c..63d97f35 100644
--- a/autoload/ale/list.vim
+++ b/autoload/ale/list.vim
@@ -115,7 +115,7 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
let l:open_type = ''
if ale#Var(a:buffer, 'list_vertical') == 1
- let l:open_type = 'vert '
+ let l:open_type = 'vert rightbelow '
endif
if g:ale_set_quickfix
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index ca3afc52..60d42eb5 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -205,10 +205,13 @@ function! ale#path#FromURI(uri) abort
let l:encoded_path = a:uri
endif
+ let l:path = ale#uri#Decode(l:encoded_path)
+
" If the path is like /C:/foo/bar, it should be C:\foo\bar instead.
- if l:encoded_path =~# '^/[a-zA-Z]:'
- let l:encoded_path = substitute(l:encoded_path[1:], '/', '\\', 'g')
+ if has('win32') && l:path =~# '^/[a-zA-Z][:|]'
+ let l:path = substitute(l:path[1:], '/', '\\', 'g')
+ let l:path = l:path[0] . ':' . l:path[2:]
endif
- return ale#uri#Decode(l:encoded_path)
+ return l:path
endfunction
diff --git a/autoload/ale/references.vim b/autoload/ale/references.vim
index 0e88afe2..b9725e1e 100644
--- a/autoload/ale/references.vim
+++ b/autoload/ale/references.vim
@@ -49,13 +49,15 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort
let l:result = get(a:response, 'result', [])
let l:item_list = []
- for l:response_item in l:result
- call add(l:item_list, {
- \ 'filename': ale#path#FromURI(l:response_item.uri),
- \ 'line': l:response_item.range.start.line + 1,
- \ 'column': l:response_item.range.start.character + 1,
- \})
- endfor
+ if type(l:result) is v:t_list
+ for l:response_item in l:result
+ call add(l:item_list, {
+ \ 'filename': ale#path#FromURI(l:response_item.uri),
+ \ 'line': l:response_item.range.start.line + 1,
+ \ 'column': l:response_item.range.start.character + 1,
+ \})
+ endfor
+ endif
if empty(l:item_list)
call ale#util#Execute('echom ''No references found.''')
diff --git a/autoload/ale/semver.vim b/autoload/ale/semver.vim
index 8f549c9f..5f1b46fc 100644
--- a/autoload/ale/semver.vim
+++ b/autoload/ale/semver.vim
@@ -14,10 +14,10 @@ function! ale#semver#GetVersion(executable, version_lines) abort
let l:version = get(s:version_cache, a:executable, [])
for l:line in a:version_lines
- let l:match = matchlist(l:line, '\v(\d+)\.(\d+)\.?(\d?)')
+ let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?')
if !empty(l:match)
- let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0]
+ let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0]
let s:version_cache[a:executable] = l:version
break
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index fc1ea5b6..933fc055 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -64,16 +64,21 @@ if !hlexists('ALESignColumnWithoutErrors')
call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
endif
+" Spaces and backslashes need to be escaped for signs.
+function! s:EscapeSignText(sign_text) abort
+ return substitute(a:sign_text, '\\\| ', '\\\0', 'g')
+endfunction
+
" Signs show up on the left for error markers.
-execute 'sign define ALEErrorSign text=' . g:ale_sign_error
+execute 'sign define ALEErrorSign text=' . s:EscapeSignText(g:ale_sign_error)
\ . ' texthl=ALEErrorSign linehl=ALEErrorLine'
-execute 'sign define ALEStyleErrorSign text=' . g:ale_sign_style_error
+execute 'sign define ALEStyleErrorSign text=' . s:EscapeSignText(g:ale_sign_style_error)
\ . ' texthl=ALEStyleErrorSign linehl=ALEErrorLine'
-execute 'sign define ALEWarningSign text=' . g:ale_sign_warning
+execute 'sign define ALEWarningSign text=' . s:EscapeSignText(g:ale_sign_warning)
\ . ' texthl=ALEWarningSign linehl=ALEWarningLine'
-execute 'sign define ALEStyleWarningSign text=' . g:ale_sign_style_warning
+execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_style_warning)
\ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine'
-execute 'sign define ALEInfoSign text=' . g:ale_sign_info
+execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info)
\ . ' texthl=ALEInfoSign linehl=ALEInfoLine'
sign define ALEDummySign
diff --git a/doc/ale-cuda.txt b/doc/ale-cuda.txt
index 052b3363..0e53f756 100644
--- a/doc/ale-cuda.txt
+++ b/doc/ale-cuda.txt
@@ -22,4 +22,11 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options*
This variable can be changed to modify flags given to nvcc.
===============================================================================
+clang-format *ale-cuda-clangformat*
+
+See |ale-c-clangformat| for information about the available options.
+Note that the C options are also used for cuda.
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-elixir.txt b/doc/ale-elixir.txt
index 45c6de1d..5864f728 100644
--- a/doc/ale-elixir.txt
+++ b/doc/ale-elixir.txt
@@ -72,6 +72,18 @@ g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config*
\ }
<
Consult the ElixirLS documentation for more information about settings.
+===============================================================================
+credo *ale-elixir-credo*
+
+Credo (https://github.com/rrrene/credo)
+
+g:ale_elixir_credo_strict *g:ale_elixir_credo_strict*
+
+ Type: Integer
+ Default: 0
+
+ Tells credo to run in strict mode or suggest mode. Set variable to 1 to
+ enable --strict mode.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-elm.txt b/doc/ale-elm.txt
index de7d8939..bb7a6132 100644
--- a/doc/ale-elm.txt
+++ b/doc/ale-elm.txt
@@ -29,6 +29,24 @@ g:ale_elm_format_options *g:ale_elm_format_options*
This variable can be set to pass additional options to elm-format.
===============================================================================
+elm-lsp *ale-elm-elm-lsp*
+
+g:ale_elm_lsp_executable *g:ale_elm_lsp_executable*
+ *b:ale_elm_lsp_executable*
+ Type: |String|
+ Default: `'elm-lsp'`
+
+ See |ale-integrations-local-executables|
+
+
+g:ale_elm_lsp_use_global *g:ale_elm_lsp_use_global*
+ *b:ale_elm_lsp_use_global*
+ Type: |Number|
+ Default: `get(g:, 'ale_use_global_executables', 0)`
+
+ See |ale-integrations-local-executables|
+
+===============================================================================
elm-make *ale-elm-elm-make*
g:ale_elm_make_executable *g:ale_elm_make_executable*
diff --git a/doc/ale-json.txt b/doc/ale-json.txt
index 6a0a9fae..96499a04 100644
--- a/doc/ale-json.txt
+++ b/doc/ale-json.txt
@@ -52,7 +52,21 @@ g:ale_json_fixjson_use_global *g:ale_json_fixjson_use_global*
===============================================================================
jsonlint *ale-json-jsonlint*
-There are no options available.
+g:ale_json_jsonlint_executable *g:ale_json_jsonlint_executable*
+ *b:ale_json_jsonlint_executable*
+
+ Type: |String|
+ Default: `'jsonlint'`
+
+ The executable that will be run for jsonlint.
+
+g:ale_json_jsonlint_use_global *g:ale_json_jsonlint_use_global*
+ *b:ale_json_jsonlint_use_global*
+
+ Type: |Number|
+ Default: `get(g:, 'ale_use_global_executables', 0)`
+
+ See |ale-integrations-local-executables|
===============================================================================
diff --git a/doc/ale-powershell.txt b/doc/ale-powershell.txt
new file mode 100644
index 00000000..743b5ae3
--- /dev/null
+++ b/doc/ale-powershell.txt
@@ -0,0 +1,62 @@
+===============================================================================
+ALE PowerShell Integration *ale-powershell-options*
+
+
+===============================================================================
+psscriptanalyzer *ale-powershell-psscriptanalyzer*
+
+Installation
+-------------------------------------------------------------------------------
+
+Install PSScriptAnalyzer by any means, so long as it can be automatically
+imported in PowerShell.
+Some PowerShell plugins set the filetype of files to `ps1`. To continue using
+these plugins, use the ale_linter_aliases global to alias `ps1` to `powershell`
+
+>
+ " Allow ps1 filetype to work with powershell linters
+ let g:ale_linter_aliases = {'ps1': 'powershell'}
+<
+
+g:ale_powershell_psscriptanalyzer_executable
+*g:ale_powershell_psscriptanalyzer_executable*
+ *b:ale_powershell_psscriptanalyzer_executable*
+ Type: |String|
+ Default: `'pwsh'`
+
+ This variable sets executable used for powershell.
+
+ For example, on Windows you could set powershell to be Windows Powershell:
+>
+ let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe'
+<
+
+g:ale_powershell_psscriptanalyzer_module
+*g:ale_powershell_psscriptanalyzer_module*
+ *b:ale_powershell_psscriptanalyzer_module*
+ Type: |String
+ Default: `'psscriptanalyzer'`
+
+ This variable sets the name of the psscriptanalyzer module.
+ for psscriptanalyzer invocation.
+
+
+g:ale_powershell_psscriptanalyzer_exclusions
+*g:ale_powershell_psscriptanalyzer_exclusions*
+ *b:ale_powershell_psscriptanalyzer_exclusions*
+ Type: |String|
+ Default: `''`
+
+ Set this variable to exclude test(s) for psscriptanalyzer
+ (-ExcludeRule option). To exclude more than one option, separate them with
+ commas.
+
+>
+ " Suppress Write-Host and Global vars warnings
+ let g:ale_powershell_psscriptanalyzer_exclusions =
+ \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars'
+<
+
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt
index 8a117881..b3908289 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -118,6 +118,7 @@ Notes:
* `mix`!!
* Elm
* `elm-format`
+ * `elm-lsp`
* `elm-make`
* Erb
* `erb`
@@ -241,12 +242,14 @@ Notes:
* `luacheck`
* Mail
* `alex`!!
+ * `languagetool`!!
* `proselint`
* `vale`
* Make
* `checkmake`
* Markdown
* `alex`!!
+ * `languagetool`!!
* `markdownlint`!!
* `mdl`
* `prettier`
@@ -312,6 +315,8 @@ Notes:
* `write-good`
* Pony
* `ponyc`
+* PowerShell
+ * `psscriptanalyzer`
* Prolog
* `swipl`
* proto
@@ -332,6 +337,7 @@ Notes:
* `prospector`
* `pycodestyle`
* `pydocstyle`
+ * `pyflakes`
* `pylama`!!
* `pylint`!!
* `pyls`
@@ -417,6 +423,7 @@ Notes:
* `write-good`
* Text^
* `alex`!!
+ * `languagetool`!!
* `proselint`
* `redpen`
* `textlint`
diff --git a/doc/ale.txt b/doc/ale.txt
index 44ddb2e2..e2330cc5 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -22,8 +22,9 @@ CONTENTS *ale-contents*
6.1 Highlights........................|ale-highlights|
7. Linter/Fixer Options.................|ale-integration-options|
7.1 Options for alex..................|ale-alex-options|
- 7.2 Options for write-good............|ale-write-good-options|
- 7.3 Other Linter/Fixer Options........|ale-other-integration-options|
+ 7.2 Options for languagetool..........|ale-languagetool-options|
+ 7.3 Options for write-good............|ale-write-good-options|
+ 7.4 Other Linter/Fixer Options........|ale-other-integration-options|
8. Commands/Keybinds....................|ale-commands|
9. API..................................|ale-api|
10. Special Thanks......................|ale-special-thanks|
@@ -47,361 +48,6 @@ ALE supports the following key features for linting:
5. Setting |signs| with warnings and errors for error markers.
6. Using |echo| to show error messages when the cursor moves.
7. Setting syntax highlights for errors.
- ada...................................|ale-ada-options|
- gcc.................................|ale-ada-gcc|
- ansible...............................|ale-ansible-options|
- ansible-lint........................|ale-ansible-ansible-lint|
- asciidoc..............................|ale-asciidoc-options|
- write-good..........................|ale-asciidoc-write-good|
- textlint............................|ale-asciidoc-textlint|
- asm...................................|ale-asm-options|
- gcc.................................|ale-asm-gcc|
- awk...................................|ale-awk-options|
- gawk................................|ale-awk-gawk|
- bib...................................|ale-bib-options|
- bibclean............................|ale-bib-bibclean|
- c.....................................|ale-c-options|
- clang...............................|ale-c-clang|
- clangd..............................|ale-c-clangd|
- clang-format........................|ale-c-clangformat|
- clangtidy...........................|ale-c-clangtidy|
- cppcheck............................|ale-c-cppcheck|
- cquery..............................|ale-c-cquery|
- flawfinder..........................|ale-c-flawfinder|
- gcc.................................|ale-c-gcc|
- uncrustify..........................|ale-c-uncrustify|
- ccls................................|ale-c-ccls|
- chef..................................|ale-chef-options|
- foodcritic..........................|ale-chef-foodcritic|
- clojure...............................|ale-clojure-options|
- joker...............................|ale-clojure-joker|
- cloudformation........................|ale-cloudformation-options|
- cfn-python-lint.....................|ale-cloudformation-cfn-python-lint|
- cmake.................................|ale-cmake-options|
- cmakelint...........................|ale-cmake-cmakelint|
- cmake-format........................|ale-cmake-cmakeformat|
- cpp...................................|ale-cpp-options|
- clang...............................|ale-cpp-clang|
- clangd..............................|ale-cpp-clangd|
- clangcheck..........................|ale-cpp-clangcheck|
- clang-format........................|ale-cpp-clangformat|
- clangtidy...........................|ale-cpp-clangtidy|
- clazy...............................|ale-cpp-clazy|
- cppcheck............................|ale-cpp-cppcheck|
- cpplint.............................|ale-cpp-cpplint|
- cquery..............................|ale-cpp-cquery|
- flawfinder..........................|ale-cpp-flawfinder|
- gcc.................................|ale-cpp-gcc|
- uncrustify..........................|ale-cpp-uncrustify|
- ccls................................|ale-cpp-ccls|
- c#....................................|ale-cs-options|
- mcs.................................|ale-cs-mcs|
- mcsc................................|ale-cs-mcsc|
- uncrustify..........................|ale-cs-uncrustify|
- css...................................|ale-css-options|
- prettier............................|ale-css-prettier|
- stylelint...........................|ale-css-stylelint|
- cuda..................................|ale-cuda-options|
- nvcc................................|ale-cuda-nvcc|
- d.....................................|ale-d-options|
- dls.................................|ale-d-dls|
- uncrustify..........................|ale-d-uncrustify|
- dart..................................|ale-dart-options|
- dartanalyzer........................|ale-dart-dartanalyzer|
- dartfmt.............................|ale-dart-dartfmt|
- dockerfile............................|ale-dockerfile-options|
- dockerfile_lint.....................|ale-dockerfile-dockerfile_lint|
- hadolint............................|ale-dockerfile-hadolint|
- elixir................................|ale-elixir-options|
- mix.................................|ale-elixir-mix|
- mix_format..........................|ale-elixir-mix-format|
- dialyxir............................|ale-elixir-dialyxir|
- elixir-ls...........................|ale-elixir-elixir-ls|
- elm...................................|ale-elm-options|
- elm-format..........................|ale-elm-elm-format|
- elm-make............................|ale-elm-elm-make|
- erlang................................|ale-erlang-options|
- erlc................................|ale-erlang-erlc|
- syntaxerl...........................|ale-erlang-syntaxerl|
- eruby.................................|ale-eruby-options|
- ruumba..............................|ale-eruby-ruumba|
- fish..................................|ale-fish-options|
- fortran...............................|ale-fortran-options|
- gcc.................................|ale-fortran-gcc|
- language_server.....................|ale-fortran-language-server|
- fountain..............................|ale-fountain-options|
- fusionscript..........................|ale-fuse-options|
- fusion-lint.........................|ale-fuse-fusionlint|
- git commit............................|ale-gitcommit-options|
- gitlint.............................|ale-gitcommit-gitlint|
- glsl..................................|ale-glsl-options|
- glslang.............................|ale-glsl-glslang|
- glslls..............................|ale-glsl-glslls|
- go....................................|ale-go-options|
- gobuild.............................|ale-go-gobuild|
- gofmt...............................|ale-go-gofmt|
- golint..............................|ale-go-golint|
- govet...............................|ale-go-govet|
- gometalinter........................|ale-go-gometalinter|
- staticcheck.........................|ale-go-staticcheck|
- golangserver........................|ale-go-golangserver|
- golangci-lint.......................|ale-go-golangci-lint|
- bingo...............................|ale-go-bingo|
- graphql...............................|ale-graphql-options|
- eslint..............................|ale-graphql-eslint|
- gqlint..............................|ale-graphql-gqlint|
- prettier............................|ale-graphql-prettier|
- hack..................................|ale-hack-options|
- hack................................|ale-hack-hack|
- hackfmt.............................|ale-hack-hackfmt|
- hhast...............................|ale-hack-hhast|
- handlebars............................|ale-handlebars-options|
- ember-template-lint.................|ale-handlebars-embertemplatelint|
- haskell...............................|ale-haskell-options|
- brittany............................|ale-haskell-brittany|
- ghc.................................|ale-haskell-ghc|
- ghc-mod.............................|ale-haskell-ghc-mod|
- cabal-ghc...........................|ale-haskell-cabal-ghc|
- hdevtools...........................|ale-haskell-hdevtools|
- hfmt................................|ale-haskell-hfmt|
- hlint...............................|ale-haskell-hlint|
- stack-build.........................|ale-haskell-stack-build|
- stack-ghc...........................|ale-haskell-stack-ghc|
- stylish-haskell.....................|ale-haskell-stylish-haskell|
- hie.................................|ale-haskell-hie|
- hcl...................................|ale-hcl-options|
- terraform-fmt.......................|ale-hcl-terraform-fmt|
- html..................................|ale-html-options|
- htmlhint............................|ale-html-htmlhint|
- tidy................................|ale-html-tidy|
- prettier............................|ale-html-prettier|
- stylelint...........................|ale-html-stylelint|
- write-good..........................|ale-html-write-good|
- idris.................................|ale-idris-options|
- idris...............................|ale-idris-idris|
- ispc..................................|ale-ispc-options|
- ispc................................|ale-ispc-ispc|
- java..................................|ale-java-options|
- checkstyle..........................|ale-java-checkstyle|
- javac...............................|ale-java-javac|
- google-java-format..................|ale-java-google-java-format|
- pmd.................................|ale-java-pmd|
- javalsp.............................|ale-java-javalsp|
- uncrustify..........................|ale-java-uncrustify|
- javascript............................|ale-javascript-options|
- eslint..............................|ale-javascript-eslint|
- flow................................|ale-javascript-flow|
- importjs............................|ale-javascript-importjs|
- jscs................................|ale-javascript-jscs|
- jshint..............................|ale-javascript-jshint|
- prettier............................|ale-javascript-prettier|
- prettier-eslint.....................|ale-javascript-prettier-eslint|
- prettier-standard...................|ale-javascript-prettier-standard|
- standard............................|ale-javascript-standard|
- xo..................................|ale-javascript-xo|
- json..................................|ale-json-options|
- fixjson.............................|ale-json-fixjson|
- jsonlint............................|ale-json-jsonlint|
- jq..................................|ale-json-jq|
- prettier............................|ale-json-prettier|
- julia.................................|ale-julia-options|
- languageserver......................|ale-julia-languageserver|
- kotlin................................|ale-kotlin-options|
- kotlinc.............................|ale-kotlin-kotlinc|
- ktlint..............................|ale-kotlin-ktlint|
- languageserver......................|ale-kotlin-languageserver|
- latex.................................|ale-latex-options|
- write-good..........................|ale-latex-write-good|
- textlint............................|ale-latex-textlint|
- less..................................|ale-less-options|
- lessc...............................|ale-less-lessc|
- prettier............................|ale-less-prettier|
- stylelint...........................|ale-less-stylelint|
- llvm..................................|ale-llvm-options|
- llc.................................|ale-llvm-llc|
- lua...................................|ale-lua-options|
- luac................................|ale-lua-luac|
- luacheck............................|ale-lua-luacheck|
- markdown..............................|ale-markdown-options|
- mdl.................................|ale-markdown-mdl|
- prettier............................|ale-markdown-prettier|
- remark-lint.........................|ale-markdown-remark-lint|
- textlint............................|ale-markdown-textlint|
- 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|
- clang...............................|ale-objc-clang|
- clangd..............................|ale-objc-clangd|
- uncrustify..........................|ale-objc-uncrustify|
- ccls................................|ale-objc-ccls|
- objcpp................................|ale-objcpp-options|
- clang...............................|ale-objcpp-clang|
- clangd..............................|ale-objcpp-clangd|
- uncrustify..........................|ale-objcpp-uncrustify|
- ocaml.................................|ale-ocaml-options|
- merlin..............................|ale-ocaml-merlin|
- ols.................................|ale-ocaml-ols|
- ocamlformat.........................|ale-ocaml-ocamlformat|
- pawn..................................|ale-pawn-options|
- uncrustify..........................|ale-pawn-uncrustify|
- perl..................................|ale-perl-options|
- perl................................|ale-perl-perl|
- perlcritic..........................|ale-perl-perlcritic|
- perltidy............................|ale-perl-perltidy|
- perl6.................................|ale-perl6-options|
- perl6...............................|ale-perl6-perl6|
- php...................................|ale-php-options|
- langserver..........................|ale-php-langserver|
- phan................................|ale-php-phan|
- phpcbf..............................|ale-php-phpcbf|
- phpcs...............................|ale-php-phpcs|
- phpmd...............................|ale-php-phpmd|
- phpstan.............................|ale-php-phpstan|
- psalm...............................|ale-php-psalm|
- php-cs-fixer........................|ale-php-php-cs-fixer|
- php.................................|ale-php-php|
- po....................................|ale-po-options|
- write-good..........................|ale-po-write-good|
- pod...................................|ale-pod-options|
- write-good..........................|ale-pod-write-good|
- pony..................................|ale-pony-options|
- ponyc...............................|ale-pony-ponyc|
- prolog................................|ale-prolog-options|
- swipl...............................|ale-prolog-swipl|
- proto.................................|ale-proto-options|
- protoc-gen-lint.....................|ale-proto-protoc-gen-lint|
- pug...................................|ale-pug-options|
- puglint.............................|ale-pug-puglint|
- puppet................................|ale-puppet-options|
- puppet..............................|ale-puppet-puppet|
- puppetlint..........................|ale-puppet-puppetlint|
- puppet-languageserver...............|ale-puppet-languageserver|
- pyrex (cython)........................|ale-pyrex-options|
- cython..............................|ale-pyrex-cython|
- python................................|ale-python-options|
- autopep8............................|ale-python-autopep8|
- bandit..............................|ale-python-bandit|
- black...............................|ale-python-black|
- flake8..............................|ale-python-flake8|
- isort...............................|ale-python-isort|
- mypy................................|ale-python-mypy|
- prospector..........................|ale-python-prospector|
- pycodestyle.........................|ale-python-pycodestyle|
- pydocstyle..........................|ale-python-pydocstyle|
- pyflakes............................|ale-python-pyflakes|
- pylama..............................|ale-python-pylama|
- pylint..............................|ale-python-pylint|
- pyls................................|ale-python-pyls|
- pyre................................|ale-python-pyre|
- vulture.............................|ale-python-vulture|
- yapf................................|ale-python-yapf|
- qml...................................|ale-qml-options|
- qmlfmt..............................|ale-qml-qmlfmt|
- r.....................................|ale-r-options|
- lintr...............................|ale-r-lintr|
- reasonml..............................|ale-reasonml-options|
- merlin..............................|ale-reasonml-merlin|
- ols.................................|ale-reasonml-ols|
- refmt...............................|ale-reasonml-refmt|
- restructuredtext......................|ale-restructuredtext-options|
- textlint............................|ale-restructuredtext-textlint|
- write-good..........................|ale-restructuredtext-write-good|
- ruby..................................|ale-ruby-options|
- brakeman............................|ale-ruby-brakeman|
- rails_best_practices................|ale-ruby-rails_best_practices|
- reek................................|ale-ruby-reek|
- rubocop.............................|ale-ruby-rubocop|
- ruby................................|ale-ruby-ruby|
- rufo................................|ale-ruby-rufo|
- solargraph..........................|ale-ruby-solargraph|
- standardrb..........................|ale-ruby-standardrb|
- rust..................................|ale-rust-options|
- cargo...............................|ale-rust-cargo|
- rls.................................|ale-rust-rls|
- rustc...............................|ale-rust-rustc|
- rustfmt.............................|ale-rust-rustfmt|
- sass..................................|ale-sass-options|
- sasslint............................|ale-sass-sasslint|
- stylelint...........................|ale-sass-stylelint|
- scala.................................|ale-scala-options|
- sbtserver...........................|ale-scala-sbtserver|
- scalafmt............................|ale-scala-scalafmt|
- scalastyle..........................|ale-scala-scalastyle|
- scss..................................|ale-scss-options|
- prettier............................|ale-scss-prettier|
- sasslint............................|ale-scss-sasslint|
- stylelint...........................|ale-scss-stylelint|
- sh....................................|ale-sh-options|
- sh-language-server..................|ale-sh-language-server|
- shell...............................|ale-sh-shell|
- shellcheck..........................|ale-sh-shellcheck|
- shfmt...............................|ale-sh-shfmt|
- sml...................................|ale-sml-options|
- smlnj...............................|ale-sml-smlnj|
- solidity..............................|ale-solidity-options|
- solhint.............................|ale-solidity-solhint|
- solium..............................|ale-solidity-solium|
- spec..................................|ale-spec-options|
- rpmlint.............................|ale-spec-rpmlint|
- sql...................................|ale-sql-options|
- sqlfmt..............................|ale-sql-sqlfmt|
- stylus................................|ale-stylus-options|
- stylelint...........................|ale-stylus-stylelint|
- sugarss...............................|ale-sugarss-options|
- stylelint...........................|ale-sugarss-stylelint|
- tcl...................................|ale-tcl-options|
- nagelfar............................|ale-tcl-nagelfar|
- terraform.............................|ale-terraform-options|
- fmt.................................|ale-terraform-fmt|
- tflint..............................|ale-terraform-tflint|
- tex...................................|ale-tex-options|
- chktex..............................|ale-tex-chktex|
- lacheck.............................|ale-tex-lacheck|
- texinfo...............................|ale-texinfo-options|
- write-good..........................|ale-texinfo-write-good|
- text..................................|ale-text-options|
- textlint............................|ale-text-textlint|
- write-good..........................|ale-text-write-good|
- thrift................................|ale-thrift-options|
- thrift..............................|ale-thrift-thrift|
- typescript............................|ale-typescript-options|
- eslint..............................|ale-typescript-eslint|
- prettier............................|ale-typescript-prettier|
- tslint..............................|ale-typescript-tslint|
- tsserver............................|ale-typescript-tsserver|
- vala..................................|ale-vala-options|
- uncrustify..........................|ale-vala-uncrustify|
- verilog/systemverilog.................|ale-verilog-options|
- iverilog............................|ale-verilog-iverilog|
- verilator...........................|ale-verilog-verilator|
- vlog................................|ale-verilog-vlog|
- xvlog...............................|ale-verilog-xvlog|
- vhdl..................................|ale-vhdl-options|
- ghdl................................|ale-vhdl-ghdl|
- vcom................................|ale-vhdl-vcom|
- xvhdl...............................|ale-vhdl-xvhdl|
- vim...................................|ale-vim-options|
- vint................................|ale-vim-vint|
- vim help..............................|ale-vim-help-options|
- write-good..........................|ale-vim-help-write-good|
- vue...................................|ale-vue-options|
- prettier............................|ale-vue-prettier|
- vls.................................|ale-vue-vls|
- xhtml.................................|ale-xhtml-options|
- write-good..........................|ale-xhtml-write-good|
- xml...................................|ale-xml-options|
- xmllint.............................|ale-xml-xmllint|
- yaml..................................|ale-yaml-options|
- prettier............................|ale-yaml-prettier|
- swaglint............................|ale-yaml-swaglint|
- yamllint............................|ale-yaml-yamllint|
- yang..................................|ale-yang-options|
- yang-lsp............................|ale-yang-lsp|
ALE can fix problems with files with the |ALEFix| command, using the same job
control functionality used for checking for problems. Try using the
@@ -699,13 +345,13 @@ with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|.
The |ALEComplete| command can be used to show completion suggestions manually,
even when |g:ale_completion_enabled| is set to `0`.
- *ale-completion-completopt-bug*
+ *ale-completion-completeopt-bug*
-ALE implements completion as you type by temporarily adjusting |completeopt|
-before opening the omnicomplete menu with <C-x><C-o>. In some versions of Vim,
-the value set for the option will not be respected. If you experience issues
-with Vim automatically inserting text while you type, set the following option
-in vimrc, and your issues should go away. >
+Automatic completion replaces |completeopt| before opening the omnicomplete
+menu with <C-x><C-o>. In some versions of Vim, the value set for the option
+will not be respected. If you experience issues with Vim automatically
+inserting text while you type, set the following option in vimrc, and your
+issues should go away. >
set completeopt=menu,menuone,preview,noselect,noinsert
<
@@ -965,6 +611,16 @@ g:ale_cursor_detail *g:ale_cursor_detail*
loaded for messages to be displayed. See |ale-lint-settings-on-startup|.
+g:ale_disable_lsp *g:ale_disable_lsp*
+ *b:ale_disable_lsp*
+
+ Type: |Number|
+ Default: `0`
+
+ When this option is set to `1`, ALE ignores all linters powered by LSP.
+ Please see also |ale-lsp|.
+
+
g:ale_echo_cursor *g:ale_echo_cursor*
Type: |Number|
@@ -1338,7 +994,7 @@ g:ale_linters *g:ale_linters*
{
\ 'csh': ['shell'],
- \ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
+ \ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'go vet'],
\ 'hack': ['hack'],
\ 'help': [],
@@ -2136,7 +1792,19 @@ g:ale_alex_use_global *g:ale_alex_use_global*
-------------------------------------------------------------------------------
-7.2. Options for write-good *ale-write-good-options*
+7.2. Options for languagetool *ale-languagetool-options*
+
+g:ale_languagetool_executable *g:ale_languagetool_executable*
+ *b:ale_languagetool_executable*
+
+ Type: |String|
+ Default: `'languagetool'`
+
+ The executable to run for languagetool.
+
+
+-------------------------------------------------------------------------------
+7.3. Options for write-good *ale-write-good-options*
The options for `write-good` are shared between all filetypes, so options can
be configured once.
@@ -2166,7 +1834,7 @@ g:ale_writegood_use_global *g:ale_writegood_use_global*
-------------------------------------------------------------------------------
-7.3. Other Linter/Fixer Options *ale-other-integration-options*
+7.4. Other Linter/Fixer Options *ale-other-integration-options*
ALE supports a very wide variety of tools. Other linter or fixer options are
documented in additional help files.
@@ -2227,6 +1895,7 @@ documented in additional help files.
stylelint.............................|ale-css-stylelint|
cuda....................................|ale-cuda-options|
nvcc..................................|ale-cuda-nvcc|
+ clang-format..........................|ale-cuda-clangformat|
d.......................................|ale-d-options|
dls...................................|ale-d-dls|
uncrustify............................|ale-d-uncrustify|
@@ -2241,8 +1910,10 @@ documented in additional help files.
mix_format............................|ale-elixir-mix-format|
dialyxir..............................|ale-elixir-dialyxir|
elixir-ls.............................|ale-elixir-elixir-ls|
+ credo.................................|ale-elixir-credo|
elm.....................................|ale-elm-options|
elm-format............................|ale-elm-elm-format|
+ elm-lsp...............................|ale-elm-elm-lsp|
elm-make..............................|ale-elm-elm-make|
erlang..................................|ale-erlang-options|
erlc..................................|ale-erlang-erlc|
@@ -2395,6 +2066,8 @@ documented in additional help files.
write-good............................|ale-pod-write-good|
pony....................................|ale-pony-options|
ponyc.................................|ale-pony-ponyc|
+ powershell............................|ale-powershell-options|
+ psscriptanalyzer....................|ale-powershell-psscriptanalyzer|
prolog..................................|ale-prolog-options|
swipl.................................|ale-prolog-swipl|
proto...................................|ale-proto-options|
diff --git a/plugin/ale.vim b/plugin/ale.vim
index 1df473c5..ad3d3e56 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -216,7 +216,7 @@ command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor()
" Search for appearances of a symbol, such as a type name or function name.
command! -nargs=1 ALESymbolSearch :call ale#symbol#Search(<q-args>)
-command! -bar ALEComplete :call ale#completion#AlwaysGetCompletions(0)
+command! -bar ALEComplete :call ale#completion#GetCompletions(1)
" <Plug> mappings for commands
nnoremap <silent> <Plug>(ale_previous) :ALEPrevious<Return>
diff --git a/supported-tools.md b/supported-tools.md
index c4e20fed..d2010e03 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -123,10 +123,11 @@ formatting.
* [credo](https://github.com/rrrene/credo)
* [dialyxir](https://github.com/jeremyjh/dialyxir)
* [dogma](https://github.com/lpil/dogma)
- * [elixir-ls](https://github.com/JakeBecker/elixir-ls)
+ * [elixir-ls](https://github.com/JakeBecker/elixir-ls) :warning:
* [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk:
* Elm
* [elm-format](https://github.com/avh4/elm-format)
+ * [elm-lsp](https://github.com/antew/elm-lsp)
* [elm-make](https://github.com/elm-lang/elm-make)
* Erb
* [erb](https://apidock.com/ruby/ERB)
@@ -250,12 +251,14 @@ formatting.
* [luacheck](https://github.com/mpeterv/luacheck)
* Mail
* [alex](https://github.com/wooorm/alex) :floppy_disk:
+ * [languagetool](https://languagetool.org/) :floppy_disk:
* [proselint](http://proselint.com/)
* [vale](https://github.com/ValeLint/vale)
* Make
* [checkmake](https://github.com/mrtazz/checkmake)
* Markdown
* [alex](https://github.com/wooorm/alex) :floppy_disk:
+ * [languagetool](https://languagetool.org/) :floppy_disk:
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
* [mdl](https://github.com/mivok/markdownlint)
* [prettier](https://github.com/prettier/prettier)
@@ -321,6 +324,8 @@ formatting.
* [write-good](https://github.com/btford/write-good)
* Pony
* [ponyc](https://github.com/ponylang/ponyc)
+* PowerShell
+ * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) :floppy_disk
* Prolog
* [swipl](https://github.com/SWI-Prolog/swipl-devel)
* proto
@@ -341,6 +346,7 @@ formatting.
* [prospector](https://github.com/PyCQA/prospector) :warning:
* [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning:
* [pydocstyle](https://www.pydocstyle.org/) :warning:
+ * [pyflakes](https://github.com/PyCQA/pyflakes)
* [pylama](https://github.com/klen/pylama) :floppy_disk:
* [pylint](https://www.pylint.org/) :floppy_disk:
* [pyls](https://github.com/palantir/python-language-server) :warning:
@@ -426,6 +432,7 @@ formatting.
* [write-good](https://github.com/btford/write-good)
* Text
* [alex](https://github.com/wooorm/alex) :warning: :floppy_disk:
+ * [languagetool](https://languagetool.org/) :floppy_disk:
* [proselint](http://proselint.com/) :warning:
* [redpen](http://redpen.cc/) :warning:
* [textlint](https://textlint.github.io/) :warning:
diff --git a/test/command_callback/php-langserver-project/with-composer/composer.json b/test/command_callback/php-langserver-project/with-composer/composer.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/php-langserver-project/with-composer/composer.json
diff --git a/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php b/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/php-langserver-project/with-composer/vendor/bin/php-language-server.php
diff --git a/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php b/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/php-langserver-project/with-git/vendor/bin/php-language-server.php
diff --git a/test/command_callback/test_elixir_credo.vader b/test/command_callback/test_elixir_credo.vader
new file mode 100644
index 00000000..1a146db8
--- /dev/null
+++ b/test/command_callback/test_elixir_credo.vader
@@ -0,0 +1,28 @@
+Before:
+ call ale#assert#SetUpLinterTest('elixir', 'credo')
+ call ale#test#SetFilename('elixir_paths/mix_project/lib/app.ex')
+
+
+After:
+ unlet! g:ale_elixir_credo_strict
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(Builds credo command with --strict mode when set to 1):
+ let g:ale_elixir_credo_strict = 1
+
+ AssertLinter 'mix',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
+ \ . 'mix help credo && mix credo --strict --format=flycheck --read-from-stdin %s'
+
+Execute(Builds credo command with suggest mode by default):
+ 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 suggest mode when set to 0):
+ let g:ale_elixir_credo_strict = 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'
diff --git a/test/command_callback/test_elm_lsp_command_callbacks.vader b/test/command_callback/test_elm_lsp_command_callbacks.vader
new file mode 100644
index 00000000..d06ef134
--- /dev/null
+++ b/test/command_callback/test_elm_lsp_command_callbacks.vader
@@ -0,0 +1,29 @@
+Before:
+ call ale#assert#SetUpLinterTest('elm', 'elm_lsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default executable path should be correct):
+ call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm')
+
+ AssertLinter 'elm-lsp', ale#Escape('elm-lsp') . ' --stdio'
+
+Execute(The project root should be detected correctly):
+ AssertLSPProject ''
+
+ call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/../elm-test-files/newapp')
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('../elm-test-files/newapp/src/Main.elm')
+
+ let g:ale_elm_lsp_executable = '/path/to/custom/elm-lsp'
+ let g:ale_elm_lsp_use_global = 1
+
+ AssertLinter '/path/to/custom/elm-lsp',
+ \ ale#Escape('/path/to/custom/elm-lsp') . ' --stdio'
+
+Execute(The language should be correct):
+ AssertLSPLanguage 'elm'
diff --git a/test/command_callback/test_languagetool_command_callback.vader b/test/command_callback/test_languagetool_command_callback.vader
new file mode 100644
index 00000000..a79662b9
--- /dev/null
+++ b/test/command_callback/test_languagetool_command_callback.vader
@@ -0,0 +1,15 @@
+Before:
+ call ale#assert#SetUpLinterTest('text', 'languagetool')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'languagetool', ale#Escape('languagetool')
+ \ . ' --autoDetect %s'
+
+Execute(Should be able to set a custom executable):
+ let g:ale_languagetool_executable = 'foobar'
+
+ AssertLinter 'foobar' , ale#Escape('foobar')
+ \ . ' --autoDetect %s'
diff --git a/test/command_callback/test_php_langserver_callbacks.vader b/test/command_callback/test_php_langserver_callbacks.vader
index 3b0a427e..59c3fe6c 100644
--- a/test/command_callback/test_php_langserver_callbacks.vader
+++ b/test/command_callback/test_php_langserver_callbacks.vader
@@ -2,10 +2,6 @@ Before:
call ale#assert#SetUpLinterTest('php', 'langserver')
After:
- if isdirectory(g:dir . '/.git')
- call delete(g:dir . '/.git', 'd')
- endif
-
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
@@ -23,7 +19,12 @@ Execute(Vendor executables should be detected):
\ ))
Execute(The project path should be correct for .git directories):
- call ale#test#SetFilename('php-langserver-project/test.php')
- call mkdir(g:dir . '/.git')
+ call ale#test#SetFilename('php-langserver-project/with-git/test.php')
+ silent! call mkdir('php-langserver-project/with-git/.git')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/php-langserver-project/with-git')
+
+Execute(The project path should be correct for composer.json file):
+ call ale#test#SetFilename('php-langserver-project/with-composer/test.php')
- AssertLSPProject g:dir
+ AssertLSPProject ale#path#Simplify(g:dir . '/php-langserver-project/with-composer')
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
index d731054f..33d770c2 100644
--- a/test/command_callback/test_psalm_command_callbacks.vader
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -24,6 +24,9 @@ Execute(Vendor executables should be detected):
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('psalm-project/test.php')
- call mkdir(g:dir . '/.git')
- AssertLSPProject g:dir \ No newline at end of file
+ if !isdirectory(g:dir . '/.git')
+ call mkdir(g:dir . '/.git')
+ endif
+
+ AssertLSPProject g:dir
diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader
index 3f0bfa70..d04a8085 100644
--- a/test/completion/test_completion_events.vader
+++ b/test/completion/test_completion_events.vader
@@ -27,7 +27,7 @@ Before:
let g:get_completions_called = 0
" We just want to check if the function is called.
- function! ale#completion#GetCompletions()
+ function! ale#completion#GetCompletions(manual)
let g:get_completions_called = 1
endfunction
@@ -53,7 +53,7 @@ After:
unlet! g:fake_mode
unlet! g:get_completions_called
unlet! b:ale_old_omnifunc
- unlet! b:ale_old_completopt
+ unlet! b:ale_old_completeopt
unlet! b:ale_completion_info
unlet! b:ale_completion_response
unlet! b:ale_completion_parser
@@ -86,7 +86,7 @@ Execute(ale#completion#GetCompletions should not be called when the cursor posit
call setpos('.', [bufnr(''), 1, 2, 0])
" We just want to check if the function is called.
- function! ale#completion#GetCompletions()
+ function! ale#completion#GetCompletions(manual)
let g:get_completions_called = 1
endfunction
@@ -105,7 +105,7 @@ Execute(ale#completion#GetCompletions should not be called if you switch to norm
let g:fake_mode = 'n'
" We just want to check if the function is called.
- function! ale#completion#GetCompletions()
+ function! ale#completion#GetCompletions(manual)
let g:get_completions_called = 1
endfunction
@@ -138,7 +138,7 @@ Execute(ale#completion#Show() should remember the completeopt setting and replac
call ale#completion#Show('Response', 'Parser')
- AssertEqual 'menu', b:ale_old_completopt
+ AssertEqual 'menu', b:ale_old_completeopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
AssertEqual [], g:feedkeys_calls
@@ -150,19 +150,32 @@ Execute(ale#completion#Show() should set the preview option if it's set):
call ale#completion#Show('Response', 'Parser')
- AssertEqual 'menu,preview', b:ale_old_completopt
+ AssertEqual 'menu,preview', b:ale_old_completeopt
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
AssertEqual [], g:feedkeys_calls
sleep 1ms
AssertEqual [["\<Plug>(ale_show_completion_menu)"]], g:feedkeys_calls
+Execute(ale#completion#Show() should not replace the completeopt setting for manual completion):
+ let b:ale_completion_info = {'manual': 1}
+
+ let &l:completeopt = 'menu,preview'
+
+ call ale#completion#Show('Response', 'Parser')
+
+ Assert !exists('b:ale_old_completeopt')
+
+ AssertEqual [], g:feedkeys_calls
+ sleep 1ms
+ AssertEqual [["\<Plug>(ale_show_completion_menu)"]], g:feedkeys_calls
+
Execute(ale#completion#OmniFunc() should also remember the completeopt setting and replace it):
let &l:completeopt = 'menu'
call ale#completion#OmniFunc(0, '')
- AssertEqual 'menu', b:ale_old_completopt
+ AssertEqual 'menu', b:ale_old_completeopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
Execute(ale#completion#OmniFunc() should set the preview option if it's set):
@@ -170,7 +183,7 @@ Execute(ale#completion#OmniFunc() should set the preview option if it's set):
call ale#completion#OmniFunc(0, '')
- AssertEqual 'menu,preview', b:ale_old_completopt
+ AssertEqual 'menu,preview', b:ale_old_completeopt
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
Execute(ale#completion#Show() should make the correct feedkeys() call):
@@ -188,7 +201,7 @@ Execute(ale#completion#Show() shouldn't do anything if you switch back to normal
AssertEqual 'menu,preview', &l:completeopt
Assert !exists('b:ale_old_omnifunc')
- Assert !exists('b:ale_old_completopt')
+ Assert !exists('b:ale_old_completeopt')
Assert !exists('b:ale_completion_response')
Assert !exists('b:ale_completion_parser')
AssertEqual [], g:feedkeys_calls
@@ -209,12 +222,12 @@ Execute(ale#completion#Done() should restore old omnifunc values):
Assert !has_key(b:, 'ale_old_omnifunc')
Execute(ale#completion#Done() should restore the old completeopt setting):
- let b:ale_old_completopt = 'menu'
+ let b:ale_old_completeopt = 'menu'
call ale#completion#Done()
AssertEqual 'menu', &l:completeopt
- Assert !has_key(b:, 'ale_old_completopt')
+ Assert !has_key(b:, 'ale_old_completeopt')
Execute(ale#completion#Done() should leave settings alone when none were remembered):
let &l:omnifunc = 'BazBoz'
@@ -236,7 +249,23 @@ Execute(The completion request_id should be reset when queuing again):
Execute(b:ale_completion_info should be set up correctly when requesting completions):
call setpos('.', [bufnr(''), 3, 14, 0])
- call ale#completion#GetCompletions()
+ call ale#completion#GetCompletions(0)
+
+ AssertEqual
+ \ {
+ \ 'request_id': 0,
+ \ 'conn_id': 0,
+ \ 'column': 14,
+ \ 'line_length': 14,
+ \ 'line': 3,
+ \ 'prefix': 'ab',
+ \ 'manual': 0,
+ \ },
+ \ b:ale_completion_info
+
+Execute(b:ale_completion_info should be set up correctly when requesting completions):
+ call setpos('.', [bufnr(''), 3, 14, 0])
+ ALEComplete
AssertEqual
\ {
@@ -246,6 +275,7 @@ Execute(b:ale_completion_info should be set up correctly when requesting complet
\ 'line_length': 14,
\ 'line': 3,
\ 'prefix': 'ab',
+ \ 'manual': 1,
\ },
\ b:ale_completion_info
@@ -264,7 +294,7 @@ Execute(The correct keybinds should be configured):
Execute(Running the normal mode <Plug> keybind should reset the settings):
let b:ale_old_omnifunc = 'FooBar'
- let b:ale_old_completopt = 'menu'
+ let b:ale_old_completeopt = 'menu'
" We can't run the keybind, but we can call the function.
call ale#completion#RestoreCompletionOptions()
@@ -272,4 +302,4 @@ Execute(Running the normal mode <Plug> keybind should reset the settings):
AssertEqual 'FooBar', &l:omnifunc
AssertEqual 'menu', &l:completeopt
Assert !has_key(b:, 'ale_old_omnifunc')
- Assert !has_key(b:, 'ale_old_completopt')
+ Assert !has_key(b:, 'ale_old_completeopt')
diff --git a/test/completion/test_lsp_completion_messages.vader b/test/completion/test_lsp_completion_messages.vader
index c83ad8e1..dce61e36 100644
--- a/test/completion/test_lsp_completion_messages.vader
+++ b/test/completion/test_lsp_completion_messages.vader
@@ -67,7 +67,7 @@ After:
unlet! g:conn_id
unlet! g:Callback
unlet! b:ale_old_omnifunc
- unlet! b:ale_old_completopt
+ unlet! b:ale_old_completeopt
unlet! b:ale_completion_info
unlet! b:ale_completion_response
unlet! b:ale_completion_parser
@@ -102,7 +102,7 @@ Execute(The right message should be sent for the initial tsserver request):
" The cursor position needs to match what was saved before.
call setpos('.', [bufnr(''), 1, 3, 0])
- call ale#completion#GetCompletions()
+ call ale#completion#GetCompletions(0)
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
@@ -129,6 +129,7 @@ Execute(The right message should be sent for the initial tsserver request):
\ 'request_id': 1,
\ 'line': 1,
\ 'prefix': 'fo',
+ \ 'manual': 0,
\ },
\ get(b:, 'ale_completion_info', {})
@@ -190,7 +191,7 @@ Execute(The right message should be sent for the initial LSP request):
" The cursor position needs to match what was saved before.
call setpos('.', [bufnr(''), 1, 5, 0])
- call ale#completion#GetCompletions()
+ call ale#completion#GetCompletions(0)
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
@@ -233,6 +234,7 @@ Execute(The right message should be sent for the initial LSP request):
\ 'request_id': 1,
\ 'line': 1,
\ 'prefix': 'fo',
+ \ 'manual': 0,
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ },
\ get(b:, 'ale_completion_info', {})
@@ -258,7 +260,7 @@ Execute(Two completion requests shouldn't be sent in a row):
" The cursor position needs to match what was saved before.
call setpos('.', [bufnr(''), 1, 5, 0])
- call ale#completion#GetCompletions()
+ call ale#completion#GetCompletions(0)
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
diff --git a/test/completion/test_lsp_completion_parsing.vader b/test/completion/test_lsp_completion_parsing.vader
index 71e53ab6..a8e00260 100644
--- a/test/completion/test_lsp_completion_parsing.vader
+++ b/test/completion/test_lsp_completion_parsing.vader
@@ -471,3 +471,34 @@ Execute(Should handle documentation in the markdown format):
\ ],
\ },
\ })
+
+Execute(Should handle completion messages with textEdit objects):
+ AssertEqual
+ \ [
+ \ {'word': 'next_callback', 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1},
+ \ ],
+ \ ale#completion#ParseLSPCompletions({
+ \ 'id': 226,
+ \ 'jsonrpc': '2.0',
+ \ 'result': {
+ \ 'isIncomplete': v:false,
+ \ 'items': [
+ \ {
+ \ 'detail': 'PlayTimeCallback',
+ \ 'filterText': 'next_callback',
+ \ 'insertText': 'next_callback',
+ \ 'insertTextFormat': 1,
+ \ 'kind': 6,
+ \ 'label': ' next_callback',
+ \ 'sortText': '3ee19999next_callback',
+ \ 'textEdit': {
+ \ 'newText': 'next_callback',
+ \ 'range': {
+ \ 'end': {'character': 13, 'line': 12},
+ \ 'start': {'character': 4, 'line': 12},
+ \ },
+ \ },
+ \ },
+ \ ],
+ \ },
+ \ })
diff --git a/test/handler/test_languagetool_handler.vader b/test/handler/test_languagetool_handler.vader
new file mode 100644
index 00000000..61d3abfd
--- /dev/null
+++ b/test/handler/test_languagetool_handler.vader
@@ -0,0 +1,62 @@
+Before:
+ runtime! ale_linters/text/languagetool.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(languagetool handler should report 3 errors):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 19,
+ \ 'end_col': 20,
+ \ 'text': 'This sentence does not start with an uppercase letter',
+ \ 'type': 'W',
+ \ 'code': 'UPPERCASE_SENTENCE_START',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 36,
+ \ 'end_col': 42,
+ \ 'text': "Did you mean 'to see'?",
+ \ 'type': 'W',
+ \ 'code': 'TOO_TO[1]',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 44,
+ \ 'end_col': 45,
+ \ 'text': "Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'",
+ \ 'type': 'W',
+ \ 'code': 'EN_A_VS_AN',
+ \ }
+ \ ],
+ \ ale#handlers#languagetool#HandleOutput(bufnr(''), [
+ \ '1.) Line 3, column 19, Rule ID: UPPERCASE_SENTENCE_START',
+ \ 'Message: This sentence does not start with an uppercase letter',
+ \ 'Suggestion: Or',
+ \ '...red phrases for details on potential errors. or use this text too see an few of of the probl...',
+ \ ' ^^ ',
+ \ '',
+ \ '2.) Line 3, column 36, Rule ID: TOO_TO[1]',
+ \ "Message: Did you mean 'to see'?",
+ \ 'Suggestion: to see',
+ \ '...etails on potential errors. or use this text too see an few of of the problems that LanguageTool ...',
+ \ ' ^^^^^^^ ',
+ \ '',
+ \ '3.) Line 3, column 44, Rule ID: EN_A_VS_AN',
+ \ "Message: Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'",
+ \ 'Suggestion: a',
+ \ '...n potential errors. or use this text too see an few of of the problems that LanguageTool can...',
+ \ ' ^^ ',
+ \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)'
+ \ ])
+
+Execute(languagetool handler should report no errors on empty input):
+ AssertEqual
+ \ [],
+ \ ale#handlers#languagetool#HandleOutput(bufnr(''), [
+ \ '',
+ \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)'
+ \ ])
diff --git a/test/handler/test_psscriptanalyzer_handler.vader b/test/handler/test_psscriptanalyzer_handler.vader
new file mode 100644
index 00000000..060d5941
--- /dev/null
+++ b/test/handler/test_psscriptanalyzer_handler.vader
@@ -0,0 +1,42 @@
+Before:
+ runtime ale_linters/powershell/psscriptanalyzer.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The psscriptanalyzer handler should handle basic information or warnings):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'I',
+ \ 'text': 'The cmdlet ''Get-GithubRepo'' does not have a help comment.',
+ \ 'code': 'PSProvideCommentHelp',
+ \ },
+ \ {
+ \ 'lnum': 9,
+ \ 'type': 'W',
+ \ 'text': '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.',
+ \ 'code': 'PSAvoidUsingCmdletAliases',
+ \ },
+ \ {
+ \ 'lnum': 23,
+ \ 'type': 'E',
+ \ 'text': 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.',
+ \ 'code': 'PSAvoidUsingComputerNameHardcoded',
+ \ },
+ \ ],
+ \ ale_linters#powershell#psscriptanalyzer#Handle(bufnr(''), [
+ \ '1',
+ \ 'Information',
+ \ 'The cmdlet ''Get-GithubRepo'' does not have a help comment.',
+ \ 'PSProvideCommentHelp',
+ \ '9',
+ \ 'Warning',
+ \ '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.',
+ \ 'PSAvoidUsingCmdletAliases',
+ \ '23',
+ \ 'Error',
+ \ 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.',
+ \ 'PSAvoidUsingComputerNameHardcoded',
+ \ ])
diff --git a/test/handler/test_redpen_handler.vader b/test/handler/test_redpen_handler.vader
index 4490bcba..0b030e2d 100644
--- a/test/handler/test_redpen_handler.vader
+++ b/test/handler/test_redpen_handler.vader
@@ -80,7 +80,7 @@ Execute(redpen handler should handle errors output):
\ ']',
\ ])
-Execute(redpen handler should no error output):
+Execute(The redpen handler should handle an empty error list):
AssertEqual
\ [],
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
@@ -91,3 +91,8 @@ Execute(redpen handler should no error output):
\ ' }',
\ ']',
\ ])
+
+Execute(The redpen handler should handle totally empty output):
+ AssertEqual
+ \ [],
+ \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [])
diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader
index 4764e713..56db9b36 100644
--- a/test/handler/test_rust_handler.vader
+++ b/test/handler/test_rust_handler.vader
@@ -8,7 +8,7 @@ Execute(The Rust handler should handle rustc output):
\ 'end_lnum': 15,
\ 'type': 'E',
\ 'col': 5,
- \ 'end_col': 8,
+ \ 'end_col': 7,
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
\ },
\ {
@@ -16,7 +16,7 @@ Execute(The Rust handler should handle rustc output):
\ 'end_lnum': 13,
\ 'type': 'E',
\ 'col': 7,
- \ 'end_col': 10,
+ \ 'end_col': 9,
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ },
\ ],
@@ -84,7 +84,7 @@ Execute(The Rust handler should handle cargo output):
\ 'end_lnum': 15,
\ 'type': 'E',
\ 'col': 5,
- \ 'end_col': 8,
+ \ 'end_col': 7,
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
\ },
\ {
@@ -92,7 +92,7 @@ Execute(The Rust handler should handle cargo output):
\ 'end_lnum': 13,
\ 'type': 'E',
\ 'col': 7,
- \ 'end_col': 10,
+ \ 'end_col': 9,
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ },
\ ],
@@ -158,7 +158,7 @@ Execute(The Rust handler should should errors from expansion spans):
\ 'end_lnum': 4,
\ 'type': 'E',
\ 'col': 21,
- \ 'end_col': 23,
+ \ 'end_col': 22,
\ 'text': 'mismatched types: expected bool, found integral variable',
\ },
\ ],
@@ -208,7 +208,7 @@ Execute(The Rust handler should show detailed errors):
\ 'end_lnum': 4,
\ 'type': 'E',
\ 'col': 21,
- \ 'end_col': 23,
+ \ 'end_col': 22,
\ 'text': 'mismatched types: expected bool, found integral variable',
\ },
\ ],
@@ -296,7 +296,7 @@ Execute(The Rust handler should remove secondary spans if set):
\ 'lnum': 1,
\ 'end_lnum': 1,
\ 'type': 'E',
- \ 'end_col': 21,
+ \ 'end_col': 20,
\ 'col': 1,
\ 'text': 'this function takes 1 parameter but 0 were supplied: defined here',
\ },
@@ -304,7 +304,7 @@ Execute(The Rust handler should remove secondary spans if set):
\ 'lnum': 1,
\ 'end_lnum': 1,
\ 'type': 'E',
- \ 'end_col': 46,
+ \ 'end_col': 45,
\ 'col': 40,
\ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter',
\ },
@@ -371,7 +371,7 @@ Execute(The Rust handler should remove secondary spans if set):
\ 'lnum': 1,
\ 'end_lnum': 1,
\ 'type': 'E',
- \ 'end_col': 46,
+ \ 'end_col': 45,
\ 'col': 40,
\ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter',
\ },
diff --git a/test/jsonlint-test-files/app-without-jsonlint/src/app.json b/test/jsonlint-test-files/app-without-jsonlint/src/app.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app-without-jsonlint/src/app.json
diff --git a/test/jsonlint-test-files/app/node_modules/.bin/jsonlint b/test/jsonlint-test-files/app/node_modules/.bin/jsonlint
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app/node_modules/.bin/jsonlint
diff --git a/test/jsonlint-test-files/app/src/app.json b/test/jsonlint-test-files/app/src/app.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app/src/app.json
diff --git a/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js b/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js
diff --git a/test/test_ale_complete_command.vader b/test/test_ale_complete_command.vader
deleted file mode 100644
index 11f781c2..00000000
--- a/test/test_ale_complete_command.vader
+++ /dev/null
@@ -1,26 +0,0 @@
-Before:
- function! MockAlwaysGetCompletions() abort
- let g:get_completions_called = 0
- let g:always_get_completions_argument = -1
-
- function! ale#completion#AlwaysGetCompletions(need_prefix) abort
- let g:get_completions_called = 1
- let g:always_get_completions_argument = a:need_prefix
- endfunction
- endfunction
-
- call MockAlwaysGetCompletions()
-
-After:
- unlet! g:get_completions_called
- unlet! g:always_get_completions_argument
- delfunction MockAlwaysGetCompletions
- delfunction ale#completion#AlwaysGetCompletions
-
- runtime autoload/ale/completion.vim
-
-Execute(ale#completion#AlwaysGetCompletions should be called when ALEComplete is executed):
- AssertEqual 0, g:get_completions_called
- ALEComplete
- AssertEqual 1, g:get_completions_called
- AssertEqual 0, g:always_get_completions_argument
diff --git a/test/test_find_references.vader b/test/test_find_references.vader
index eb06e3bc..1a147849 100644
--- a/test/test_find_references.vader
+++ b/test/test_find_references.vader
@@ -253,14 +253,15 @@ Execute(LSP reference responses should be handled):
Execute(Preview windows should not be opened for empty LSP reference responses):
call ale#references#SetMap({3: {}})
- call ale#references#HandleLSPResponse(
- \ 1,
- \ {
- \ 'id': 3,
- \ 'result': [
- \ ],
- \ }
- \)
+ call ale#references#HandleLSPResponse(1, {'id': 3, 'result': []})
+
+ Assert !g:preview_called
+ AssertEqual {}, ale#references#GetMap()
+ AssertEqual ['echom ''No references found.'''], g:expr_list
+
+Execute(LSP reference responses with a null result should be handled):
+ call ale#references#SetMap({3: {}})
+ call ale#references#HandleLSPResponse(1, {'id': 3, 'result': v:null})
Assert !g:preview_called
AssertEqual {}, ale#references#GetMap()
diff --git a/test/test_ignoring_linters.vader b/test/test_ignoring_linters.vader
index 32eae954..2d9c67de 100644
--- a/test/test_ignoring_linters.vader
+++ b/test/test_ignoring_linters.vader
@@ -30,6 +30,7 @@ Execute(Exclude should ignore some invalid values):
\ {'name': 'linter3', 'aliases': []},
\ ],
\ 'foo',
+ \ 0,
\ )
AssertEqual
\ [
@@ -45,6 +46,7 @@ Execute(Exclude should ignore some invalid values):
\ {'name': 'linter3', 'aliases': []},
\ ],
\ 0,
+ \ 0,
\ )
AssertEqual
\ [
@@ -60,6 +62,7 @@ Execute(Exclude should ignore some invalid values):
\ {'name': 'linter3', 'aliases': []},
\ ],
\ v:null,
+ \ 0,
\ )
Execute(Exclude should handle Lists):
@@ -75,6 +78,7 @@ Execute(Exclude should handle Lists):
\ {'name': 'linter3', 'aliases': []},
\ ],
\ ['linter1', 'alias1'],
+ \ 0,
\ )
Execute(Exclude should handle Dictionaries):
@@ -90,11 +94,51 @@ Execute(Exclude should handle Dictionaries):
\ {'name': 'linter3', 'aliases': []},
\ ],
\ {'foo': ['linter1'], 'bar': ['alias1']},
+ \ 0,
+ \ )
+
+Execute(Exclude should filter LSP linters when g:ale_disable_lsp is set to 1):
+ let g:ale_disable_lsp = 1
+ AssertEqual
+ \ [
+ \ {'name': 'linter1', 'aliases': [], 'lsp': ''},
+ \ {'name': 'linter2', 'aliases': []},
+ \ ],
+ \ ale#engine#ignore#Exclude(
+ \ 'foo',
+ \ [
+ \ {'name': 'linter1', 'aliases': [], 'lsp': ''},
+ \ {'name': 'linter2', 'aliases': []},
+ \ {'name': 'linter3', 'aliases': [], 'lsp': 'stdio'},
+ \ ],
+ \ [],
+ \ 1,
+ \ )
+
+Execute(Exclude should filter LSP linters when b:ale_disable_lsp is set to 1):
+ let b:ale_disable_lsp = 1
+ AssertEqual
+ \ [
+ \ {'name': 'linter1', 'aliases': [], 'lsp': ''},
+ \ {'name': 'linter2', 'aliases': []},
+ \ ],
+ \ ale#engine#ignore#Exclude(
+ \ 'foo',
+ \ [
+ \ {'name': 'linter1', 'aliases': [], 'lsp': ''},
+ \ {'name': 'linter2', 'aliases': []},
+ \ {'name': 'linter3', 'aliases': [], 'lsp': 'stdio'},
+ \ ],
+ \ [],
+ \ 1,
\ )
Before:
Save g:ale_linters_ignore
Save g:ale_buffer_info
+ Save g:ale_disable_lsp
+
+ let g:ale_disable_lsp = 0
let g:linters = []
let g:loclist = []
@@ -127,6 +171,7 @@ After:
unlet! b:ale_linters_ignore
unlet! b:ale_quitting
unlet! b:ale_save_event_fired
+ unlet! b:ale_disable_lsp
unlet! g:linters
unlet! g:loclist
unlet! g:lsp_message
diff --git a/test/test_jsonlint_executable_detection.vader b/test/test_jsonlint_executable_detection.vader
new file mode 100644
index 00000000..bd391b47
--- /dev/null
+++ b/test/test_jsonlint_executable_detection.vader
@@ -0,0 +1,46 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+ runtime ale_linters/json/jsonlint.vim
+
+After:
+ let g:ale_has_override = {}
+ let g:ale_json_jsonlint_executable = 'jsonlint'
+ let g:ale_json_jsonlint_use_global = 0
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(local executable should be detected correctly):
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/jsonlint-test-files/app/node_modules/.bin/jsonlint'),
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(recursively executable should be detected correctly):
+ call ale#test#SetFilename('jsonlint-test-files/app-without-jsonlint/src/app.json')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/jsonlint-test-files/node_modules/jsonlint/lib/cli.js'),
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(use_global should override project executable):
+ let g:ale_json_jsonlint_use_global = 1
+
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ 'jsonlint',
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(manually defined should override default executable):
+ let g:ale_json_jsonlint_use_global = 1
+ let g:ale_json_jsonlint_executable = 'custom_jsonlint'
+
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ 'custom_jsonlint',
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
diff --git a/test/test_path_uri.vader b/test/test_path_uri.vader
index 504aba77..cc2287cb 100644
--- a/test/test_path_uri.vader
+++ b/test/test_path_uri.vader
@@ -9,15 +9,46 @@ Execute(ale#path#FromURI should work for Unix paths):
AssertEqual '/foo/bar/baz.tst', ale#path#FromURI('FILE:/foo/bar/baz.tst')
Execute(ale#path#FromURI should work for Windows paths):
- AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
- AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:/C:/foo/bar/baz.tst')
- AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:///c:/foo/bar/baz.tst')
- AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:/c:/foo/bar/baz.tst')
- AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:///C:/foo/bar/baz.tst')
- AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:/C:/foo/bar/baz.tst')
-
-Execute(ale#path#FromURI should handle encoded paths that look like drive letters):
- AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:///C%3A/foo/bar/baz.tst')
+ if has('win32')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:/C:/foo/bar/baz.tst')
+ AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:///c:/foo/bar/baz.tst')
+ AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:/c:/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:///C:/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:/C:/foo/bar/baz.tst')
+ else
+ AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:///C:/foo/bar/baz.tst')
+ AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:/C:/foo/bar/baz.tst')
+ AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromURI('file:///c:/foo/bar/baz.tst')
+ AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromURI('file:/c:/foo/bar/baz.tst')
+ AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('FILE:///C:/foo/bar/baz.tst')
+ AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('FILE:/C:/foo/bar/baz.tst')
+ endif
+
+Execute(ale#path#FromURI parse Windows paths with a pipe):
+ if has('win32')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C|/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:/C|/foo/bar/baz.tst')
+ AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:///c|/foo/bar/baz.tst')
+ AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromURI('file:/c|/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:///C|/foo/bar/baz.tst')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('FILE:/C|/foo/bar/baz.tst')
+ else
+ AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('file:///C|/foo/bar/baz.tst')
+ AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('file:/C|/foo/bar/baz.tst')
+ AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromURI('file:///c|/foo/bar/baz.tst')
+ AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromURI('file:/c|/foo/bar/baz.tst')
+ AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('FILE:///C|/foo/bar/baz.tst')
+ AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromURI('FILE:/C|/foo/bar/baz.tst')
+ endif
+
+Execute(ale#path#FromURI should handle the colon for the drive letter being encoded):
+ " These URIs shouldn't be created, but we'll handle them anyway.
+ if has('win32')
+ AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromURI('file:///C%3A/foo/bar/baz.tst')
+ else
+ AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromURI('file:///C%3A/foo/bar/baz.tst')
+ endif
Execute(ale#path#ToURI should work for Unix paths):
AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToURI('/foo/bar/baz.tst')
diff --git a/test/test_semver_utils.vader b/test/test_semver_utils.vader
index cd0381dd..62483505 100644
--- a/test/test_semver_utils.vader
+++ b/test/test_semver_utils.vader
@@ -15,7 +15,8 @@ Execute(GetVersion should return an empty list when no vesrion can be found):
Execute(GetVersion should cache the version):
AssertEqual [], ale#semver#GetVersion('dummy', [])
AssertEqual [3, 4, 7], ale#semver#GetVersion('dummy', ['Version 3.4.7'])
- AssertEqual [3, 4, 7], ale#semver#GetVersion('dummy', [])
+ AssertEqual [3, 4, 17], ale#semver#GetVersion('dummy', ['Version 3.4.17'])
+ AssertEqual [3, 4, 17], ale#semver#GetVersion('dummy', [])
Execute(GetVersion should tolerate missing patch numbers):
" This goes against the semver spec, but we handle it anyway.