mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26e61fad69 | ||
|
|
d8143885a4 | ||
|
|
1428c7b29e | ||
|
|
7265ceb6d0 | ||
|
|
7ff87a942b | ||
|
|
0b5d72fecd | ||
|
|
e61e1147b0 | ||
|
|
ff6bfc3d37 | ||
|
|
3635285c02 | ||
|
|
3b4193175e | ||
|
|
69d96aa9d9 | ||
|
|
c2b01f0e28 | ||
|
|
ca97f32258 | ||
|
|
70005134e5 | ||
|
|
65bea1a5cb | ||
|
|
716f9a9bbb | ||
|
|
f67cb56e5e | ||
|
|
3f34265151 | ||
|
|
d4e1c57026 | ||
|
|
76cd6b0f92 | ||
|
|
47d941b491 | ||
|
|
36e5337e30 | ||
|
|
60d683da3b | ||
|
|
d2934ba017 | ||
|
|
36b50058bb | ||
|
|
3281321d5c | ||
|
|
e0181f8832 | ||
|
|
64b9a2708d | ||
|
|
1f9ac1c6dc | ||
|
|
93a13d7353 | ||
|
|
00eee550ea | ||
|
|
198361bc0d | ||
|
|
dc054f30c8 | ||
|
|
16cd59805b | ||
|
|
82f734a7c2 | ||
|
|
6087765cad | ||
|
|
58404b5b83 | ||
|
|
852a6a1753 | ||
|
|
9edefa724b | ||
|
|
fa19bca80e | ||
|
|
302ce71931 | ||
|
|
bbe5153fcb | ||
|
|
46d7ee564f | ||
|
|
8f7ccdc5e9 | ||
|
|
634c81fd46 | ||
|
|
8012809c3f | ||
|
|
d6d2a0c770 | ||
|
|
07ee4d39c5 | ||
|
|
4afbf2f25d | ||
|
|
72d2c55479 | ||
|
|
57eba1afac | ||
|
|
8c4c8dfd97 | ||
|
|
0cb432cb82 | ||
|
|
874c98b96d | ||
|
|
7a4f5cefba | ||
|
|
6ad8836c68 | ||
|
|
8148a67b37 | ||
|
|
25e457595a | ||
|
|
493705336c | ||
|
|
4cbe16197c | ||
|
|
9ee57d4362 | ||
|
|
715733f44d | ||
|
|
5f84325cd8 | ||
|
|
d8195e9276 | ||
|
|
5f95d032ee | ||
|
|
31715ff227 | ||
|
|
b91d82bfaa | ||
|
|
9005a62dc2 | ||
|
|
7665559d0e | ||
|
|
66a8df081e | ||
|
|
b76165abf6 | ||
|
|
abad8e474b | ||
|
|
f09cc26f87 | ||
|
|
e2a67812de | ||
|
|
e6ee613e00 | ||
|
|
6637de46c2 | ||
|
|
5985f8bd63 | ||
|
|
977921461d | ||
|
|
0b5fcbad1f | ||
|
|
db6b1b5ecc | ||
|
|
a273b9cf4a | ||
|
|
f11f6a2195 | ||
|
|
bde9b1cfcd | ||
|
|
5eefe544ed | ||
|
|
dfbb387cc7 | ||
|
|
2d9380d75c | ||
|
|
e259dd525f | ||
|
|
9a0b604a99 | ||
|
|
47eb3dd0c0 | ||
|
|
af8c8516d1 | ||
|
|
0d4dfb61dc | ||
|
|
463deedc29 | ||
|
|
40890cfcf3 | ||
|
|
ea91209a66 | ||
|
|
cf5120ba75 | ||
|
|
79e9ae4550 | ||
|
|
9017d3ef9c | ||
|
|
67d0ccc398 | ||
|
|
9c797961fa | ||
|
|
c06467438d | ||
|
|
5e69aaf4c2 | ||
|
|
9125ec8739 | ||
|
|
99e64ed084 | ||
|
|
8698c44e2a | ||
|
|
b27df1b169 | ||
|
|
dfe9b7cc26 | ||
|
|
e5a4c82917 | ||
|
|
f4070f6c43 | ||
|
|
fedd3de59f | ||
|
|
4b53d88cb8 | ||
|
|
29d0987859 | ||
|
|
d74db90550 | ||
|
|
81cb40ce4b | ||
|
|
f5c289dce6 | ||
|
|
31d6f72abf | ||
|
|
e19b8c05cd | ||
|
|
c8c142b881 | ||
|
|
a1fab59811 | ||
|
|
d488198c9c | ||
|
|
a62f26434a | ||
|
|
35f51221f1 | ||
|
|
95b8689835 | ||
|
|
618f2d71fc | ||
|
|
62602569b3 | ||
|
|
f89b49a014 | ||
|
|
9ee8067df6 |
1
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
1
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Report a bug
|
||||
labels: bug
|
||||
about: Report a bug with ALE.
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Suggest a new linter or fixer
|
||||
labels: new tool
|
||||
about: Suggest a new tool ALE can officially integrate with.
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Suggest an improvement
|
||||
labels: enhancement
|
||||
about: Suggest some way to improve ALE, or add a new feature.
|
||||
|
||||
---
|
||||
|
||||
@@ -35,6 +35,10 @@ If you don't care about Language Server Protocol, ALE won't load any of the code
|
||||
for working with it unless needed. One of ALE's general missions is that you
|
||||
won't pay for the features that you don't use.
|
||||
|
||||
**Help Wanted:** If you would like to help maintain this plugin by managing the
|
||||
many issues and pull requests that are submitted, please send the author an
|
||||
email at [dev@w0rp.com](mailto:dev@w0rp.com?subject=Helping%20with%20ALE).
|
||||
|
||||
If you enjoy this plugin, feel free to contribute or check out the author's
|
||||
other content at [w0rp.com](https://w0rp.com).
|
||||
|
||||
|
||||
4
ale_linters/bats/shellcheck.vim
Normal file
4
ale_linters/bats/shellcheck.vim
Normal file
@@ -0,0 +1,4 @@
|
||||
" Author: Ian2020 <https://github.com/Ian2020>
|
||||
" Description: shellcheck linter for bats scripts.
|
||||
|
||||
call ale#handlers#shellcheck#DefineLinter('bats')
|
||||
@@ -3,9 +3,14 @@
|
||||
|
||||
call ale#Set('c_clangd_executable', 'clangd')
|
||||
call ale#Set('c_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
|
||||
@@ -29,6 +29,6 @@ call ale#linter#Define('clojure', {
|
||||
\ 'name': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': 'clj-kondo --lint %t',
|
||||
\ 'command': 'clj-kondo --cache --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
||||
|
||||
@@ -20,7 +20,7 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
@@ -3,9 +3,14 @@
|
||||
|
||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||
call ale#Set('cpp_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
|
||||
@@ -5,6 +5,10 @@ function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if !has_key(l:error, 'file')
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
|
||||
21
ale_linters/go/revive.vim
Normal file
21
ale_linters/go/revive.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: Penghui Liao <liaoishere@gmail.com>
|
||||
" Description: Adds support for revive
|
||||
|
||||
call ale#Set('go_revive_executable', 'revive')
|
||||
call ale#Set('go_revive_options', '')
|
||||
|
||||
function! ale_linters#go#revive#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_revive_options')
|
||||
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'revive',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_revive_executable')},
|
||||
\ 'command': function('ale_linters#go#revive#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -5,5 +5,5 @@ call ale#linter#Define('graphql', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls'
|
||||
call ale#Set('java_eclipselsp_config_path', '')
|
||||
call ale#Set('java_eclipselsp_workspace_path', '')
|
||||
call ale#Set('java_eclipselsp_executable', 'java')
|
||||
call ale#Set('java_eclipselsp_javaagent', '')
|
||||
|
||||
function! ale_linters#java#eclipselsp#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'java_eclipselsp_executable')
|
||||
@@ -100,12 +101,30 @@ function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort
|
||||
return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#Javaagent(buffer) abort
|
||||
let l:rets = []
|
||||
let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent')
|
||||
|
||||
if empty(l:raw)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:jars = split(l:raw)
|
||||
|
||||
for l:jar in l:jars
|
||||
call add(l:rets, ale#Escape('-javaagent:' . l:jar))
|
||||
endfor
|
||||
|
||||
return join(l:rets, ' ')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#Command(buffer, version) abort
|
||||
let l:path = ale#Var(a:buffer, 'java_eclipselsp_path')
|
||||
|
||||
let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer)
|
||||
|
||||
let l:cmd = [ ale#Escape(l:executable),
|
||||
\ ale_linters#java#eclipselsp#Javaagent(a:buffer),
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
|
||||
@@ -6,6 +6,7 @@ let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
call ale#Set('java_javac_executable', 'javac')
|
||||
call ale#Set('java_javac_options', '')
|
||||
call ale#Set('java_javac_classpath', '')
|
||||
call ale#Set('java_javac_sourcepath', '')
|
||||
|
||||
function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
|
||||
let l:command = ''
|
||||
@@ -40,10 +41,15 @@ endfunction
|
||||
function! s:BuildClassPathOption(buffer, import_paths) abort
|
||||
" Filter out lines like [INFO], etc.
|
||||
let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''')
|
||||
call extend(
|
||||
\ l:class_paths,
|
||||
\ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep),
|
||||
\)
|
||||
let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath')
|
||||
|
||||
if !empty(l:cls_path) && type(l:cls_path) is v:t_string
|
||||
call extend(l:class_paths, split(l:cls_path, s:classpath_sep))
|
||||
endif
|
||||
|
||||
if !empty(l:cls_path) && type(l:cls_path) is v:t_list
|
||||
call extend(l:class_paths, l:cls_path)
|
||||
endif
|
||||
|
||||
return !empty(l:class_paths)
|
||||
\ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep))
|
||||
@@ -79,6 +85,27 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:source_paths = []
|
||||
let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath')
|
||||
|
||||
if !empty(l:source_path) && type(l:source_path) is v:t_string
|
||||
let l:source_paths = split(l:source_path, s:classpath_sep)
|
||||
endif
|
||||
|
||||
if !empty(l:source_path) && type(l:source_path) is v:t_list
|
||||
let l:source_paths = l:source_path
|
||||
endif
|
||||
|
||||
if !empty(l:source_paths)
|
||||
for l:path in l:source_paths
|
||||
let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path)
|
||||
|
||||
if !empty(l:sp_path)
|
||||
call add(l:sp_dirs, l:sp_path)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !empty(l:sp_dirs)
|
||||
let l:sp_option = '-sourcepath '
|
||||
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/semistandard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
|
||||
@@ -174,6 +174,7 @@ endfunction
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'kotlinc',
|
||||
\ 'executable': 'kotlinc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
|
||||
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
" Author: Baabelfish
|
||||
" Description: Typechecking for nim files
|
||||
|
||||
let s:end_col_patterns = [
|
||||
\ '\v''([^'']+)'' is declared but not used.*',
|
||||
\ '\videntifier expected, but found ''([^'']+)''',
|
||||
\ '\vimported and not used: ''([^'']+)''.*',
|
||||
\ '\vundeclared identifier: ''([^'']+)''',
|
||||
\ '\v''([^'']+)'' cannot be assigned to',
|
||||
\ '\vredefinition of ''([^'']+)'';',
|
||||
\]
|
||||
|
||||
function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t')
|
||||
let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)'
|
||||
@@ -43,6 +52,11 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:item.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
" Find position end_col.
|
||||
for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns)
|
||||
let l:item.end_col = l:item.col + len(l:col_match[1]) - 1
|
||||
endfor
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
|
||||
33
ale_linters/nim/nimlsp.vim
Normal file
33
ale_linters/nim/nimlsp.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
" Author: jeremija <https://github.com/jeremija>
|
||||
" Description: Support for nimlsp (language server for nim)
|
||||
|
||||
call ale#Set('nim_nimlsp_nim_sources', '')
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetCommand(buffer) abort
|
||||
let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources')
|
||||
|
||||
if !empty(l:nim_sources)
|
||||
let l:nim_sources = ale#Escape(l:nim_sources)
|
||||
endif
|
||||
|
||||
return '%e' . ale#Pad(l:nim_sources)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nim', {
|
||||
\ 'name': 'nimlsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'nimlsp',
|
||||
\ 'command': function('ale_linters#nim#nimlsp#GetCommand'),
|
||||
\ 'language': 'nim',
|
||||
\ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -2,6 +2,7 @@
|
||||
" Description: plugin for Psalm, static analyzer for PHP
|
||||
|
||||
call ale#Set('psalm_langserver_executable', 'psalm')
|
||||
call ale#Set('psalm_langserver_options', '')
|
||||
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||
@@ -10,12 +11,16 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#psalm#GetCommand(buffer) abort
|
||||
return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'psalm_langserver_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'psalm',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [
|
||||
\ 'vendor/bin/psalm',
|
||||
\ ])},
|
||||
\ 'command': '%e --language-server',
|
||||
\ 'command': function('ale_linters#php#psalm#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#php#psalm#GetProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -12,6 +12,7 @@ endfunction
|
||||
" https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/
|
||||
function! ale_linters#powershell#powershell#GetCommand(buffer) abort
|
||||
let l:script = ['Param($Script);
|
||||
\ $ErrorView = "Normal";
|
||||
\ trap {$_;continue} & {
|
||||
\ $Contents = Get-Content -Path $Script;
|
||||
\ $Contents = [string]::Join([Environment]::NewLine, $Contents);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('python_mypy_executable', 'mypy')
|
||||
call ale#Set('python_mypy_ignore_invalid_syntax', 0)
|
||||
call ale#Set('python_mypy_show_notes', 1)
|
||||
call ale#Set('python_mypy_options', '')
|
||||
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_mypy_auto_pipenv', 0)
|
||||
@@ -18,6 +19,15 @@ endfunction
|
||||
|
||||
" The directory to change to before running mypy
|
||||
function! s:GetDir(buffer) abort
|
||||
" If we find a directory with "mypy.ini" in it use that,
|
||||
" else try and find the "python project" root, or failing
|
||||
" that, run from the same folder as the current file
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
if filereadable(l:path . '/mypy.ini')
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root)
|
||||
@@ -51,7 +61,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
" Lines like these should be ignored below:
|
||||
"
|
||||
" file.py:4: note: (Stub files are from https://github.com/python/typeshed)
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$'
|
||||
|
||||
let l:types = 'error|warning'
|
||||
|
||||
if ale#Var(a:buffer, 'python_mypy_show_notes')
|
||||
let l:types = 'error|warning|note'
|
||||
endif
|
||||
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: ('
|
||||
\ . l:types
|
||||
\ . '): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@@ -65,7 +84,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'),
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
24
ale_linters/rust/analyzer.vim
Normal file
24
ale_linters/rust/analyzer.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: Jon Gjengset <jon@thesquareplanet.com>
|
||||
" Description: The next generation language server for Rust
|
||||
|
||||
call ale#Set('rust_analyzer_executable', 'rust-analyzer')
|
||||
call ale#Set('rust_analyzer_config', {})
|
||||
|
||||
function! ale_linters#rust#analyzer#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
|
||||
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'analyzer',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
|
||||
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
|
||||
\})
|
||||
@@ -32,6 +32,8 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#metals#GetCommand(buffer) abort
|
||||
|
||||
@@ -1,107 +1,4 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for using the shellcheck linter with
|
||||
" shell scripts.
|
||||
" Description: shellcheck linter for shell scripts.
|
||||
|
||||
" This global variable can be set with a string of comma-separated error
|
||||
" codes to exclude from shellcheck. For example:
|
||||
"
|
||||
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
|
||||
call ale#Set('sh_shellcheck_executable', 'shellcheck')
|
||||
call ale#Set('sh_shellcheck_dialect', 'auto')
|
||||
call ale#Set('sh_shellcheck_options', '')
|
||||
call ale#Set('sh_shellcheck_change_directory', 1)
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
if !empty(l:shell_type)
|
||||
" Use the dash dialect for /bin/ash, etc.
|
||||
if l:shell_type is# 'ash'
|
||||
return 'dash'
|
||||
endif
|
||||
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
" If there's no hashbang, try using Vim's buffer variables.
|
||||
if getbufvar(a:buffer, 'is_bash', 0)
|
||||
return 'bash'
|
||||
elseif getbufvar(a:buffer, 'is_sh', 0)
|
||||
return 'sh'
|
||||
elseif getbufvar(a:buffer, 'is_kornshell', 0)
|
||||
return 'ksh'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort
|
||||
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
|
||||
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
|
||||
let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
|
||||
if l:dialect is# 'auto'
|
||||
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
|
||||
endif
|
||||
|
||||
return l:cd_string
|
||||
\ . '%e'
|
||||
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
||||
\ . l:external_option
|
||||
\ . ' -f gcc -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[4] is# 'error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[4] is# 'note'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6],
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
||||
let l:item['filename'] = l:match[1]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'shellcheck',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale#Var(buffer, 'sh_shellcheck_executable'),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#sh#shellcheck#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#sh#shellcheck#Handle',
|
||||
\})
|
||||
call ale#handlers#shellcheck#DefineLinter('sh')
|
||||
|
||||
25
ale_linters/terraform/terraform_lsp.vim
Normal file
25
ale_linters/terraform/terraform_lsp.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Author: OJFord <dev@ojford.com>
|
||||
" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp)
|
||||
|
||||
call ale#Set('terraform_langserver_executable', 'terraform-lsp')
|
||||
call ale#Set('terraform_langserver_options', '')
|
||||
|
||||
function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort
|
||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
||||
|
||||
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'terraform_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')},
|
||||
\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'),
|
||||
\ 'language': 'terraform',
|
||||
\})
|
||||
31
ale_linters/typescript/standard.vim
Normal file
31
ale_linters/typescript/standard.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: Ahmed El Gabri <@ahmedelgabri>
|
||||
" Description: standardjs for typescript files
|
||||
|
||||
call ale#Set('typescript_standard_executable', 'standard')
|
||||
call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_standard_options', '')
|
||||
|
||||
function! ale_linters#typescript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#typescript#standard#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
" standard uses eslint and the output format is the same
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'standard',
|
||||
\ 'executable': function('ale_linters#typescript#standard#GetExecutable'),
|
||||
\ 'command': function('ale_linters#typescript#standard#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\})
|
||||
@@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
|
||||
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
|
||||
" %Warning-UNUSED: test.v:4: Signal is not used: dout
|
||||
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
|
||||
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
|
||||
" Since version 4.032 (04/2020) verilator linter messages also contain the column number,
|
||||
" and look like:
|
||||
" %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
|
||||
"
|
||||
" to stay compatible with old versions of the tool, the column number is
|
||||
" optional in the researched pattern
|
||||
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:line = l:match[3] + 0
|
||||
let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
|
||||
\}
|
||||
|
||||
if !empty(l:match[4])
|
||||
let l:item.col = str2nr(l:match[4])
|
||||
endif
|
||||
|
||||
let l:file = l:match[2]
|
||||
|
||||
if l:file =~# '_verilator_linted.v'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
call add(l:output, l:item)
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
61
ale_linters/vim/vimls.vim
Normal file
61
ale_linters/vim/vimls.vim
Normal file
@@ -0,0 +1,61 @@
|
||||
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
||||
" Description: Vim Language Server integration for ALE
|
||||
|
||||
call ale#Set('vim_vimls_executable', 'vim-language-server')
|
||||
call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('vim_vimls_config', {})
|
||||
|
||||
function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort
|
||||
let l:trigger_file_candidates = [
|
||||
\ '.vimrc',
|
||||
\ 'init.vim',
|
||||
\]
|
||||
|
||||
for l:candidate in l:trigger_file_candidates
|
||||
let l:trigger_file = fnamemodify(bufname(a:buffer), ':t')
|
||||
|
||||
if l:trigger_file is# l:candidate
|
||||
return fnamemodify(
|
||||
\ bufname(a:buffer),
|
||||
\ ':h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:trigger_dir_candidates = [
|
||||
\ 'autoload',
|
||||
\ 'plugin',
|
||||
\ '.git',
|
||||
\]
|
||||
|
||||
let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
|
||||
for l:path in l:path_upwards
|
||||
for l:candidate in l:trigger_dir_candidates
|
||||
let l:trigger_dir = ale#path#Simplify(
|
||||
\ l:path . '/' . l:candidate,
|
||||
\)
|
||||
|
||||
if isdirectory(l:trigger_dir)
|
||||
return fnamemodify(
|
||||
\ l:trigger_dir,
|
||||
\ ':p:h:h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('vim', {
|
||||
\ 'name': 'vimls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')},
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [
|
||||
\ 'node_modules/.bin/vim-language-server',
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'language': 'vim',
|
||||
\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'),
|
||||
\})
|
||||
@@ -5,11 +5,18 @@
|
||||
" Strings used for severity in the echoed message
|
||||
let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
|
||||
let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
|
||||
let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log')
|
||||
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)
|
||||
|
||||
" LSP window/showMessage format
|
||||
let g:ale_lsp_show_message_format = get(g:, 'ale_lsp_show_message_format', '%severity%:%linter%: %s')
|
||||
" Valid values mimic LSP definitions (error, warning and information; log is
|
||||
" never shown)
|
||||
let g:ale_lsp_show_message_severity = get(g:, 'ale_lsp_show_message_severity', 'error')
|
||||
|
||||
let s:lint_timer = -1
|
||||
let s:getcmdwintype_exists = exists('*getcmdwintype')
|
||||
|
||||
@@ -156,7 +163,7 @@ function! ale#Queue(delay, ...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:current_ale_version = [2, 6, 0]
|
||||
let s:current_ale_version = [2, 7, 0]
|
||||
|
||||
" A function used to check for ALE features in files outside of the project.
|
||||
function! ale#Has(feature) abort
|
||||
@@ -251,9 +258,9 @@ function! ale#GetLocItemMessage(item, format_string) abort
|
||||
|
||||
" Replace special markers with certain information.
|
||||
" \=l:variable is used to avoid escaping issues.
|
||||
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
|
||||
let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g')
|
||||
let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g')
|
||||
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
|
||||
" Replace %s with the text.
|
||||
let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
" Author: Andrew Lee <andrewl@mbda.fun>.
|
||||
" Author: Andrew Lee <andrew.lambda@tuta.io>.
|
||||
" Inspired by ale/gradle.vim by Michael Pardo <michael@michaelpardo.com>
|
||||
" Description: Functions for working with Ant projects.
|
||||
|
||||
|
||||
@@ -267,14 +267,22 @@ function! ale#assert#TearDownLinterTest() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#assert#SetUpFixerTest(filetype, name) abort
|
||||
function! ale#assert#SetUpFixerTest(filetype, name, ...) abort
|
||||
" If the suffix of the option names format is different, an additional
|
||||
" argument can be used for that instead.
|
||||
if a:0 > 1
|
||||
throw 'Too many arguments'
|
||||
endif
|
||||
|
||||
" Set up a marker so ALE doesn't create real random temporary filenames.
|
||||
let g:ale_create_dummy_temporary_file = 1
|
||||
|
||||
let l:function_name = ale#fix#registry#GetFunc(a:name)
|
||||
let s:FixerFunction = function(l:function_name)
|
||||
|
||||
let l:prefix = 'ale_' . a:filetype . '_' . a:name
|
||||
let l:option_suffix = get(a:000, 0, a:name)
|
||||
let l:prefix = 'ale_' . a:filetype . '_'
|
||||
\ . substitute(l:option_suffix, '-', '_', 'g')
|
||||
let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix'
|
||||
|
||||
for l:key in filter(keys(g:), b:filter_expr)
|
||||
@@ -286,7 +294,7 @@ function! ale#assert#SetUpFixerTest(filetype, name) abort
|
||||
unlet b:[l:key]
|
||||
endfor
|
||||
|
||||
execute 'runtime autoload/ale/fixers/' . a:name . '.vim'
|
||||
execute 'runtime autoload/ale/fixers/' . substitute(a:name, '-', '_', 'g') . '.vim'
|
||||
|
||||
if !exists('g:dir')
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Author: Jerko Steiner <jerko.steiner@gmail.com>
|
||||
" Description: Code action support for LSP / tsserver
|
||||
|
||||
function! ale#code_action#HandleCodeAction(code_action) abort
|
||||
function! ale#code_action#HandleCodeAction(code_action, should_save) abort
|
||||
let l:current_buffer = bufnr('')
|
||||
let l:changes = a:code_action.changes
|
||||
|
||||
@@ -17,11 +17,14 @@ function! ale#code_action#HandleCodeAction(code_action) abort
|
||||
|
||||
for l:file_code_edit in l:changes
|
||||
call ale#code_action#ApplyChanges(
|
||||
\ l:file_code_edit.fileName, l:file_code_edit.textChanges)
|
||||
\ l:file_code_edit.fileName,
|
||||
\ l:file_code_edit.textChanges,
|
||||
\ a:should_save,
|
||||
\ )
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#code_action#ApplyChanges(filename, changes) abort
|
||||
function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
|
||||
let l:current_buffer = bufnr('')
|
||||
" The buffer is used to determine the fileformat, if available.
|
||||
let l:buffer = bufnr(a:filename)
|
||||
@@ -106,10 +109,17 @@ function! ale#code_action#ApplyChanges(filename, changes) abort
|
||||
call remove(l:lines, -1)
|
||||
endif
|
||||
|
||||
call ale#util#Writefile(l:buffer, l:lines, a:filename)
|
||||
if a:should_save
|
||||
call ale#util#Writefile(l:buffer, l:lines, a:filename)
|
||||
else
|
||||
call ale#util#SetBufferContents(l:buffer, l:lines)
|
||||
endif
|
||||
|
||||
if l:is_current_buffer
|
||||
call ale#util#Execute(':e!')
|
||||
if a:should_save
|
||||
call ale#util#Execute(':e!')
|
||||
endif
|
||||
|
||||
call setpos('.', [0, l:pos[0], l:pos[1], 0])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Completion support for LSP linters
|
||||
scriptencoding utf-8
|
||||
|
||||
" The omnicompletion menu is shown through a special Plug mapping which is
|
||||
" only valid in Insert mode. This way, feedkeys() won't send these keys if you
|
||||
@@ -21,24 +22,101 @@ let s:timer_id = -1
|
||||
let s:last_done_pos = []
|
||||
|
||||
" CompletionItemKind values from the LSP protocol.
|
||||
let s:LSP_COMPLETION_TEXT_KIND = 1
|
||||
let s:LSP_COMPLETION_METHOD_KIND = 2
|
||||
let s:LSP_COMPLETION_FUNCTION_KIND = 3
|
||||
let s:LSP_COMPLETION_CONSTRUCTOR_KIND = 4
|
||||
let s:LSP_COMPLETION_FIELD_KIND = 5
|
||||
let s:LSP_COMPLETION_VARIABLE_KIND = 6
|
||||
let s:LSP_COMPLETION_CLASS_KIND = 7
|
||||
let s:LSP_COMPLETION_INTERFACE_KIND = 8
|
||||
let s:LSP_COMPLETION_MODULE_KIND = 9
|
||||
let s:LSP_COMPLETION_PROPERTY_KIND = 10
|
||||
let s:LSP_COMPLETION_UNIT_KIND = 11
|
||||
let s:LSP_COMPLETION_VALUE_KIND = 12
|
||||
let s:LSP_COMPLETION_ENUM_KIND = 13
|
||||
let s:LSP_COMPLETION_KEYWORD_KIND = 14
|
||||
let s:LSP_COMPLETION_SNIPPET_KIND = 15
|
||||
let s:LSP_COMPLETION_COLOR_KIND = 16
|
||||
let s:LSP_COMPLETION_FILE_KIND = 17
|
||||
let s:LSP_COMPLETION_REFERENCE_KIND = 18
|
||||
let g:ale_lsp_types = {
|
||||
\ 1: 'text',
|
||||
\ 2: 'method',
|
||||
\ 3: 'function',
|
||||
\ 4: 'constructor',
|
||||
\ 5: 'field',
|
||||
\ 6: 'variable',
|
||||
\ 7: 'class',
|
||||
\ 8: 'interface',
|
||||
\ 9: 'module',
|
||||
\ 10: 'property',
|
||||
\ 11: 'unit',
|
||||
\ 12: 'value',
|
||||
\ 13: 'enum',
|
||||
\ 14: 'keyword',
|
||||
\ 15: 'snippet',
|
||||
\ 16: 'color',
|
||||
\ 17: 'file',
|
||||
\ 18: 'reference',
|
||||
\ 19: 'folder',
|
||||
\ 20: 'enum_member',
|
||||
\ 21: 'constant',
|
||||
\ 22: 'struct',
|
||||
\ 23: 'event',
|
||||
\ 24: 'operator',
|
||||
\ 25: 'type_parameter',
|
||||
\ }
|
||||
|
||||
" from https://github.com/microsoft/TypeScript/blob/29becf05012bfa7ba20d50b0d16813971e46b8a6/lib/protocol.d.ts#L2472
|
||||
let g:ale_tsserver_types = {
|
||||
\ 'warning': 'text',
|
||||
\ 'keyword': 'keyword',
|
||||
\ 'script': 'file',
|
||||
\ 'module': 'module',
|
||||
\ 'class': 'class',
|
||||
\ 'local class': 'class',
|
||||
\ 'interface': 'interface',
|
||||
\ 'type': 'class',
|
||||
\ 'enum': 'enum',
|
||||
\ 'enum member': 'enum_member',
|
||||
\ 'var': 'variable',
|
||||
\ 'local var': 'variable',
|
||||
\ 'function': 'function',
|
||||
\ 'local function': 'function',
|
||||
\ 'method': 'method',
|
||||
\ 'getter': 'property',
|
||||
\ 'setter': 'method',
|
||||
\ 'property': 'property',
|
||||
\ 'constructor': 'constructor',
|
||||
\ 'call': 'method',
|
||||
\ 'index': 'index',
|
||||
\ 'construct': 'constructor',
|
||||
\ 'parameter': 'parameter',
|
||||
\ 'type parameter': 'type_parameter',
|
||||
\ 'primitive type': 'unit',
|
||||
\ 'label': 'text',
|
||||
\ 'alias': 'class',
|
||||
\ 'const': 'constant',
|
||||
\ 'let': 'variable',
|
||||
\ 'directory': 'folder',
|
||||
\ 'external module name': 'text',
|
||||
\ 'JSX attribute': 'parameter',
|
||||
\ 'string': 'text'
|
||||
\ }
|
||||
|
||||
" For compatibility reasons, we only use built in VIM completion kinds
|
||||
" See :help complete-items for Vim completion kinds
|
||||
let g:ale_completion_symbols = get(g:, 'ale_completion_symbols', {
|
||||
\ 'text': 'v',
|
||||
\ 'method': 'f',
|
||||
\ 'function': 'f',
|
||||
\ 'constructor': 'f',
|
||||
\ 'field': 'm',
|
||||
\ 'variable': 'v',
|
||||
\ 'class': 't',
|
||||
\ 'interface': 't',
|
||||
\ 'module': 'd',
|
||||
\ 'property': 'm',
|
||||
\ 'unit': 'v',
|
||||
\ 'value': 'v',
|
||||
\ 'enum': 't',
|
||||
\ 'keyword': 'v',
|
||||
\ 'snippet': 'v',
|
||||
\ 'color': 'v',
|
||||
\ 'file': 'v',
|
||||
\ 'reference': 'v',
|
||||
\ 'folder': 'v',
|
||||
\ 'enum_member': 'm',
|
||||
\ 'constant': 'm',
|
||||
\ 'struct': 't',
|
||||
\ 'event': 'v',
|
||||
\ 'operator': 'f',
|
||||
\ 'type_parameter': 'p',
|
||||
\ '<default>': 'v'
|
||||
\ })
|
||||
|
||||
let s:LSP_INSERT_TEXT_FORMAT_PLAIN = 1
|
||||
let s:LSP_INSERT_TEXT_FORMAT_SNIPPET = 2
|
||||
@@ -183,6 +261,8 @@ function! s:ReplaceCompletionOptions() abort
|
||||
|
||||
if &l:completeopt =~# 'preview'
|
||||
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
|
||||
elseif &l:completeopt =~# 'popup'
|
||||
let &l:completeopt = 'menu,menuone,popup,noselect,noinsert'
|
||||
else
|
||||
let &l:completeopt = 'menu,menuone,noselect,noinsert'
|
||||
endif
|
||||
@@ -278,6 +358,27 @@ function! ale#completion#GetAllTriggers() abort
|
||||
return deepcopy(s:trigger_character_map)
|
||||
endfunction
|
||||
|
||||
function! ale#completion#GetCompletionKind(kind) abort
|
||||
let l:lsp_symbol = get(g:ale_lsp_types, a:kind, '')
|
||||
|
||||
if !empty(l:lsp_symbol)
|
||||
return l:lsp_symbol
|
||||
endif
|
||||
|
||||
return get(g:ale_tsserver_types, a:kind, '')
|
||||
endfunction
|
||||
|
||||
function! ale#completion#GetCompletionSymbols(kind) abort
|
||||
let l:kind = ale#completion#GetCompletionKind(a:kind)
|
||||
let l:symbol = get(g:ale_completion_symbols, l:kind, '')
|
||||
|
||||
if !empty(l:symbol)
|
||||
return l:symbol
|
||||
endif
|
||||
|
||||
return get(g:ale_completion_symbols, '<default>', 'v')
|
||||
endfunction
|
||||
|
||||
function! s:CompletionStillValid(request_id) abort
|
||||
let [l:line, l:column] = getpos('.')[1:2]
|
||||
|
||||
@@ -287,7 +388,6 @@ function! s:CompletionStillValid(request_id) abort
|
||||
\&& b:ale_completion_info.line == l:line
|
||||
\&& (
|
||||
\ b:ale_completion_info.column == l:column
|
||||
\ || b:ale_completion_info.source is# 'deoplete'
|
||||
\ || b:ale_completion_info.source is# 'ale-omnifunc'
|
||||
\ || b:ale_completion_info.source is# 'ale-callback'
|
||||
\)
|
||||
@@ -329,18 +429,10 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
||||
call add(l:documentationParts, l:part.text)
|
||||
endfor
|
||||
|
||||
if l:suggestion.kind is# 'className'
|
||||
let l:kind = 'f'
|
||||
elseif l:suggestion.kind is# 'parameterName'
|
||||
let l:kind = 'f'
|
||||
else
|
||||
let l:kind = 'v'
|
||||
endif
|
||||
|
||||
" See :help complete-items
|
||||
let l:result = {
|
||||
\ 'word': l:suggestion.name,
|
||||
\ 'kind': l:kind,
|
||||
\ 'kind': ale#completion#GetCompletionSymbols(l:suggestion.kind),
|
||||
\ 'icase': 1,
|
||||
\ 'menu': join(l:displayParts, ''),
|
||||
\ 'dup': g:ale_completion_tsserver_autoimport,
|
||||
@@ -425,23 +517,6 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
continue
|
||||
endif
|
||||
|
||||
" See :help complete-items for Vim completion kinds
|
||||
if !has_key(l:item, 'kind')
|
||||
let l:kind = 'v'
|
||||
elseif l:item.kind is s:LSP_COMPLETION_METHOD_KIND
|
||||
let l:kind = 'm'
|
||||
elseif l:item.kind is s:LSP_COMPLETION_CONSTRUCTOR_KIND
|
||||
let l:kind = 'm'
|
||||
elseif l:item.kind is s:LSP_COMPLETION_FUNCTION_KIND
|
||||
let l:kind = 'f'
|
||||
elseif l:item.kind is s:LSP_COMPLETION_CLASS_KIND
|
||||
let l:kind = 'f'
|
||||
elseif l:item.kind is s:LSP_COMPLETION_INTERFACE_KIND
|
||||
let l:kind = 'f'
|
||||
else
|
||||
let l:kind = 'v'
|
||||
endif
|
||||
|
||||
let l:doc = get(l:item, 'documentation', '')
|
||||
|
||||
if type(l:doc) is v:t_dict && has_key(l:doc, 'value')
|
||||
@@ -450,7 +525,7 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
|
||||
call add(l:results, {
|
||||
\ 'word': l:word,
|
||||
\ 'kind': l:kind,
|
||||
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
|
||||
\ 'icase': 1,
|
||||
\ 'menu': get(l:item, 'detail', ''),
|
||||
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
||||
@@ -492,10 +567,17 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
|
||||
let l:identifiers = []
|
||||
|
||||
for l:name in l:names
|
||||
call add(l:identifiers, {
|
||||
let l:identifier = {
|
||||
\ 'name': l:name.word,
|
||||
\ 'source': get(l:name, 'source', ''),
|
||||
\})
|
||||
\}
|
||||
let l:source = get(l:name, 'source', '')
|
||||
|
||||
" Empty source results in no details for the completed item
|
||||
if !empty(l:source)
|
||||
call extend(l:identifier, { 'source': l:source })
|
||||
endif
|
||||
|
||||
call add(l:identifiers, l:identifier)
|
||||
endfor
|
||||
|
||||
let b:ale_completion_info.request_id = ale#lsp#Send(
|
||||
@@ -722,7 +804,9 @@ endfunction
|
||||
function! ale#completion#HandleUserData(completed_item) abort
|
||||
let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '')
|
||||
|
||||
if l:source isnot# 'ale-automatic' && l:source isnot# 'ale-manual'
|
||||
if l:source isnot# 'ale-automatic'
|
||||
\&& l:source isnot# 'ale-manual'
|
||||
\&& l:source isnot# 'ale-callback'
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -739,7 +823,7 @@ function! ale#completion#HandleUserData(completed_item) abort
|
||||
endif
|
||||
|
||||
for l:code_action in get(l:user_data, 'codeActions', [])
|
||||
call ale#code_action#HandleCodeAction(l:code_action)
|
||||
call ale#code_action#HandleCodeAction(l:code_action, v:false)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ let s:go_to_definition_map = {}
|
||||
|
||||
" Enable automatic updates of the tagstack
|
||||
let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1)
|
||||
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
|
||||
|
||||
" Used to get the definition map in tests.
|
||||
function! ale#definition#GetMap() abort
|
||||
@@ -134,6 +135,10 @@ function! s:GoToLSPDefinition(linter, options, capability) abort
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoTo(options) abort
|
||||
if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command')
|
||||
execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.'''
|
||||
endif
|
||||
|
||||
for l:linter in ale#linter#Get(&filetype)
|
||||
if !empty(l:linter.lsp)
|
||||
call s:GoToLSPDefinition(l:linter, a:options, 'definition')
|
||||
@@ -142,6 +147,10 @@ function! ale#definition#GoTo(options) abort
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoToType(options) abort
|
||||
if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command')
|
||||
execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.'''
|
||||
endif
|
||||
|
||||
for l:linter in ale#linter#Get(&filetype)
|
||||
if !empty(l:linter.lsp)
|
||||
" TODO: handle typeDefinition for tsserver if supported by the
|
||||
@@ -154,3 +163,33 @@ function! ale#definition#GoToType(options) abort
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoToCommandHandler(command, ...) abort
|
||||
let l:options = {}
|
||||
|
||||
if len(a:000) > 0
|
||||
for l:option in a:000
|
||||
if l:option is? '-tab'
|
||||
let l:options.open_in = 'tab'
|
||||
elseif l:option is? '-split'
|
||||
let l:options.open_in = 'split'
|
||||
elseif l:option is? '-vsplit'
|
||||
let l:options.open_in = 'vsplit'
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !has_key(l:options, 'open_in')
|
||||
let l:default_navigation = ale#Var(bufnr(''), 'default_navigation')
|
||||
|
||||
if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0
|
||||
let l:options.open_in = l:default_navigation
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:command is# 'type'
|
||||
call ale#definition#GoToType(l:options)
|
||||
else
|
||||
call ale#definition#GoTo(l:options)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -4,40 +4,15 @@ call ale#Set('fix_on_save_ignore', {})
|
||||
" Vim doesn't let you modify hidden buffers.
|
||||
function! ale#fix#ApplyQueuedFixes(buffer) abort
|
||||
let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0})
|
||||
let l:has_bufline_api = exists('*deletebufline') && exists('*setbufline')
|
||||
|
||||
if !l:data.done || (!l:has_bufline_api && a:buffer isnot bufnr(''))
|
||||
if !l:data.done || (!ale#util#HasBuflineApi() && a:buffer isnot bufnr(''))
|
||||
return
|
||||
endif
|
||||
|
||||
call remove(g:ale_fix_buffer_data, a:buffer)
|
||||
|
||||
if l:data.changes_made
|
||||
" If the file is in DOS mode, we have to remove carriage returns from
|
||||
" the ends of lines before calling setline(), or we will see them
|
||||
" twice.
|
||||
let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
|
||||
\ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')')
|
||||
\ : l:data.output
|
||||
let l:first_line_to_remove = len(l:new_lines) + 1
|
||||
|
||||
" Use a Vim API for setting lines in other buffers, if available.
|
||||
if l:has_bufline_api
|
||||
call setbufline(a:buffer, 1, l:new_lines)
|
||||
call deletebufline(a:buffer, l:first_line_to_remove, '$')
|
||||
" Fall back on setting lines the old way, for the current buffer.
|
||||
else
|
||||
let l:old_line_length = len(l:data.lines_before)
|
||||
|
||||
if l:old_line_length >= l:first_line_to_remove
|
||||
let l:save = winsaveview()
|
||||
silent execute
|
||||
\ l:first_line_to_remove . ',' . l:old_line_length . 'd_'
|
||||
call winrestview(l:save)
|
||||
endif
|
||||
|
||||
call setline(1, l:new_lines)
|
||||
endif
|
||||
let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output)
|
||||
|
||||
if l:data.should_save
|
||||
if a:buffer is bufnr('')
|
||||
|
||||
@@ -54,6 +54,11 @@ let s:default_registry = {
|
||||
\ 'description': 'Apply elm-format to a file.',
|
||||
\ 'aliases': ['format'],
|
||||
\ },
|
||||
\ 'nimpretty': {
|
||||
\ 'function': 'ale#fixers#nimpretty#Fix',
|
||||
\ 'suggested_filetypes': ['nim'],
|
||||
\ 'description': 'Apply nimpretty to a file.',
|
||||
\ },
|
||||
\ 'eslint': {
|
||||
\ 'function': 'ale#fixers#eslint#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript'],
|
||||
@@ -235,6 +240,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with stylish-haskell.',
|
||||
\ },
|
||||
\ 'purty': {
|
||||
\ 'function': 'ale#fixers#purty#Fix',
|
||||
\ 'suggested_filetypes': ['purescript'],
|
||||
\ 'description': 'Format PureScript files with purty.',
|
||||
\ },
|
||||
\ 'ocamlformat': {
|
||||
\ 'function': 'ale#fixers#ocamlformat#Fix',
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
@@ -350,6 +360,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['nix'],
|
||||
\ 'description': 'A formatter for Nix code',
|
||||
\ },
|
||||
\ 'html-beautify': {
|
||||
\ 'function': 'ale#fixers#html_beautify#Fix',
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
@@ -53,7 +53,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort
|
||||
" Use --fix-to-stdout with eslint_d
|
||||
if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0])
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ 'command': ale#handlers#eslint#GetCdString(a:buffer)
|
||||
\ . ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
@@ -63,7 +64,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort
|
||||
" 4.9.0 is the first version with --fix-dry-run
|
||||
if ale#semver#GTE(a:version, [4, 9, 0])
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ 'command': ale#handlers#eslint#GetCdString(a:buffer)
|
||||
\ . ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
@@ -71,7 +73,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ 'command': ale#handlers#eslint#GetCdString(a:buffer)
|
||||
\ . ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '')
|
||||
\ . ' --fix %t',
|
||||
|
||||
21
autoload/ale/fixers/html_beautify.vim
Normal file
21
autoload/ale/fixers/html_beautify.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: WhyNotHugo <hugo@barrera.io>
|
||||
" Description: Lint HTML files with html-beautify.
|
||||
"
|
||||
call ale#Set('html_beautify_executable', 'html-beautify')
|
||||
call ale#Set('html_beautify_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('html_beautify_options', '')
|
||||
call ale#Set('html_beautify_change_directory', 1)
|
||||
|
||||
function! ale#fixers#html_beautify#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'html_beautify',
|
||||
\ ['html-beautify']
|
||||
\)
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'html_beautify_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable). ' ' . l:options . ' -',
|
||||
\}
|
||||
endfunction
|
||||
15
autoload/ale/fixers/nimpretty.vim
Normal file
15
autoload/ale/fixers/nimpretty.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" Author: Nhan <hi@imnhan.com>
|
||||
" Description: Integration of nimpretty with ALE.
|
||||
|
||||
call ale#Set('nim_nimpretty_executable', 'nimpretty')
|
||||
call ale#Set('nim_nimpretty_options', '--maxLineLen:80')
|
||||
|
||||
function! ale#fixers#nimpretty#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'nim_nimpretty_executable')
|
||||
let l:options = ale#Var(a:buffer, 'nim_nimpretty_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' %t' . ale#Pad(l:options),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
22
autoload/ale/fixers/purty.vim
Normal file
22
autoload/ale/fixers/purty.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" Author: iclanzan <sorin@iclanzan.com>
|
||||
" Description: Integration of purty with ALE.
|
||||
|
||||
call ale#Set('purescript_purty_executable', 'purty')
|
||||
|
||||
function! ale#fixers#purty#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'purescript_purty_executable')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#purty#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#purty#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': l:executable
|
||||
\ . ' --write'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale#fixers#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
@@ -14,7 +15,14 @@ endfunction
|
||||
|
||||
function! ale#fixers#standard#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
||||
let l:filetype = getbufvar(a:buffer, '&filetype')
|
||||
let l:options_type = 'javascript_standard_options'
|
||||
|
||||
if l:filetype =~# 'typescript'
|
||||
let l:options_type = 'typescript_standard_options'
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, l:options_type)
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('stylelint_executable', 'stylelint')
|
||||
call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('stylelint_options', '')
|
||||
|
||||
function! ale#fixers#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'stylelint', [
|
||||
@@ -13,10 +14,14 @@ endfunction
|
||||
|
||||
function! ale#fixers#stylelint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'stylelint_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' --fix %t',
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --fix',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
" Description: Fixing R files with styler.
|
||||
|
||||
call ale#Set('r_styler_executable', 'Rscript')
|
||||
call ale#Set('r_styler_options', 'tidyverse_style')
|
||||
call ale#Set('r_styler_options', 'tidyverse_style()')
|
||||
|
||||
function! ale#fixers#styler#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': 'Rscript --vanilla -e '
|
||||
\ . '"suppressPackageStartupMessages(library(styler));'
|
||||
\ . 'style_file(commandArgs(TRUE), style = '
|
||||
\ . 'style_file(commandArgs(TRUE), transformers = '
|
||||
\ . ale#Var(a:buffer, 'r_styler_options') . ')"'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Functions for working with eslint, for checking or fixing files.
|
||||
|
||||
let s:executables = [
|
||||
\ 'node_modules/.bin/eslint_d',
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\]
|
||||
let s:sep = has('win32') ? '\' : '/'
|
||||
|
||||
call ale#Set('javascript_eslint_options', '')
|
||||
@@ -30,11 +35,31 @@ function! ale#handlers#eslint#FindConfig(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#eslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [
|
||||
\ 'node_modules/.bin/eslint_d',
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\])
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables)
|
||||
endfunction
|
||||
|
||||
" Given a buffer, return a command prefix string which changes directory
|
||||
" as necessary for running ESLint.
|
||||
function! ale#handlers#eslint#GetCdString(buffer) abort
|
||||
" ESLint 6 loads plugins/configs/parsers from the project root
|
||||
" By default, the project root is simply the CWD of the running process.
|
||||
" https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md
|
||||
" https://github.com/dense-analysis/ale/issues/2787
|
||||
"
|
||||
" If eslint is installed in a directory which contains the buffer, assume
|
||||
" it is the ESLint project root. Otherwise, use nearest node_modules.
|
||||
" Note: If node_modules not present yet, can't load local deps anyway.
|
||||
let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables)
|
||||
|
||||
if !empty(l:executable)
|
||||
let l:nmi = strridx(l:executable, 'node_modules')
|
||||
let l:project_dir = l:executable[0:l:nmi - 2]
|
||||
else
|
||||
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules')
|
||||
let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
|
||||
endif
|
||||
|
||||
return !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : ''
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#eslint#GetCommand(buffer) abort
|
||||
@@ -42,7 +67,8 @@ function! ale#handlers#eslint#GetCommand(buffer) abort
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'javascript_eslint_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
return ale#handlers#eslint#GetCdString(a:buffer)
|
||||
\ . ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
endfunction
|
||||
@@ -84,11 +110,14 @@ function! s:CheckForBadConfig(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! s:parseJSON(buffer, lines) abort
|
||||
try
|
||||
let l:parsed = json_decode(a:lines[-1])
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
let l:parsed = []
|
||||
|
||||
for l:line in a:lines
|
||||
try
|
||||
let l:parsed = extend(l:parsed, json_decode(l:line))
|
||||
catch
|
||||
endtry
|
||||
endfor
|
||||
|
||||
if type(l:parsed) != v:t_list || empty(l:parsed)
|
||||
return []
|
||||
|
||||
107
autoload/ale/handlers/shellcheck.vim
Normal file
107
autoload/ale/handlers/shellcheck.vim
Normal file
@@ -0,0 +1,107 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for using the shellcheck linter
|
||||
|
||||
function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
if !empty(l:shell_type)
|
||||
" Use the dash dialect for /bin/ash, etc.
|
||||
if l:shell_type is# 'ash'
|
||||
return 'dash'
|
||||
endif
|
||||
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
" If there's no hashbang, try using Vim's buffer variables.
|
||||
if getbufvar(a:buffer, 'is_bash', 0)
|
||||
return 'bash'
|
||||
elseif getbufvar(a:buffer, 'is_sh', 0)
|
||||
return 'sh'
|
||||
elseif getbufvar(a:buffer, 'is_kornshell', 0)
|
||||
return 'ksh'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
|
||||
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
|
||||
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
|
||||
let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
|
||||
if l:dialect is# 'auto'
|
||||
let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer)
|
||||
endif
|
||||
|
||||
return l:cd_string
|
||||
\ . '%e'
|
||||
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
||||
\ . l:external_option
|
||||
\ . ' -f gcc -'
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#shellcheck#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[4] is# 'error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[4] is# 'note'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6],
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
||||
let l:item['filename'] = l:match[1]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#shellcheck#DefineLinter(filetype) abort
|
||||
" This global variable can be set with a string of comma-separated error
|
||||
" codes to exclude from shellcheck. For example:
|
||||
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
|
||||
call ale#Set('sh_shellcheck_executable', 'shellcheck')
|
||||
call ale#Set('sh_shellcheck_dialect', 'auto')
|
||||
call ale#Set('sh_shellcheck_options', '')
|
||||
call ale#Set('sh_shellcheck_change_directory', 1)
|
||||
|
||||
call ale#linter#Define(a:filetype, {
|
||||
\ 'name': 'shellcheck',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale#Var(buffer, 'sh_shellcheck_executable'),
|
||||
\ '%e --version',
|
||||
\ function('ale#handlers#shellcheck#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale#handlers#shellcheck#Handle',
|
||||
\})
|
||||
endfunction
|
||||
@@ -210,6 +210,12 @@ function! ale#highlight#SetHighlights(buffer, loclist) abort
|
||||
" Set the list in the buffer variable.
|
||||
call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list)
|
||||
|
||||
let l:exclude_list = ale#Var(a:buffer, 'exclude_highlights')
|
||||
|
||||
if !empty(l:exclude_list)
|
||||
call filter(l:new_list, 'empty(ale#util#GetMatches(v:val.text, l:exclude_list))')
|
||||
endif
|
||||
|
||||
" Update highlights for the current buffer, which may or may not
|
||||
" be the buffer we just set highlights for.
|
||||
call ale#highlight#UpdateHighlights()
|
||||
|
||||
@@ -42,6 +42,11 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
|
||||
\&& exists('*balloon_show')
|
||||
\&& ale#Var(l:options.buffer, 'set_balloons')
|
||||
call balloon_show(a:response.body.displayString)
|
||||
elseif g:ale_hover_to_preview
|
||||
call ale#preview#Show(split(a:response.body.displayString, "\n"), {
|
||||
\ 'filetype': 'ale-preview.message',
|
||||
\ 'stay_here': 1,
|
||||
\})
|
||||
else
|
||||
call ale#util#ShowMessage(a:response.body.displayString)
|
||||
endif
|
||||
@@ -98,6 +103,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
|
||||
\&& exists('*balloon_show')
|
||||
\&& ale#Var(l:options.buffer, 'set_balloons')
|
||||
call balloon_show(l:str)
|
||||
elseif g:ale_hover_to_preview
|
||||
call ale#preview#Show(split(l:str, "\n"), {
|
||||
\ 'filetype': 'ale-preview.message',
|
||||
\ 'stay_here': 1,
|
||||
\})
|
||||
else
|
||||
call ale#util#ShowMessage(l:str)
|
||||
endif
|
||||
|
||||
@@ -130,6 +130,12 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
|
||||
call s:HandleLSPErrorMessage(l:linter_name, a:response)
|
||||
elseif l:method is# 'textDocument/publishDiagnostics'
|
||||
call s:HandleLSPDiagnostics(a:conn_id, a:response)
|
||||
elseif l:method is# 'window/showMessage'
|
||||
call ale#lsp_window#HandleShowMessage(
|
||||
\ s:lsp_linter_map[a:conn_id],
|
||||
\ g:ale_lsp_show_message_format,
|
||||
\ a:response.params
|
||||
\)
|
||||
elseif get(a:response, 'type', '') is# 'event'
|
||||
\&& get(a:response, 'event', '') is# 'semanticDiag'
|
||||
call s:HandleTSServerDiagnostics(a:response, 'semantic')
|
||||
|
||||
58
autoload/ale/lsp_window.vim
Normal file
58
autoload/ale/lsp_window.vim
Normal file
@@ -0,0 +1,58 @@
|
||||
" Author: suoto <andre820@gmail.com>
|
||||
" Description: Handling of window/* LSP methods, although right now only
|
||||
" handles window/showMessage
|
||||
|
||||
" Constants for message type codes
|
||||
let s:LSP_MESSAGE_TYPE_DISABLED = 0
|
||||
let s:LSP_MESSAGE_TYPE_ERROR = 1
|
||||
let s:LSP_MESSAGE_TYPE_WARNING = 2
|
||||
let s:LSP_MESSAGE_TYPE_INFORMATION = 3
|
||||
let s:LSP_MESSAGE_TYPE_LOG = 4
|
||||
|
||||
" Translate strings from the user config to a number so we can check
|
||||
" severities
|
||||
let s:CFG_TO_LSP_SEVERITY = {
|
||||
\ 'disabled': s:LSP_MESSAGE_TYPE_DISABLED,
|
||||
\ 'error': s:LSP_MESSAGE_TYPE_ERROR,
|
||||
\ 'warning': s:LSP_MESSAGE_TYPE_WARNING,
|
||||
\ 'information': s:LSP_MESSAGE_TYPE_INFORMATION,
|
||||
\ 'info': s:LSP_MESSAGE_TYPE_INFORMATION,
|
||||
\ 'log': s:LSP_MESSAGE_TYPE_LOG
|
||||
\}
|
||||
|
||||
" Handle window/showMessage response.
|
||||
" - details: dict containing linter name and format (g:ale_lsp_show_message_format)
|
||||
" - params: dict with the params for the call in the form of {type: number, message: string}
|
||||
function! ale#lsp_window#HandleShowMessage(linter_name, format, params) abort
|
||||
let l:message = a:params.message
|
||||
let l:type = a:params.type
|
||||
|
||||
" Get the configured severity level threshold and check if the message
|
||||
" should be displayed or not
|
||||
let l:configured_severity = tolower(get(g:, 'ale_lsp_show_message_severity', 'error'))
|
||||
" If the user has configured with a value we can't find on the conversion
|
||||
" dict, fall back to warning
|
||||
let l:cfg_severity_threshold = get(s:CFG_TO_LSP_SEVERITY, l:configured_severity, s:LSP_MESSAGE_TYPE_WARNING)
|
||||
|
||||
if l:type > l:cfg_severity_threshold
|
||||
return
|
||||
endif
|
||||
|
||||
" Severity will depend on the message type
|
||||
if l:type is# s:LSP_MESSAGE_TYPE_ERROR
|
||||
let l:severity = g:ale_echo_msg_error_str
|
||||
elseif l:type is# s:LSP_MESSAGE_TYPE_INFORMATION
|
||||
let l:severity = g:ale_echo_msg_info_str
|
||||
elseif l:type is# s:LSP_MESSAGE_TYPE_LOG
|
||||
let l:severity = g:ale_echo_msg_log_str
|
||||
else
|
||||
" Default to warning just in case
|
||||
let l:severity = g:ale_echo_msg_warning_str
|
||||
endif
|
||||
|
||||
let l:string = substitute(a:format, '\V%severity%', l:severity, 'g')
|
||||
let l:string = substitute(l:string, '\V%linter%', a:linter_name, 'g')
|
||||
let l:string = substitute(l:string, '\V%s\>', l:message, 'g')
|
||||
|
||||
call ale#util#ShowMessage(l:string)
|
||||
endfunction
|
||||
@@ -12,6 +12,18 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endif
|
||||
|
||||
let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list)
|
||||
|
||||
if !empty(l:nearest)
|
||||
return l:nearest
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endfunction
|
||||
|
||||
" Given a buffer number, a base variable name, and a list of paths to search
|
||||
" for in ancestor directories, detect the executable path for a Node program.
|
||||
function! ale#node#FindNearestExecutable(buffer, path_list) abort
|
||||
for l:path in a:path_list
|
||||
let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
|
||||
|
||||
@@ -20,7 +32,7 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Create a executable string which executes a Node.js script command with a
|
||||
|
||||
@@ -15,7 +15,7 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort
|
||||
call ale#code_action#HandleCodeAction({
|
||||
\ 'description': 'Organize Imports',
|
||||
\ 'changes': l:file_code_edits,
|
||||
\})
|
||||
\}, v:false)
|
||||
endfunction
|
||||
|
||||
function! s:OnReady(linter, lsp_details) abort
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Preview windows for showing whatever information in.
|
||||
|
||||
if !has_key(s:, 'last_selection_list')
|
||||
let s:last_selection_list = []
|
||||
endif
|
||||
|
||||
if !has_key(s:, 'last_selection_open_in')
|
||||
let s:last_selection_open_in = 'current-buffer'
|
||||
endif
|
||||
|
||||
" Open a preview window and show some lines in it.
|
||||
" A second argument can be passed as a Dictionary with options. They are...
|
||||
"
|
||||
@@ -67,9 +75,24 @@ function! ale#preview#ShowSelection(item_list, ...) abort
|
||||
|
||||
call ale#preview#Show(l:lines, {'filetype': 'ale-preview-selection'})
|
||||
let b:ale_preview_item_list = a:item_list
|
||||
let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer')
|
||||
|
||||
" Remove the last preview
|
||||
let s:last_selection_list = b:ale_preview_item_list
|
||||
let s:last_selection_open_in = b:ale_preview_item_open_in
|
||||
endfunction
|
||||
|
||||
function! s:Open(open_in_tab) abort
|
||||
function! ale#preview#RepeatSelection() abort
|
||||
if empty(s:last_selection_list)
|
||||
return
|
||||
endif
|
||||
|
||||
call ale#preview#ShowSelection(s:last_selection_list, {
|
||||
\ 'open_in': s:last_selection_open_in,
|
||||
\})
|
||||
endfunction
|
||||
|
||||
function! s:Open(open_in) abort
|
||||
let l:item_list = get(b:, 'ale_preview_item_list', [])
|
||||
let l:item = get(l:item_list, getpos('.')[1] - 1, {})
|
||||
|
||||
@@ -77,22 +100,20 @@ function! s:Open(open_in_tab) abort
|
||||
return
|
||||
endif
|
||||
|
||||
if !a:open_in_tab
|
||||
:q!
|
||||
endif
|
||||
:q!
|
||||
|
||||
call ale#util#Open(
|
||||
\ l:item.filename,
|
||||
\ l:item.line,
|
||||
\ l:item.column,
|
||||
\ {'open_in_tab': a:open_in_tab},
|
||||
\ {'open_in': a:open_in},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale#preview#OpenSelectionInBuffer() abort
|
||||
call s:Open(0)
|
||||
function! ale#preview#OpenSelection() abort
|
||||
call s:Open(b:ale_preview_item_open_in)
|
||||
endfunction
|
||||
|
||||
function! ale#preview#OpenSelectionInTab() abort
|
||||
call s:Open(1)
|
||||
call s:Open('tab')
|
||||
endfunction
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
|
||||
|
||||
let s:references_map = {}
|
||||
|
||||
" Used to get the references map in tests.
|
||||
@@ -99,7 +101,8 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message)
|
||||
|
||||
let s:references_map[l:request_id] = {
|
||||
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0
|
||||
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0,
|
||||
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -110,10 +113,24 @@ function! ale#references#Find(...) abort
|
||||
for l:option in a:000
|
||||
if l:option is? '-relative'
|
||||
let l:options.use_relative_paths = 1
|
||||
elseif l:option is? '-tab'
|
||||
let l:options.open_in = 'tab'
|
||||
elseif l:option is? '-split'
|
||||
let l:options.open_in = 'split'
|
||||
elseif l:option is? '-vsplit'
|
||||
let l:options.open_in = 'vsplit'
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !has_key(l:options, 'open_in')
|
||||
let l:default_navigation = ale#Var(bufnr(''), 'default_navigation')
|
||||
|
||||
if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0
|
||||
let l:options.open_in = l:default_navigation
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
let [l:line, l:column] = getpos('.')[1:2]
|
||||
let l:column = min([l:column, len(getline(l:line))])
|
||||
|
||||
@@ -80,7 +80,7 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort
|
||||
call ale#code_action#HandleCodeAction({
|
||||
\ 'description': 'rename',
|
||||
\ 'changes': l:changes,
|
||||
\})
|
||||
\}, v:true)
|
||||
endfunction
|
||||
|
||||
function! ale#rename#HandleLSPResponse(conn_id, response) abort
|
||||
@@ -134,7 +134,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
|
||||
call ale#code_action#HandleCodeAction({
|
||||
\ 'description': 'rename',
|
||||
\ 'changes': l:changes,
|
||||
\})
|
||||
\}, v:true)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000)
|
||||
let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0)
|
||||
let g:ale_sign_highlight_linenrs = get(g:, 'ale_sign_highlight_linenrs', 0)
|
||||
|
||||
let s:supports_sign_groups = has('nvim-0.4.2') || has('patch-8.1.614')
|
||||
|
||||
if !hlexists('ALEErrorSign')
|
||||
highlight link ALEErrorSign error
|
||||
endif
|
||||
@@ -149,7 +151,7 @@ function! ale#sign#GetSignName(sublist) abort
|
||||
endfunction
|
||||
|
||||
function! s:PriorityCmd() abort
|
||||
if has('nvim-0.4.0') || (v:version >= 801 && has('patch614'))
|
||||
if s:supports_sign_groups
|
||||
return ' priority=' . g:ale_sign_priority . ' '
|
||||
else
|
||||
return ''
|
||||
@@ -157,7 +159,7 @@ function! s:PriorityCmd() abort
|
||||
endfunction
|
||||
|
||||
function! s:GroupCmd() abort
|
||||
if has('nvim-0.4.0') || (v:version >= 801 && has('patch614'))
|
||||
if s:supports_sign_groups
|
||||
return ' group=ale '
|
||||
else
|
||||
return ' '
|
||||
@@ -175,7 +177,7 @@ function! ale#sign#ReadSigns(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#sign#ParsePattern() abort
|
||||
if has('nvim-0.4.0') || (v:version >= 801 && has('patch614'))
|
||||
if s:supports_sign_groups
|
||||
" Matches output like :
|
||||
" line=4 id=1 group=ale name=ALEErrorSign
|
||||
" строка=1 id=1000001 группа=ale имя=ALEErrorSign
|
||||
@@ -460,7 +462,7 @@ endfunction
|
||||
|
||||
" Remove all signs.
|
||||
function! ale#sign#Clear() abort
|
||||
if has('nvim-0.4.0') || (v:version >= 801 && has('patch614'))
|
||||
if s:supports_sign_groups
|
||||
sign unplace group=ale *
|
||||
else
|
||||
sign unplace *
|
||||
|
||||
@@ -91,17 +91,17 @@ endfunction
|
||||
" options['open_in'] can be:
|
||||
" current-buffer (default)
|
||||
" tab
|
||||
" vertical-split
|
||||
" horizontal-split
|
||||
" split
|
||||
" vsplit
|
||||
function! ale#util#Open(filename, line, column, options) abort
|
||||
let l:open_in = get(a:options, 'open_in', 'current-buffer')
|
||||
let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename)
|
||||
|
||||
if l:open_in is# 'tab'
|
||||
call ale#util#Execute('tabedit ' . l:args_to_open)
|
||||
elseif l:open_in is# 'horizontal-split'
|
||||
elseif l:open_in is# 'split'
|
||||
call ale#util#Execute('split ' . l:args_to_open)
|
||||
elseif l:open_in is# 'vertical-split'
|
||||
elseif l:open_in is# 'vsplit'
|
||||
call ale#util#Execute('vsplit ' . l:args_to_open)
|
||||
elseif bufnr(a:filename) isnot bufnr('')
|
||||
" Open another file only if we need to.
|
||||
@@ -336,15 +336,11 @@ function! ale#util#GetMatches(lines, patterns) abort
|
||||
endfunction
|
||||
|
||||
function! s:LoadArgCount(function) abort
|
||||
let l:Function = a:function
|
||||
|
||||
redir => l:output
|
||||
silent! function Function
|
||||
redir END
|
||||
|
||||
if !exists('l:output')
|
||||
try
|
||||
let l:output = execute('function a:function')
|
||||
catch /E123/
|
||||
return 0
|
||||
endif
|
||||
endtry
|
||||
|
||||
let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2]
|
||||
let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''')
|
||||
@@ -480,3 +476,44 @@ endfunction
|
||||
function! ale#util#Input(message, value) abort
|
||||
return input(a:message, a:value)
|
||||
endfunction
|
||||
|
||||
function! ale#util#HasBuflineApi() abort
|
||||
return exists('*deletebufline') && exists('*setbufline')
|
||||
endfunction
|
||||
|
||||
" Sets buffer contents to lines
|
||||
function! ale#util#SetBufferContents(buffer, lines) abort
|
||||
let l:has_bufline_api = ale#util#HasBuflineApi()
|
||||
|
||||
if !l:has_bufline_api && a:buffer isnot bufnr('')
|
||||
return
|
||||
endif
|
||||
|
||||
" If the file is in DOS mode, we have to remove carriage returns from
|
||||
" the ends of lines before calling setline(), or we will see them
|
||||
" twice.
|
||||
let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
|
||||
\ ? map(copy(a:lines), 'substitute(v:val, ''\r\+$'', '''', '''')')
|
||||
\ : a:lines
|
||||
let l:first_line_to_remove = len(l:new_lines) + 1
|
||||
|
||||
" Use a Vim API for setting lines in other buffers, if available.
|
||||
if l:has_bufline_api
|
||||
call setbufline(a:buffer, 1, l:new_lines)
|
||||
call deletebufline(a:buffer, l:first_line_to_remove, '$')
|
||||
" Fall back on setting lines the old way, for the current buffer.
|
||||
else
|
||||
let l:old_line_length = line('$')
|
||||
|
||||
if l:old_line_length >= l:first_line_to_remove
|
||||
let l:save = winsaveview()
|
||||
silent execute
|
||||
\ l:first_line_to_remove . ',' . l:old_line_length . 'd_'
|
||||
call winrestview(l:save)
|
||||
endif
|
||||
|
||||
call setline(1, l:new_lines)
|
||||
endif
|
||||
|
||||
return l:new_lines
|
||||
endfunction
|
||||
|
||||
13
doc/ale-bats.txt
Normal file
13
doc/ale-bats.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
===============================================================================
|
||||
ALE Bats Integration *ale-bats-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
shellcheck *ale-bats-shellcheck*
|
||||
|
||||
The `shellcheck` linter for Bats uses the sh options for `shellcheck`; see:
|
||||
|ale-sh-shellcheck|.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
@@ -219,6 +219,25 @@ g:ale_go_govet_options *g:ale_go_govet_options*
|
||||
This variable can be set to pass additional options to the go vet linter.
|
||||
|
||||
|
||||
===============================================================================
|
||||
revive *ale-go-revive*
|
||||
|
||||
g:ale_go_revive_executable *g:ale_go_revive_executable*
|
||||
*b:ale_go_revive_executable*
|
||||
Type: |String|
|
||||
Default: `'revive'`
|
||||
|
||||
This variable can be set to change the revive executable path.
|
||||
|
||||
|
||||
g:ale_go_revive_options *g:ale_go_revive_options*
|
||||
*b:ale_go_revive_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to the revive
|
||||
|
||||
|
||||
===============================================================================
|
||||
staticcheck *ale-go-staticcheck*
|
||||
|
||||
|
||||
@@ -9,6 +9,16 @@ fecs *ale-html-fecs*
|
||||
and both of them reads `./.fecsrc` as the default configuration file.
|
||||
See: |ale-javascript-fecs|.
|
||||
|
||||
===============================================================================
|
||||
html-beautify *ale-html-beautify*
|
||||
|
||||
g:ale_html_beautify_options *g:ale_html_beautify_options*
|
||||
*b:ale_html_beautify_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to modify flags given to html-beautify.
|
||||
|
||||
|
||||
===============================================================================
|
||||
htmlhint *ale-html-htmlhint*
|
||||
|
||||
@@ -46,7 +46,7 @@ javac *ale-java-javac*
|
||||
|
||||
g:ale_java_javac_classpath *g:ale_java_javac_classpath*
|
||||
*b:ale_java_javac_classpath*
|
||||
Type: |String|
|
||||
Type: |String| or |List|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to change the global classpath for Java.
|
||||
@@ -67,6 +67,30 @@ g:ale_java_javac_options *g:ale_java_javac_options*
|
||||
|
||||
This variable can be set to pass additional options to javac.
|
||||
|
||||
g:ale_java_javac_sourcepath *g:ale_java_javac_sourcepath*
|
||||
*b:ale_java_javac_sourcepath*
|
||||
Type: |String| or |List|
|
||||
Default: `''`
|
||||
|
||||
This variable can set multiple source code paths, the source code path is a
|
||||
relative path (relative to the project root directory).
|
||||
|
||||
Example:
|
||||
|
||||
String type:
|
||||
Note that the unix system separator is a colon(`:`) window system
|
||||
is a semicolon(`;`).
|
||||
>
|
||||
let g:ale_java_javac_sourcepath = 'build/gen/source/xx/main:build/gen/source'
|
||||
<
|
||||
List type:
|
||||
>
|
||||
let g:ale_java_javac_sourcepath = [
|
||||
\ 'build/generated/source/querydsl/main',
|
||||
\ 'target/generated-sources/source/querydsl/main'
|
||||
\ ]
|
||||
<
|
||||
|
||||
|
||||
===============================================================================
|
||||
google-java-format *ale-java-google-java-format*
|
||||
@@ -222,6 +246,17 @@ g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path*
|
||||
absolute path of the Eclipse workspace. If not set this value will be set to
|
||||
the parent folder of the project root.
|
||||
|
||||
g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent*
|
||||
*b:ale_java_eclipselsp_javaagent*
|
||||
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
A variable to add java agent for annotation processing such as Lombok.
|
||||
If you have multiple java agent files, use space to separate them. For example:
|
||||
>
|
||||
let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar'
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
uncrustify *ale-java-uncrustify*
|
||||
|
||||
45
doc/ale-nim.txt
Normal file
45
doc/ale-nim.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
===============================================================================
|
||||
ALE Nim Integration *ale-nim-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
nimcheck *ale-nim-nimcheck*
|
||||
|
||||
ALE does not provide additional configuration options for `nimcheck` at this
|
||||
point.
|
||||
|
||||
|
||||
===============================================================================
|
||||
nimlsp *ale-nim-nimlsp*
|
||||
|
||||
g:nim_nimlsp_nim_sources *g:nim_nimlsp_nim_sources*
|
||||
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
Sets the path to Nim source repository as the first argument to `nimlsp`
|
||||
command.
|
||||
|
||||
|
||||
===============================================================================
|
||||
nimpretty *ale-nim-nimpretty*
|
||||
|
||||
|
||||
g:ale_nim_nimpretty_executable *g:ale_nim_nimpretty_executable*
|
||||
*b:ale_nim_nimpretty_executable*
|
||||
Type: |String|
|
||||
Default: `'nimpretty'`
|
||||
|
||||
This variable can be changed to use a different executable for nimpretty.
|
||||
|
||||
|
||||
g:ale_nim_nimpretty_options *g:ale_nim_nimpretty_options*
|
||||
*b:ale_nim_nimpretty_options*
|
||||
Type: |String|
|
||||
Default: `'--maxLineLen:80'`
|
||||
|
||||
This variable can be changed to modify flags given to nimpretty.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
@@ -189,6 +189,13 @@ g:ale_php_psalm_executable *g:ale_php_psalm_executable*
|
||||
|
||||
This variable sets the executable used for psalm.
|
||||
|
||||
g:ale_psalm_langserver_options *g:ale_psalm_langserver_options*
|
||||
*b:ale_psalm_langserver_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to psalm.
|
||||
|
||||
===============================================================================
|
||||
php-cs-fixer *ale-php-php-cs-fixer*
|
||||
|
||||
|
||||
@@ -29,5 +29,14 @@ g:ale_purescript_ls_config g:ale_purescript_ls_config
|
||||
\ 'buildCommand': 'spago build -- --json-errors'
|
||||
\ }
|
||||
\}
|
||||
===============================================================================
|
||||
purty *ale-purescript-purty*
|
||||
|
||||
g:ale_purescript_purty_executable *g:ale_purescript_purty_executable*
|
||||
*b:ale_purescript_purty_executable*
|
||||
Type: |String|
|
||||
Default: `'purty'`
|
||||
|
||||
This variable can be changed to use a different executable for purty.
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
@@ -145,8 +145,8 @@ g:ale_python_black_use_global *g:ale_python_black_use_global*
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv*
|
||||
*b:ale_python_black_auto_pipenv*
|
||||
g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv*
|
||||
*b:ale_python_black_auto_pipenv*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
@@ -263,6 +263,15 @@ to check for errors while you type.
|
||||
`mypy` will be run from a detected project root, per |ale-python-root|.
|
||||
|
||||
|
||||
g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv*
|
||||
*b:ale_python_mypy_auto_pipenv*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
|
||||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
g:ale_python_mypy_executable *g:ale_python_mypy_executable*
|
||||
*b:ale_python_mypy_executable*
|
||||
Type: |String|
|
||||
@@ -272,6 +281,7 @@ g:ale_python_mypy_executable *g:ale_python_mypy_executable*
|
||||
|
||||
Set this to `'pipenv'` to invoke `'pipenv` `run` `mypy'`.
|
||||
|
||||
|
||||
g:ale_python_mypy_ignore_invalid_syntax
|
||||
*g:ale_python_mypy_ignore_invalid_syntax*
|
||||
*b:ale_python_mypy_ignore_invalid_syntax*
|
||||
@@ -292,6 +302,14 @@ g:ale_python_mypy_options *g:ale_python_mypy_options*
|
||||
invocation.
|
||||
|
||||
|
||||
g:ale_python_mypy_show_notes *g:ale_python_mypy_show_notes*
|
||||
*b:ale_python_mypy_show_notes*
|
||||
Type: |Number|
|
||||
Default: `1`
|
||||
|
||||
If enabled, notes on lines will be displayed as 'I' (info) messages.
|
||||
|
||||
|
||||
g:ale_python_mypy_use_global *g:ale_python_mypy_use_global*
|
||||
*b:ale_python_mypy_use_global*
|
||||
Type: |Number|
|
||||
@@ -300,14 +318,6 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global*
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv*
|
||||
*b:ale_python_mypy_auto_pipenv*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
|
||||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
===============================================================================
|
||||
prospector *ale-python-prospector*
|
||||
|
||||
@@ -9,7 +9,7 @@ Integration Information
|
||||
files for Rust distributed in Vim >=8.0.0501 or upstream:
|
||||
https://github.com/rust-lang/rust.vim
|
||||
|
||||
Note that there are three possible linters for Rust files:
|
||||
Note that there are several possible linters and fixers for Rust files:
|
||||
|
||||
1. rustc -- The Rust compiler is used to check the currently edited file.
|
||||
So, if your project consists of multiple files, you will get some errors
|
||||
@@ -23,7 +23,12 @@ Integration Information
|
||||
over cargo. rls implements the Language Server Protocol for incremental
|
||||
compilation of Rust code, and can check Rust files while you type. `rls`
|
||||
requires Rust files to contained in Cargo projects.
|
||||
4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
|
||||
4. analyzer -- If you have rust-analyzer installed, you might prefer using
|
||||
this linter over cargo and rls. rust-analyzer also implements the
|
||||
Language Server Protocol for incremental compilation of Rust code, and is
|
||||
the next iteration of rls. rust-analyzer, like rls, requires Rust files
|
||||
to contained in Cargo projects.
|
||||
5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
|
||||
consistently reformat your Rust code.
|
||||
|
||||
Only cargo is enabled by default. To switch to using rustc instead of cargo,
|
||||
@@ -36,6 +41,25 @@ Integration Information
|
||||
Also note that rustc 1.12. or later is needed.
|
||||
|
||||
|
||||
===============================================================================
|
||||
analyzer *ale-rust-analyzer*
|
||||
|
||||
g:ale_rust_analyzer_executable *g:ale_rust_analyzer_executable*
|
||||
*b:ale_rust_analyzer_executable*
|
||||
Type: |String|
|
||||
Default: `'rust-analyzer'`
|
||||
|
||||
This variable can be modified to change the executable path for
|
||||
`rust-analyzer`.
|
||||
|
||||
|
||||
g:ale_rust_analyzer_config *g:ale_rust_analyzer_config*
|
||||
*b:ale_rust_analyzer_config*
|
||||
Type: |Dictionary|
|
||||
Default: `{}`
|
||||
|
||||
Dictionary with configuration settings for rust-analyzer.
|
||||
|
||||
===============================================================================
|
||||
cargo *ale-rust-cargo*
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ Notes:
|
||||
* `shell` (-n flag)
|
||||
* `shellcheck`
|
||||
* `shfmt`
|
||||
* Bats
|
||||
* `shellcheck`
|
||||
* BibTeX
|
||||
* `bibclean`
|
||||
* Bourne Shell
|
||||
@@ -162,6 +164,7 @@ Notes:
|
||||
* `gosimple`!!
|
||||
* `gotype`!!
|
||||
* `go vet`!!
|
||||
* `revive`!!
|
||||
* `staticcheck`!!
|
||||
* GraphQL
|
||||
* `eslint`
|
||||
@@ -194,6 +197,7 @@ Notes:
|
||||
* HTML
|
||||
* `alex`!!
|
||||
* `fecs`
|
||||
* `html-beautify`
|
||||
* `HTMLHint`
|
||||
* `prettier`
|
||||
* `proselint`
|
||||
@@ -282,6 +286,8 @@ Notes:
|
||||
* `nasm`!!
|
||||
* Nim
|
||||
* `nim check`!!
|
||||
* `nimlsp`
|
||||
* `nimpretty`
|
||||
* nix
|
||||
* `nix-instantiate`
|
||||
* `nixpkgs-fmt`
|
||||
@@ -347,6 +353,7 @@ Notes:
|
||||
* `puppet-lint`
|
||||
* PureScript
|
||||
* `purescript-language-server`
|
||||
* `purty`
|
||||
* Python
|
||||
* `autopep8`
|
||||
* `bandit`
|
||||
@@ -404,6 +411,7 @@ Notes:
|
||||
* Rust
|
||||
* `cargo`!!
|
||||
* `rls`
|
||||
* `rust-analyzer`
|
||||
* `rustc` (see |ale-integration-rust|)
|
||||
* `rustfmt`
|
||||
* Sass
|
||||
@@ -465,6 +473,7 @@ Notes:
|
||||
* `eslint`
|
||||
* `fecs`
|
||||
* `prettier`
|
||||
* `standard`
|
||||
* `tslint`
|
||||
* `tsserver`
|
||||
* `typecheck`
|
||||
@@ -480,6 +489,7 @@ Notes:
|
||||
* `vcom`
|
||||
* `xvhdl`
|
||||
* Vim
|
||||
* `vimls`
|
||||
* `vint`
|
||||
* Vim help^
|
||||
* `alex`!!
|
||||
|
||||
@@ -32,6 +32,25 @@ g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable*
|
||||
This variable can be changed to use a different executable for terraform.
|
||||
|
||||
|
||||
===============================================================================
|
||||
terraform-lsp *ale-terraform-terraform-lsp*
|
||||
|
||||
g:ale_terraform_langserver_executable *g:ale_terraform_langserver_executable*
|
||||
*b:ale_terraform_langserver_executable*
|
||||
Type: |String|
|
||||
Default: `'terraform-lsp'`
|
||||
|
||||
This variable can be changed to use a different executable for terraform-lsp.
|
||||
|
||||
|
||||
g:ale_terraform_langserver_options *g:ale_terraform_langserver_options*
|
||||
*b:ale_terraform_langserver_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to pass custom CLI flags to terraform-lsp.
|
||||
|
||||
|
||||
===============================================================================
|
||||
tflint *ale-terraform-tflint*
|
||||
|
||||
|
||||
@@ -16,6 +16,33 @@ prettier *ale-typescript-prettier*
|
||||
See |ale-javascript-prettier| for information about the available options.
|
||||
|
||||
|
||||
===============================================================================
|
||||
standard *ale-typescript-standard*
|
||||
|
||||
g:ale_typescript_standard_executable *g:ale_typescript_standard_executable*
|
||||
*b:ale_typescript_standard_executable*
|
||||
Type: |String|
|
||||
Default: `'standard'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_typescript_standard_options *g:ale_typescript_standard_options*
|
||||
*b:ale_typescript_standard_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to standard.
|
||||
|
||||
|
||||
g:ale_typescript_standard_use_global *g:ale_typescript_standard_use_global*
|
||||
*b:ale_typescript_standard_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
tslint *ale-typescript-tslint*
|
||||
|
||||
|
||||
@@ -2,6 +2,61 @@
|
||||
ALE Vim Integration *ale-vim-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
vimls *ale-vim-vimls*
|
||||
|
||||
The `vim-language-server` is the engine that powers VimL editor support
|
||||
using the Language Server Protocol. See the installation instructions:
|
||||
https://github.com/iamcco/vim-language-server#install
|
||||
|
||||
g:ale_vim_vimls_executable *g:ale_vim_vimls_executable*
|
||||
*b:ale_vim_vimls_executable*
|
||||
Type: |String|
|
||||
Default: `'vim-language-server'`
|
||||
|
||||
This option can be set to change the executable path for vimls.
|
||||
|
||||
|
||||
g:ale_vim_vimls_config *g:ale_vim_vimls_config*
|
||||
*b:ale_vim_vimls_config*
|
||||
Type: |Dictionary|
|
||||
Default: `{}`
|
||||
|
||||
Dictionary containing configuration settings that will be passed to the
|
||||
language server. For example: >
|
||||
{
|
||||
\ 'vim': {
|
||||
\ 'iskeyword': '@,48-57,_,192-255,-#',
|
||||
\ 'vimruntime': '',
|
||||
\ 'runtimepath': '',
|
||||
\ 'diagnostic': {
|
||||
\ 'enable': v:true
|
||||
\ },
|
||||
\ 'indexes': {
|
||||
\ 'runtimepath': v:true,
|
||||
\ 'gap': 100,
|
||||
\ 'count': 3,
|
||||
\ 'projectRootPatterns' : ['.git', 'autoload', 'plugin']
|
||||
\ },
|
||||
\ 'suggest': {
|
||||
\ 'fromVimruntime': v:true,
|
||||
\ 'fromRuntimepath': v:false
|
||||
\ },
|
||||
\ }
|
||||
\}
|
||||
<
|
||||
Consult the vim-language-server documentation for more information about
|
||||
settings.
|
||||
|
||||
|
||||
g:ale_vim_vimls_use_global *g:ale_vim_vimls_use_global*
|
||||
*b:ale_vim_vimls_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
vint *ale-vim-vint*
|
||||
|
||||
|
||||
318
doc/ale.txt
318
doc/ale.txt
@@ -433,17 +433,54 @@ vimrc, and your issues should go away. >
|
||||
set completeopt=menu,menuone,preview,noselect,noinsert
|
||||
<
|
||||
|
||||
Or alternatively, if you want to show documentation in popups: >
|
||||
|
||||
set completeopt=menu,menuone,popup,noselect,noinsert
|
||||
<
|
||||
*ale-symbols*
|
||||
|
||||
ALE provides a set of basic completion symbols. If you want to replace those
|
||||
symbols with others, you can set the variable |g:ale_completion_symbols| with
|
||||
a mapping of the type of completion to the symbol or other string that you
|
||||
would like to use. An example here shows the available options for symbols >
|
||||
|
||||
let g:ale_completion_symbols = {
|
||||
\ 'text': '',
|
||||
\ 'method': '',
|
||||
\ 'function': '',
|
||||
\ 'constructor': '',
|
||||
\ 'field': '',
|
||||
\ 'variable': '',
|
||||
\ 'class': '',
|
||||
\ 'interface': '',
|
||||
\ 'module': '',
|
||||
\ 'property': '',
|
||||
\ 'unit': 'unit',
|
||||
\ 'value': 'val',
|
||||
\ 'enum': '',
|
||||
\ 'keyword': 'keyword',
|
||||
\ 'snippet': '',
|
||||
\ 'color': 'color',
|
||||
\ 'file': '',
|
||||
\ 'reference': 'ref',
|
||||
\ 'folder': '',
|
||||
\ 'enum member': '',
|
||||
\ 'constant': '',
|
||||
\ 'struct': '',
|
||||
\ 'event': 'event',
|
||||
\ 'operator': '',
|
||||
\ 'type_parameter': 'type param',
|
||||
\ '<default>': 'v'
|
||||
\ }
|
||||
<
|
||||
-------------------------------------------------------------------------------
|
||||
5.2 Go To Definition *ale-go-to-definition*
|
||||
|
||||
ALE supports jumping to the files and locations where symbols are defined
|
||||
through any enabled LSP linters. The locations ALE will jump to depend on the
|
||||
information returned by LSP servers. The following commands are supported:
|
||||
|
||||
|ALEGoToDefinition| - Open the definition of the symbol under the cursor.
|
||||
|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab.
|
||||
|ALEGoToDefinitionInSplit| - The same, but in a new split.
|
||||
|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split.
|
||||
information returned by LSP servers. The |ALEGoToDefinition| command will jump
|
||||
to the definition of symbols under the cursor. See the documentation for the
|
||||
command for configuring how the location will be displayed.
|
||||
|
||||
ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is
|
||||
set to `0`.
|
||||
@@ -453,15 +490,10 @@ set to `0`.
|
||||
|
||||
ALE supports jumping to the files and locations where symbols' types are
|
||||
defined through any enabled LSP linters. The locations ALE will jump to depend
|
||||
on the information returned by LSP servers. The following commands are
|
||||
supported:
|
||||
|
||||
|ALEGoToTypeDefinition| - Open the definition of the symbol's type under
|
||||
the cursor.
|
||||
|ALEGoToTypeDefinitionInTab| - The same, but for opening the file in a new tab.
|
||||
|ALEGoToTypeDefinitionInSplit| - The same, but in a new split.
|
||||
|ALEGoToTypeDefinitionInVSplit| - The same, but in a new vertical split.
|
||||
|
||||
on the information returned by LSP servers. The |ALEGoToTypeDefinition|
|
||||
command will jump to the definition of symbols under the cursor. See the
|
||||
documentation for the command for configuring how the location will be
|
||||
displayed.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
5.4 Find References *ale-find-references*
|
||||
@@ -490,6 +522,9 @@ the mouse over a symbol in a buffer. Diagnostic information will take priority
|
||||
over hover information for balloons. If a line contains a problem, that
|
||||
problem will be displayed in a balloon instead of hover information.
|
||||
|
||||
Hover information can be displayed in the preview window instead by setting
|
||||
|g:ale_hover_to_preview| to `1`.
|
||||
|
||||
For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling
|
||||
|balloonexpr| commands in terminals can cause scrolling issues in terminals,
|
||||
so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to
|
||||
@@ -623,7 +658,7 @@ g:ale_completion_delay *g:ale_completion_delay*
|
||||
|
||||
|
||||
g:ale_completion_enabled *g:ale_completion_enabled*
|
||||
b:ale_completion_enabled *b:ale_completion_enabled*
|
||||
*b:ale_completion_enabled*
|
||||
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
@@ -671,6 +706,47 @@ g:ale_completion_excluded_words *g:ale_completion_excluded_words*
|
||||
let b:ale_completion_excluded_words = ['it', 'describe']
|
||||
<
|
||||
|
||||
g:ale_completion_symbols *g:ale_completion_symbols*
|
||||
|
||||
Type: |Dictionary|
|
||||
|
||||
|
||||
A mapping from completion types to symbols for completions. See
|
||||
|ale-symbols| for more information.
|
||||
|
||||
By default, this mapping only uses built in Vim completion kinds, but it can
|
||||
be updated to use any unicode character for the completion kind. For
|
||||
example: >
|
||||
let g:ale_completion_symbols = {
|
||||
\ 'text': '',
|
||||
\ 'method': '',
|
||||
\ 'function': '',
|
||||
\ 'constructor': '',
|
||||
\ 'field': '',
|
||||
\ 'variable': '',
|
||||
\ 'class': '',
|
||||
\ 'interface': '',
|
||||
\ 'module': '',
|
||||
\ 'property': '',
|
||||
\ 'unit': 'v',
|
||||
\ 'value': 'v',
|
||||
\ 'enum': 't',
|
||||
\ 'keyword': 'v',
|
||||
\ 'snippet': 'v',
|
||||
\ 'color': 'v',
|
||||
\ 'file': 'v',
|
||||
\ 'reference': 'v',
|
||||
\ 'folder': 'v',
|
||||
\ 'enum_member': 'm',
|
||||
\ 'constant': 'm',
|
||||
\ 'struct': 't',
|
||||
\ 'event': 'v',
|
||||
\ 'operator': 'f',
|
||||
\ 'type_parameter': 'p',
|
||||
\ '<default>': 'v'
|
||||
\ })
|
||||
<
|
||||
|
||||
g:ale_completion_max_suggestions *g:ale_completion_max_suggestions*
|
||||
|
||||
Type: |Number|
|
||||
@@ -709,6 +785,16 @@ g:ale_cursor_detail *g:ale_cursor_detail*
|
||||
loaded for messages to be displayed. See |ale-lint-settings-on-startup|.
|
||||
|
||||
|
||||
g:ale_default_navigation *g:ale_default_navigation*
|
||||
*b:ale_default_navigation*
|
||||
|
||||
Type: |String|
|
||||
Default: `'buffer'`
|
||||
|
||||
The default method for navigating away from the current buffer to another
|
||||
buffer, such as for |ALEFindReferences:|, or |ALEGoToDefinition|.
|
||||
|
||||
|
||||
g:ale_disable_lsp *g:ale_disable_lsp*
|
||||
*b:ale_disable_lsp*
|
||||
|
||||
@@ -761,7 +847,7 @@ g:ale_echo_msg_error_str *g:ale_echo_msg_error_str*
|
||||
|
||||
|
||||
g:ale_echo_msg_format *g:ale_echo_msg_format*
|
||||
b:ale_echo_msg_format *b:ale_echo_msg_format*
|
||||
*b:ale_echo_msg_format*
|
||||
|
||||
Type: |String|
|
||||
Default: `'%code: %%s'`
|
||||
@@ -801,6 +887,15 @@ g:ale_echo_msg_info_str *g:ale_echo_msg_info_str*
|
||||
The string used for `%severity%` for info. See |g:ale_echo_msg_format|
|
||||
|
||||
|
||||
g:ale_echo_msg_log_str *g:ale_echo_msg_log_str*
|
||||
|
||||
Type: |String|
|
||||
Default: `'Log'`
|
||||
|
||||
The string used for `%severity%` for log, used only for handling LSP show
|
||||
message requests. See |g:ale_lsp_show_message_format|
|
||||
|
||||
|
||||
g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str*
|
||||
|
||||
Type: |String|
|
||||
@@ -830,6 +925,21 @@ g:ale_enabled *g:ale_enabled*
|
||||
See |g:ale_pattern_options| for more information on that option.
|
||||
|
||||
|
||||
g:ale_exclude_highlights *g:ale_exclude_highlights*
|
||||
*b:ale_exclude_highlights*
|
||||
|
||||
Type: |List|
|
||||
Default: `[]`
|
||||
|
||||
A list of regular expressions for matching against highlight messages to
|
||||
remove. For example: >
|
||||
|
||||
" Do not highlight messages matching strings like these.
|
||||
let b:ale_exclude_highlights = ['line too long', 'foo.*bar']
|
||||
<
|
||||
See also: |g:ale_set_highlights|
|
||||
|
||||
|
||||
g:ale_fixers *g:ale_fixers*
|
||||
*b:ale_fixers*
|
||||
|
||||
@@ -853,7 +963,7 @@ g:ale_fixers *g:ale_fixers*
|
||||
<
|
||||
|
||||
g:ale_fix_on_save *g:ale_fix_on_save*
|
||||
b:ale_fix_on_save *b:ale_fix_on_save*
|
||||
*b:ale_fix_on_save*
|
||||
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
@@ -875,7 +985,7 @@ b:ale_fix_on_save *b:ale_fix_on_save*
|
||||
|
||||
|
||||
g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore*
|
||||
b:ale_fix_on_save_ignore *b:ale_fix_on_save_ignore*
|
||||
*b:ale_fix_on_save_ignore*
|
||||
|
||||
Type: |Dictionary| or |List|
|
||||
Default: `{}`
|
||||
@@ -938,6 +1048,16 @@ g:ale_history_log_output *g:ale_history_log_output*
|
||||
if you want to save on some memory usage.
|
||||
|
||||
|
||||
g:ale_hover_to_preview *g:ale_hover_to_preview*
|
||||
*b:ale_hover_to_preview*
|
||||
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
If set to `1`, hover messages will be displayed in the preview window,
|
||||
instead of in balloons or the message line.
|
||||
|
||||
|
||||
g:ale_keep_list_window_open *g:ale_keep_list_window_open*
|
||||
*b:ale_keep_list_window_open*
|
||||
Type: |Number|
|
||||
@@ -1241,7 +1361,7 @@ g:ale_list_vertical *g:ale_list_vertical*
|
||||
|
||||
|
||||
g:ale_loclist_msg_format *g:ale_loclist_msg_format*
|
||||
b:ale_loclist_msg_format *b:ale_loclist_msg_format*
|
||||
*b:ale_loclist_msg_format*
|
||||
|
||||
Type: |String|
|
||||
Default: `g:ale_echo_msg_format`
|
||||
@@ -1251,8 +1371,49 @@ b:ale_loclist_msg_format *b:ale_loclist_msg_format*
|
||||
|
||||
The strings for configuring `%severity%` are also used for this option.
|
||||
|
||||
|
||||
g:ale_lsp_show_message_format *g:ale_lsp_show_message_format*
|
||||
|
||||
Type: |String|
|
||||
Default: `'%severity%:%linter%: %s'`
|
||||
|
||||
This variable defines the format that messages received from an LSP will
|
||||
have when echoed. The following sequences of characters will be replaced.
|
||||
|
||||
`%s` - replaced with the message text
|
||||
`%linter%` - replaced with the name of the linter
|
||||
`%severity%` - replaced with the severity of the message
|
||||
|
||||
The strings for `%severity%` levels "error", "info" and "warning" are shared
|
||||
with |g:ale_echo_msg_format|. Severity "log" is unique to
|
||||
|g:ale_lsp_show_message_format| and it can be configured via
|
||||
|
||||
|g:ale_echo_msg_log_str| - Defaults to `'Log'`
|
||||
|
||||
Please note that |g:ale_lsp_show_message_format| *can not* be configured
|
||||
separately for each buffer like |g:ale_echo_msg_format| can.
|
||||
|
||||
|
||||
g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity*
|
||||
|
||||
Type: |String|
|
||||
Default: `'error'`
|
||||
|
||||
This variable defines the minimum severity level an LSP message needs to be
|
||||
displayed. Messages below this level are discarded; please note that
|
||||
messages with `Log` severity level are always discarded.
|
||||
|
||||
Possible values follow the LSP spec `MessageType` definition:
|
||||
|
||||
`'error'` - Displays only errors.
|
||||
`'warning'` - Displays errors and warnings.
|
||||
`'information'` - Displays errors, warnings and infos
|
||||
`'log'` - Same as `'information'`
|
||||
`'disabled'` - Doesn't display any information at all.
|
||||
|
||||
|
||||
g:ale_lsp_root *g:ale_lsp_root*
|
||||
b:ale_lsp_root *b:ale_lsp_root*
|
||||
*b:ale_lsp_root*
|
||||
|
||||
Type: |Dictionary| or |String|
|
||||
Default: {}
|
||||
@@ -1465,6 +1626,8 @@ g:ale_set_highlights *g:ale_set_highlights*
|
||||
match highlights, whereas the line highlights when signs are enabled will
|
||||
run to the edge of the screen.
|
||||
|
||||
Highlights can be excluded with the |g:ale_exclude_highlights| option.
|
||||
|
||||
|
||||
g:ale_set_loclist *g:ale_set_loclist*
|
||||
|
||||
@@ -1731,7 +1894,8 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
|
||||
|
||||
|
||||
g:ale_virtualtext_delay *g:ale_virtualtext_delay*
|
||||
b:ale_virtualtext_delay *b:ale_virtualtext_delay*
|
||||
*b:ale_virtualtext_delay*
|
||||
|
||||
Type: |Number|
|
||||
Default: `10`
|
||||
|
||||
@@ -1750,7 +1914,7 @@ g:ale_virtualtext_prefix *g:ale_virtualtext_prefix*
|
||||
Prefix to be used with |g:ale_virtualtext_cursor|.
|
||||
|
||||
g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
|
||||
b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
|
||||
*b:ale_virtualenv_dir_names*
|
||||
|
||||
Type: |List|
|
||||
Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']`
|
||||
@@ -1764,7 +1928,7 @@ b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
|
||||
|
||||
|
||||
g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines*
|
||||
b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines*
|
||||
*b:ale_warn_about_trailing_blank_lines*
|
||||
|
||||
Type: |Number|
|
||||
Default: `1`
|
||||
@@ -1776,7 +1940,7 @@ b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines*
|
||||
|
||||
|
||||
g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace*
|
||||
b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace*
|
||||
*b:ale_warn_about_trailing_whitespace*
|
||||
|
||||
Type: |Number|
|
||||
Default: `1`
|
||||
@@ -2115,6 +2279,8 @@ documented in additional help files.
|
||||
gcc...................................|ale-asm-gcc|
|
||||
awk.....................................|ale-awk-options|
|
||||
gawk..................................|ale-awk-gawk|
|
||||
bats....................................|ale-bats-options|
|
||||
shellcheck............................|ale-bats-shellcheck|
|
||||
bib.....................................|ale-bib-options|
|
||||
bibclean..............................|ale-bib-bibclean|
|
||||
c.......................................|ale-c-options|
|
||||
@@ -2213,6 +2379,7 @@ documented in additional help files.
|
||||
gometalinter..........................|ale-go-gometalinter|
|
||||
gopls.................................|ale-go-gopls|
|
||||
govet.................................|ale-go-govet|
|
||||
revive................................|ale-go-revive|
|
||||
staticcheck...........................|ale-go-staticcheck|
|
||||
graphql.................................|ale-graphql-options|
|
||||
eslint................................|ale-graphql-eslint|
|
||||
@@ -2243,6 +2410,7 @@ documented in additional help files.
|
||||
terraform-fmt.........................|ale-hcl-terraform-fmt|
|
||||
html....................................|ale-html-options|
|
||||
fecs..................................|ale-html-fecs|
|
||||
html-beautify.........................|ale-html-beautify|
|
||||
htmlhint..............................|ale-html-htmlhint|
|
||||
tidy..................................|ale-html-tidy|
|
||||
prettier..............................|ale-html-prettier|
|
||||
@@ -2307,6 +2475,10 @@ documented in additional help files.
|
||||
mmc...................................|ale-mercury-mmc|
|
||||
nasm....................................|ale-nasm-options|
|
||||
nasm..................................|ale-nasm-nasm|
|
||||
nim.....................................|ale-nim-options|
|
||||
nimcheck..............................|ale-nim-nimcheck|
|
||||
nimlsp................................|ale-nim-nimlsp|
|
||||
nimpretty.............................|ale-nim-nimpretty|
|
||||
nix.....................................|ale-nix-options|
|
||||
nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt|
|
||||
nroff...................................|ale-nroff-options|
|
||||
@@ -2364,6 +2536,7 @@ documented in additional help files.
|
||||
puppet-languageserver.................|ale-puppet-languageserver|
|
||||
purescript..............................|ale-purescript-options|
|
||||
purescript-language-server............|ale-purescript-language-server|
|
||||
purty.................................|ale-purescript-purty|
|
||||
pyrex (cython)..........................|ale-pyrex-options|
|
||||
cython................................|ale-pyrex-cython|
|
||||
python..................................|ale-python-options|
|
||||
@@ -2409,6 +2582,7 @@ documented in additional help files.
|
||||
sorbet................................|ale-ruby-sorbet|
|
||||
standardrb............................|ale-ruby-standardrb|
|
||||
rust....................................|ale-rust-options|
|
||||
analyzer..............................|ale-rust-analyzer|
|
||||
cargo.................................|ale-rust-cargo|
|
||||
rls...................................|ale-rust-rls|
|
||||
rustc.................................|ale-rust-rustc|
|
||||
@@ -2453,6 +2627,7 @@ documented in additional help files.
|
||||
terraform...............................|ale-terraform-options|
|
||||
terraform-fmt-fixer...................|ale-terraform-fmt-fixer|
|
||||
terraform.............................|ale-terraform-terraform|
|
||||
terraform-lsp.........................|ale-terraform-terraform-lsp|
|
||||
tflint................................|ale-terraform-tflint|
|
||||
tex.....................................|ale-tex-options|
|
||||
chktex................................|ale-tex-chktex|
|
||||
@@ -2469,6 +2644,7 @@ documented in additional help files.
|
||||
typescript..............................|ale-typescript-options|
|
||||
eslint................................|ale-typescript-eslint|
|
||||
prettier..............................|ale-typescript-prettier|
|
||||
standard..............................|ale-typescript-standard|
|
||||
tslint................................|ale-typescript-tslint|
|
||||
tsserver..............................|ale-typescript-tsserver|
|
||||
vala....................................|ale-vala-options|
|
||||
@@ -2483,6 +2659,7 @@ documented in additional help files.
|
||||
vcom..................................|ale-vhdl-vcom|
|
||||
xvhdl.................................|ale-vhdl-xvhdl|
|
||||
vim.....................................|ale-vim-options|
|
||||
vimls.................................|ale-vim-vimls|
|
||||
vint..................................|ale-vim-vint|
|
||||
vim help................................|ale-vim-help-options|
|
||||
write-good............................|ale-vim-help-write-good|
|
||||
@@ -2536,11 +2713,23 @@ ALEFindReferences *ALEFindReferences*
|
||||
Enter key (`<CR>`) can be used to jump to a referencing location, or the `t`
|
||||
key can be used to jump to the location in a new tab.
|
||||
|
||||
The locations opened in different ways using the following variations.
|
||||
|
||||
`:ALEFindReferences -tab` - Open the location in a new tab.
|
||||
`:ALEFindReferences -split` - Open the location in a horizontal split.
|
||||
`:ALEFindReferences -vsplit` - Open the location in a vertical split.
|
||||
|
||||
The default method used for navigating to a new location can be changed
|
||||
by modifying |g:ale_default_navigation|.
|
||||
|
||||
The selection can be opened again with the |ALERepeatSelection| command.
|
||||
|
||||
You can jump back to the position you were at before going to a reference of
|
||||
something with jump motions like CTRL-O. See |jump-motions|.
|
||||
|
||||
A plug mapping `<Plug>(ale_find_references)` is defined for this command.
|
||||
|
||||
|
||||
ALEFix *ALEFix*
|
||||
|
||||
Fix problems with the current buffer. See |ale-fix| for more information.
|
||||
@@ -2555,42 +2744,31 @@ ALEFixSuggest *ALEFixSuggest*
|
||||
See |ale-fix| for more information.
|
||||
|
||||
|
||||
ALEGoToDefinition *ALEGoToDefinition*
|
||||
ALEGoToDefinition `<options>` *ALEGoToDefinition*
|
||||
|
||||
Jump to the definition of a symbol under the cursor using the enabled LSP
|
||||
linters for the buffer. ALE will jump to a definition if an LSP server
|
||||
provides a location to jump to. Otherwise, ALE will do nothing.
|
||||
|
||||
The locations opened in different ways using the following variations.
|
||||
|
||||
`:ALEGoToDefinition -tab` - Open the location in a new tab.
|
||||
`:ALEGoToDefinition -split` - Open the location in a horizontal split.
|
||||
`:ALEGoToDefinition -vsplit` - Open the location in a vertical split.
|
||||
|
||||
The default method used for navigating to a new location can be changed
|
||||
by modifying |g:ale_default_navigation|.
|
||||
|
||||
You can jump back to the position you were at before going to the definition
|
||||
of something with jump motions like CTRL-O. See |jump-motions|.
|
||||
|
||||
You should consider using the 'hidden' option in combination with this
|
||||
command. Otherwise, Vim will refuse to leave the buffer you're jumping from
|
||||
unless you have saved your edits.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition)` is defined for this command.
|
||||
|
||||
|
||||
ALEGoToDefinitionInTab *ALEGoToDefinitionInTab*
|
||||
|
||||
The same as |ALEGoToDefinition|, but opens results in a new tab.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition_in_tab)` is defined for this
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit*
|
||||
|
||||
The same as |ALEGoToDefinition|, but opens results in a new split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition_in_split)` is defined for this
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit*
|
||||
|
||||
The same as |ALEGoToDefinition|, but opens results in a new vertical split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_definition_in_vsplit)` is defined for this
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToTypeDefinition *ALEGoToTypeDefinition*
|
||||
|
||||
This works similar to |ALEGoToDefinition| but instead jumps to the
|
||||
@@ -2598,6 +2776,15 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition*
|
||||
definition if an LSP server provides a location to jump to. Otherwise, ALE
|
||||
will do nothing.
|
||||
|
||||
The locations opened in different ways using the following variations.
|
||||
|
||||
`:ALEGoToTypeDefinition -tab` - Open the location in a new tab.
|
||||
`:ALEGoToTypeDefinition -split` - Open the location in a horizontal split.
|
||||
`:ALEGoToTypeDefinition -vsplit` - Open the location in a vertical split.
|
||||
|
||||
The default method used for navigating to a new location can be changed
|
||||
by modifying |g:ale_default_navigation|.
|
||||
|
||||
You can jump back to the position you were at before going to the definition
|
||||
of something with jump motions like CTRL-O. See |jump-motions|.
|
||||
|
||||
@@ -2605,31 +2792,6 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition*
|
||||
command.
|
||||
|
||||
|
||||
ALEGoToTypeDefinitionInTab *ALEGoToTypeDefinitionInTab*
|
||||
|
||||
The same as |ALEGoToTypeDefinition|, but opens results in a new tab.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_type_definition_in_tab)` is defined for
|
||||
this command.
|
||||
|
||||
|
||||
ALEGoToTypeDefinitionInSplit *ALEGoToTypeDefinitionInSplit*
|
||||
|
||||
The same as |ALEGoToTypeDefinition|, but opens results in a new split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_type_definition_in_split)` is defined for
|
||||
this command.
|
||||
|
||||
|
||||
ALEGoToTypeDefinitionInVSplit *ALEGoToTypeDefinitionInVSplit*
|
||||
|
||||
The same as |ALEGoToTypeDefinition|, but opens results in a new vertical
|
||||
split.
|
||||
|
||||
A plug mapping `<Plug>(ale_go_to_type_definition_in_vsplit)` is defined for
|
||||
this command.
|
||||
|
||||
|
||||
ALEHover *ALEHover*
|
||||
|
||||
Print brief information about the symbol under the cursor, taken from any
|
||||
@@ -2655,6 +2817,11 @@ ALERename *ALERename*
|
||||
The user will be prompted for a new name.
|
||||
|
||||
|
||||
ALERepeatSelection *ALERepeatSelection*
|
||||
|
||||
Repeat the last selection displayed in the preview window.
|
||||
|
||||
|
||||
ALESymbolSearch `<query>` *ALESymbolSearch*
|
||||
|
||||
Search for symbols in the workspace, taken from any available LSP linters.
|
||||
@@ -2963,7 +3130,6 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()*
|
||||
|
||||
'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))}
|
||||
<
|
||||
|
||||
The following `options` can be provided.
|
||||
|
||||
`output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for
|
||||
|
||||
@@ -12,5 +12,5 @@ noremap <buffer> A <NOP>
|
||||
noremap <buffer> o <NOP>
|
||||
noremap <buffer> O <NOP>
|
||||
" Keybinds for opening selection items.
|
||||
noremap <buffer> <CR> :call ale#preview#OpenSelectionInBuffer()<CR>
|
||||
noremap <buffer> <CR> :call ale#preview#OpenSelection()<CR>
|
||||
noremap <buffer> t :call ale#preview#OpenSelectionInTab()<CR>
|
||||
|
||||
@@ -109,6 +109,9 @@ let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs'))
|
||||
" This flag can be set to 0 to disable setting error highlights.
|
||||
let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax'))
|
||||
|
||||
" This List can be configured to exclude particular highlights.
|
||||
let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', [])
|
||||
|
||||
" This flag can be set to 0 to disable echoing when the cursor moves.
|
||||
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
|
||||
|
||||
@@ -125,6 +128,9 @@ let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0)
|
||||
" This flag can be set to 0 to disable balloon support.
|
||||
let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running'))
|
||||
|
||||
" Use preview window for hover messages.
|
||||
let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0)
|
||||
|
||||
" This flag can be set to 0 to disable warnings for trailing whitespace
|
||||
let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1)
|
||||
" This flag can be set to 0 to disable warnings for trailing blank lines
|
||||
@@ -196,16 +202,23 @@ command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEF
|
||||
command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
|
||||
|
||||
" Go to definition for tsserver and LSP
|
||||
command! -bar ALEGoToDefinition :call ale#definition#GoTo({})
|
||||
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'})
|
||||
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'})
|
||||
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'})
|
||||
command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', <f-args>)
|
||||
|
||||
" Deprecated commands we have to keep for now.
|
||||
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab', 'deprecated_command': 'ALEGoToDefinitionInTab'})
|
||||
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'split', 'deprecated_command': 'ALEGoToDefinitionInSplit'})
|
||||
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToDefinitionInVSplit'})
|
||||
|
||||
" Go to type definition for tsserver and LSP
|
||||
command! -bar ALEGoToTypeDefinition :call ale#definition#GoToType({})
|
||||
command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab'})
|
||||
command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'horizontal-split'})
|
||||
command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vertical-split'})
|
||||
command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', <f-args>)
|
||||
|
||||
" Deprecated commands we have to keep for now.
|
||||
command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab', 'deprecated_command': 'ALEGoToTypeDefinitionInTab'})
|
||||
command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'split', 'deprecated_command': 'ALEGoToTypeDefinitionInSplit'})
|
||||
command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToTypeDefinitionInVSplit'})
|
||||
|
||||
" Repeat a previous selection in the preview window
|
||||
command! -bar ALERepeatSelection :call ale#preview#RepeatSelection()
|
||||
|
||||
" Find references for tsserver and LSP
|
||||
command! -bar -nargs=* ALEFindReferences :call ale#references#Find(<f-args>)
|
||||
@@ -254,18 +267,21 @@ nnoremap <silent> <Plug>(ale_lint) :ALELint<Return>
|
||||
nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
|
||||
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition) :ALEGoToTypeDefinition<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
|
||||
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
|
||||
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>
|
||||
inoremap <silent> <Plug>(ale_complete) <C-\><C-O>:ALEComplete<Return>
|
||||
nnoremap <silent> <Plug>(ale_rename) :ALERename<Return>
|
||||
nnoremap <silent> <Plug>(ale_repeat_selection) :ALERepeatSelection<Return>
|
||||
|
||||
" Deprecated <Plug> mappings
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit<Return>
|
||||
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit<Return>
|
||||
|
||||
" Set up autocmd groups now.
|
||||
call ale#events#Init()
|
||||
|
||||
@@ -24,6 +24,7 @@ class Source(Base):
|
||||
self.rank = 1000
|
||||
self.is_bytepos = True
|
||||
self.min_pattern_length = 1
|
||||
self.is_volatile = True
|
||||
# Do not forget to update s:trigger_character_map in completion.vim in
|
||||
# updating entries in this map.
|
||||
self.input_patterns = {
|
||||
@@ -44,21 +45,16 @@ class Source(Base):
|
||||
if not self.vim.call('ale#completion#CanProvideCompletions'):
|
||||
return None
|
||||
|
||||
if context.get('is_refresh'):
|
||||
context['is_async'] = False
|
||||
event = context.get('event')
|
||||
|
||||
if context['is_async']:
|
||||
# Result is the same as for omnifunc, or None.
|
||||
if event == 'Async':
|
||||
result = self.vim.call('ale#completion#GetCompletionResult')
|
||||
return result or []
|
||||
|
||||
if result is not None:
|
||||
context['is_async'] = False
|
||||
|
||||
return result
|
||||
else:
|
||||
context['is_async'] = True
|
||||
|
||||
# Request some completion results.
|
||||
self.vim.call('ale#completion#GetCompletions', 'deoplete')
|
||||
if context.get('is_refresh'):
|
||||
self.vim.command(
|
||||
"call ale#completion#GetCompletions('ale-callback', " + \
|
||||
"{'callback': {completions -> deoplete#auto_complete() }})"
|
||||
)
|
||||
|
||||
return []
|
||||
|
||||
@@ -44,6 +44,8 @@ formatting.
|
||||
* shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set)
|
||||
* [shellcheck](https://www.shellcheck.net/)
|
||||
* [shfmt](https://github.com/mvdan/sh)
|
||||
* Bats
|
||||
* [shellcheck](https://www.shellcheck.net/)
|
||||
* BibTeX
|
||||
* [bibclean](http://ftp.math.utah.edu/pub/bibclean/)
|
||||
* Bourne Shell
|
||||
@@ -171,6 +173,7 @@ formatting.
|
||||
* [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk:
|
||||
* [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk:
|
||||
* [go vet](https://golang.org/cmd/vet/) :floppy_disk:
|
||||
* [revive](https://github.com/mgechev/revive) :warning: :floppy_disk:
|
||||
* [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) :warning: :floppy_disk:
|
||||
* GraphQL
|
||||
* [eslint](http://eslint.org/)
|
||||
@@ -203,6 +206,7 @@ formatting.
|
||||
* HTML
|
||||
* [alex](https://github.com/wooorm/alex) :floppy_disk:
|
||||
* [fecs](http://fecs.baidu.com/)
|
||||
* [html-beautify](https://beautifier.io/)
|
||||
* [HTMLHint](http://htmlhint.com/)
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
* [proselint](http://proselint.com/)
|
||||
@@ -291,6 +295,8 @@ formatting.
|
||||
* [nasm](https://www.nasm.us/) :floppy_disk:
|
||||
* Nim
|
||||
* [nim check](https://nim-lang.org/docs/nimc.html) :floppy_disk:
|
||||
* [nimlsp](https://github.com/PMunch/nimlsp)
|
||||
* nimpretty
|
||||
* nix
|
||||
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
|
||||
* [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
|
||||
@@ -356,6 +362,7 @@ formatting.
|
||||
* [puppet-lint](https://puppet-lint.com)
|
||||
* PureScript
|
||||
* [purescript-language-server](https://github.com/nwolverson/purescript-language-server)
|
||||
* [purty](https://gitlab.com/joneshf/purty)
|
||||
* Python
|
||||
* [autopep8](https://github.com/hhatto/autopep8)
|
||||
* [bandit](https://github.com/PyCQA/bandit) :warning:
|
||||
@@ -413,6 +420,7 @@ formatting.
|
||||
* Rust
|
||||
* [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions)
|
||||
* [rls](https://github.com/rust-lang-nursery/rls) :warning:
|
||||
* [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning:
|
||||
* [rustc](https://www.rust-lang.org/) :warning:
|
||||
* [rustfmt](https://github.com/rust-lang-nursery/rustfmt)
|
||||
* Sass
|
||||
@@ -474,6 +482,7 @@ formatting.
|
||||
* [eslint](http://eslint.org/)
|
||||
* [fecs](http://fecs.baidu.com/)
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
* [standard](http://standardjs.com/)
|
||||
* [tslint](https://github.com/palantir/tslint)
|
||||
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
|
||||
* typecheck
|
||||
@@ -489,6 +498,7 @@ formatting.
|
||||
* [vcom](https://www.mentor.com/products/fv/questa/)
|
||||
* [xvhdl](https://www.xilinx.com/products/design-tools/vivado.html)
|
||||
* Vim
|
||||
* [vimls](https://github.com/iamcco/vim-language-server)
|
||||
* [vint](https://github.com/Kuniwak/vint)
|
||||
* Vim help
|
||||
* [alex](https://github.com/wooorm/alex) :warning: :floppy_disk:
|
||||
|
||||
0
test/command_callback/html_beautify_paths/html-beautify
Executable file
0
test/command_callback/html_beautify_paths/html-beautify
Executable file
0
test/command_callback/html_beautify_paths/test.html
Normal file
0
test/command_callback/html_beautify_paths/test.html
Normal file
@@ -4,6 +4,11 @@ Before:
|
||||
Save &filetype
|
||||
let &filetype = 'c'
|
||||
|
||||
Save b:ale_c_clangd_options
|
||||
Save b:ale_c_build_dir
|
||||
Save b:ale_c_build_dir_names
|
||||
Save b:ale_c_parse_compile_commands
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
@@ -18,9 +23,9 @@ Execute(The project root should be detected correctly):
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('clangd_paths/dummy.c')
|
||||
call ale#test#SetFilename('clangd_paths/with_compile_commands/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/clangd_paths')
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/clangd_paths/with_compile_commands')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_c_clangd_executable = 'foobar'
|
||||
@@ -32,3 +37,15 @@ Execute(The options should be configurable):
|
||||
|
||||
AssertLinter 'clangd', ale#Escape('clangd') . ' ' . b:ale_c_clangd_options
|
||||
|
||||
Execute(The compile command database should be detected correctly):
|
||||
call ale#test#SetFilename('clangd_paths/with_build_dir/dummy_src/dummy.c')
|
||||
|
||||
let b:ale_c_clangd_options = ''
|
||||
let b:ale_c_build_dir = ''
|
||||
let b:ale_c_build_dir_names = ['unusual_build_dir_name']
|
||||
let b:ale_c_parse_compile_commands = 1
|
||||
|
||||
AssertLinter 'clangd', ale#Escape('clangd')
|
||||
\ . ' -compile-commands-dir='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/clangd_paths/with_build_dir/unusual_build_dir_name'))
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ After:
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
\ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
|
||||
let b:ale_cpp_clangcheck_executable = 'foobar'
|
||||
|
||||
@@ -15,7 +15,7 @@ Execute(The executable should be configurable):
|
||||
" being generated.
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
\ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_clangcheck_options = '--something'
|
||||
@@ -23,7 +23,7 @@ Execute(The options should be configurable):
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s'
|
||||
\ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
\ . ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
\ . ' --something'
|
||||
|
||||
Execute(The build directory should be used when set):
|
||||
|
||||
@@ -54,6 +54,7 @@ Execute(VersionCheck should return correct version):
|
||||
|
||||
Execute(The eclipselsp callback should return the correct default value):
|
||||
let cmd = [ ale#Escape('java'),
|
||||
\ '',
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
@@ -72,6 +73,7 @@ Execute(The eclipselsp callback should return the correct default value):
|
||||
Execute(The eclipselsp callback should allow custom executable):
|
||||
let b:ale_java_eclipselsp_executable='/bin/foobar'
|
||||
let cmd = [ ale#Escape('/bin/foobar'),
|
||||
\ '',
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
@@ -87,9 +89,12 @@ Execute(The eclipselsp callback should allow custom executable):
|
||||
\]
|
||||
AssertLinter '/bin/foobar', join(cmd, ' ')
|
||||
|
||||
Execute(The eclipselsp callback should allow custom configuration path):
|
||||
Execute(The eclipselsp callback should allow custom configuration path and javaagent):
|
||||
let b:ale_java_eclipselsp_config_path = '/home/config'
|
||||
let b:ale_java_eclipselsp_javaagent = '/home/lombok.jar /home/lombok2.jar'
|
||||
let cmd = [ ale#Escape('java'),
|
||||
\ ale#Escape('-javaagent:/home/lombok.jar'),
|
||||
\ ale#Escape('-javaagent:/home/lombok2.jar'),
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
|
||||
@@ -31,7 +31,7 @@ After:
|
||||
Execute(The javac callback should return the correct default value):
|
||||
AssertLinter 'javac', g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should use g:ale_java_javac_classpath correctly):
|
||||
Execute(The javac callback should use string type g:ale_java_javac_classpath correctly):
|
||||
let g:ale_java_javac_classpath = 'foo.jar'
|
||||
|
||||
AssertLinter 'javac',
|
||||
@@ -39,6 +39,14 @@ Execute(The javac callback should use g:ale_java_javac_classpath correctly):
|
||||
\ . ' -cp ' . ale#Escape('foo.jar')
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should use list type g:ale_java_javac_classpath correctly):
|
||||
let g:ale_java_javac_classpath = ['foo.jar']
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -cp ' . ale#Escape('foo.jar')
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_java_javac_executable = 'foobar'
|
||||
|
||||
@@ -108,6 +116,137 @@ Execute(The javac callback should combine discovered classpaths and manual ones)
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
let g:ale_java_javac_classpath = ['configured.jar']
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\], {})
|
||||
|
||||
AssertEqual
|
||||
\ g:prefix
|
||||
\ . ' -cp '
|
||||
\ . ale#Escape(join(
|
||||
\ [
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ 'configured.jar',
|
||||
\ ],
|
||||
\ g:cp_sep
|
||||
\ ))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
let g:ale_java_javac_classpath = ['configured.jar', 'configured2.jar']
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\], {})
|
||||
|
||||
AssertEqual
|
||||
\ g:prefix
|
||||
\ . ' -cp '
|
||||
\ . ale#Escape(join(
|
||||
\ [
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ 'configured.jar',
|
||||
\ 'configured2.jar',
|
||||
\ ],
|
||||
\ g:cp_sep
|
||||
\ ))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
Execute(The javac callback should use string type g:ale_java_javac_sourcepath correctly):
|
||||
let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should use list type g:ale_java_javac_sourcepath correctly):
|
||||
let g:ale_java_javac_sourcepath = ['java_paths/build/gen/main']
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
|
||||
\ )
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback shouldn't add -sourcepath when g:ale_java_javac_sourcepath variable path doesn't exist):
|
||||
let g:ale_java_javac_sourcepath = 'java_paths/build/gen3/main'
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should combine discovered sourcepath and manual ones):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
call ale#test#SetFilename('java_paths/src/main/java/com/something/dummy.java')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
|
||||
\ . g:cp_sep . 'java_paths/build/gen2/main'
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen2/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
let g:ale_java_javac_sourcepath = ['java_paths/build/gen/main']
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
let g:ale_java_javac_sourcepath = [
|
||||
\ 'java_paths/build/gen/main',
|
||||
\ 'java_paths/build/gen2/main'
|
||||
\ ]
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen2/main/')
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
|
||||
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
|
||||
|
||||
Execute(The javac callback should detect source directories):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
noautocmd e! java_paths/src/main/java/com/something/dummy
|
||||
|
||||
@@ -52,6 +52,15 @@ Execute(The mypy callbacks should detect virtualenv directories and switch to th
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(The mypy callbacks should cd to directory containing mypy.ini if found):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py')
|
||||
|
||||
AssertLinter 'mypy',
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_mypy_ini_and_pytest_ini'))
|
||||
\ . ale#Escape('mypy')
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(You should able able to use the global mypy instead):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
let g:ale_python_mypy_use_global = 1
|
||||
|
||||
12
test/command_callback/test_nimlsp_command_callback.vader
Normal file
12
test/command_callback/test_nimlsp_command_callback.vader
Normal file
@@ -0,0 +1,12 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('nim', 'nimlsp')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(It does not set nim sources by default):
|
||||
AssertLinter 'nimlsp', ale#Escape('nimlsp')
|
||||
|
||||
Execute(Sets nimlsp and escapes sources from g:ale_nim_nimlsp_nim_sources):
|
||||
let g:ale_nim_nimlsp_nim_sources = '/path/to /Nim'
|
||||
AssertLinter 'nimlsp', ale#Escape('nimlsp') . ' ' . ale#Escape('/path/to /Nim')
|
||||
@@ -22,6 +22,14 @@ Execute(Vendor executables should be detected):
|
||||
\ . '/psalm-project/vendor/bin/psalm'
|
||||
\ )) . ' --language-server'
|
||||
|
||||
Execute(User provided options should be used):
|
||||
let g:ale_psalm_langserver_options = '--my-user-provided-option my-value'
|
||||
|
||||
AssertLinter 'psalm',
|
||||
\ ale#Escape('psalm')
|
||||
\ . ' --language-server --my-user-provided-option my-value'
|
||||
|
||||
|
||||
Execute(The project path should be correct for .git directories):
|
||||
call ale#test#SetFilename('psalm-project/test.php')
|
||||
|
||||
|
||||
30
test/command_callback/test_revive_command_callbacks.vader
Normal file
30
test/command_callback/test_revive_command_callbacks.vader
Normal file
@@ -0,0 +1,30 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'revive')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default revive command should be correct):
|
||||
AssertLinter 'revive', ale#Escape('revive') . ' %t'
|
||||
|
||||
Execute(The revive executable should be configurable):
|
||||
let b:ale_go_revive_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %t'
|
||||
|
||||
Execute(The revive options should be configurable):
|
||||
let b:ale_go_revive_options = '--foo'
|
||||
|
||||
AssertLinter 'revive', ale#Escape('revive') . ' --foo %t'
|
||||
|
||||
Execute(The revive command should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'revive',
|
||||
\ ale#Env('GO111MODULE', 'on') . ale#Escape('revive') . ' %t'
|
||||
20
test/command_callback/test_rust_analyzer_callbacks.vader
Normal file
20
test/command_callback/test_rust_analyzer_callbacks.vader
Normal file
@@ -0,0 +1,20 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('rust', 'analyzer')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'rust-analyzer', ale#Escape('rust-analyzer')
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('rust-rls-project/test.rs')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/rust-rls-project')
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_rust_analyzer_config = {'rust': {'clippy_preference': 'on'}}
|
||||
AssertLSPConfig {'rust': {'clippy_preference': 'on'}}
|
||||
43
test/command_callback/test_standardts_command_callback.vader
Normal file
43
test/command_callback/test_standardts_command_callback.vader
Normal file
@@ -0,0 +1,43 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('typescript', 'standard')
|
||||
call ale#test#SetFilename('testfile.js')
|
||||
unlet! b:executable
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(bin/cmd.js paths should be preferred):
|
||||
call ale#test#SetFilename('standard-test-files/with-cmd/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable,
|
||||
\ (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(b:executable)
|
||||
\ . ' --stdin %s'
|
||||
|
||||
Execute(.bin directories should be used too):
|
||||
call ale#test#SetFilename('standard-test-files/with-bin/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/standard-test-files/with-bin/node_modules/.bin/standard'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin %s'
|
||||
|
||||
Execute(The global executable should be used otherwise):
|
||||
AssertLinter 'standard', ale#Escape('standard') . ' --stdin %s'
|
||||
|
||||
Execute(The global executable should be configurable):
|
||||
let b:ale_typescript_standard_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_typescript_standard_options = '--wat'
|
||||
|
||||
AssertLinter 'standard', ale#Escape('standard') . ' --wat --stdin %s'
|
||||
@@ -0,0 +1,48 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('terraform', 'terraform_lsp')
|
||||
|
||||
After:
|
||||
if isdirectory(g:dir . '/.terraform')
|
||||
call delete(g:dir . '/.terraform', 'd')
|
||||
endif
|
||||
|
||||
unlet! b:ale_terraform_langserver_executable
|
||||
unlet! b:ale_terraform_langserver_options
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Should send correct LSP language):
|
||||
AssertLSPLanguage 'terraform'
|
||||
|
||||
Execute(Should load default executable):
|
||||
AssertLinter 'terraform-lsp', ale#Escape('terraform-lsp')
|
||||
|
||||
Execute(Should configure custom executable):
|
||||
let b:ale_terraform_langserver_executable = 'foo'
|
||||
AssertLinter 'foo', ale#Escape('foo')
|
||||
|
||||
Execute(Should set custom options):
|
||||
let b:ale_terraform_langserver_options = '--bar'
|
||||
|
||||
AssertLinter 'terraform-lsp',
|
||||
\ ale#Escape('terraform-lsp') . ' --bar'
|
||||
|
||||
Execute(Should return current directory if it contains .terraform directory):
|
||||
call mkdir(g:dir . '/.terraform')
|
||||
AssertLSPProject g:dir
|
||||
|
||||
Execute(Should return nearest directory with .terraform if found in parent directory):
|
||||
call ale#test#SetFilename('../terraform_files/main.tf')
|
||||
|
||||
let b:parent_dir = ale#path#Simplify(g:dir . '/..')
|
||||
let b:tf_dir = b:parent_dir . '/.terraform'
|
||||
|
||||
if !isdirectory(b:tf_dir)
|
||||
call mkdir(b:tf_dir)
|
||||
endif
|
||||
|
||||
AssertLSPProject b:parent_dir
|
||||
|
||||
call delete(b:tf_dir, 'd')
|
||||
unlet!b:parent_dir
|
||||
unlet!b:tf_dir
|
||||
76
test/command_callback/test_vim_vimls.vader
Normal file
76
test/command_callback/test_vim_vimls.vader
Normal file
@@ -0,0 +1,76 @@
|
||||
" Author: Jeffrey Lau https://github.com/zoonfafer
|
||||
" Description: Tests for the Vim vimls linter
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('vim', 'vimls')
|
||||
|
||||
After:
|
||||
if isdirectory(g:dir . '/.git')
|
||||
call delete(g:dir . '/.git', 'd')
|
||||
endif
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should set correct defaults):
|
||||
AssertLinter 'vim-language-server', ale#Escape('vim-language-server') . ' --stdio'
|
||||
|
||||
Execute(should set correct LSP values):
|
||||
call ale#test#SetFilename('vim_fixtures/path_with_autoload/test.vim')
|
||||
AssertLSPLanguage 'vim'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_autoload')
|
||||
|
||||
Execute(should set correct project for .git/):
|
||||
let b:parent_dir = ale#path#Simplify(g:dir . '/..')
|
||||
let b:git_dir = b:parent_dir . '/.git'
|
||||
|
||||
call ale#test#SetFilename('vim_fixtures/test.vim')
|
||||
|
||||
if !isdirectory(b:git_dir)
|
||||
call mkdir(b:git_dir)
|
||||
endif
|
||||
|
||||
AssertLSPProject ale#path#Simplify(b:parent_dir)
|
||||
|
||||
call delete(b:git_dir, 'd')
|
||||
unlet! b:git_dir
|
||||
|
||||
Execute(should set correct project for plugin/):
|
||||
call ale#test#SetFilename('vim_fixtures/path_with_plugin/test.vim')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_plugin')
|
||||
|
||||
Execute(should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
|
||||
let b:ale_vim_vimls_config = {'vim': {'foobar': v:true}}
|
||||
AssertLSPConfig {'vim': {'foobar': v:true}}
|
||||
|
||||
Execute(should set correct project for .vimrc):
|
||||
call ale#test#SetFilename('vim_fixtures/path_with_vimrc/.vimrc')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_vimrc')
|
||||
|
||||
Execute(should set correct project for init.vim):
|
||||
call ale#test#SetFilename('vim_fixtures/path_with_initvim/init.vim')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_initvim')
|
||||
|
||||
Execute(should use the local executable when available):
|
||||
call ale#test#SetFilename('vim_fixtures/file.vim')
|
||||
|
||||
AssertLinter ale#path#Simplify(g:dir . '/vim_fixtures/node_modules/.bin/vim-language-server'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/vim_fixtures/node_modules/.bin/vim-language-server')) . ' --stdio'
|
||||
|
||||
Execute(should let the global executable to be used):
|
||||
let g:ale_vim_vimls_use_global = 1
|
||||
call ale#test#SetFilename('vim_fixtures/file.vim')
|
||||
|
||||
AssertLinter 'vim-language-server',
|
||||
\ ale#Escape('vim-language-server') . ' --stdio'
|
||||
|
||||
Execute(should let the executable to be configured):
|
||||
let g:ale_vim_vimls_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio'
|
||||
0
test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server
generated
vendored
Normal file
0
test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server
generated
vendored
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user