Skip to content

Commit d895af5

Browse files
committed
Updated plugins
1 parent 8c90331 commit d895af5

38 files changed

+715
-298
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
" Author: Ian2020 <https://github.com/Ian2020>
2+
" Description: shellcheck linter for bats scripts.
3+
4+
call ale#handlers#shellcheck#DefineLinter('bats')
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
" Author: Jon Gjengset <jon@thesquareplanet.com>
2+
" Description: The next generation language server for Rust
3+
4+
call ale#Set('rust_analyzer_executable', 'rust-analyzer')
5+
call ale#Set('rust_analyzer_config', {})
6+
7+
function! ale_linters#rust#analyzer#GetCommand(buffer) abort
8+
return '%e'
9+
endfunction
10+
11+
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
12+
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
13+
14+
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
15+
endfunction
16+
17+
call ale#linter#Define('rust', {
18+
\ 'name': 'analyzer',
19+
\ 'lsp': 'stdio',
20+
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
21+
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
22+
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
23+
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
24+
\})
Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,4 @@
11
" Author: w0rp <devw0rp@gmail.com>
2-
" Description: This file adds support for using the shellcheck linter with
3-
" shell scripts.
2+
" Description: shellcheck linter for shell scripts.
43

5-
" This global variable can be set with a string of comma-separated error
6-
" codes to exclude from shellcheck. For example:
7-
"
8-
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
9-
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
10-
call ale#Set('sh_shellcheck_executable', 'shellcheck')
11-
call ale#Set('sh_shellcheck_dialect', 'auto')
12-
call ale#Set('sh_shellcheck_options', '')
13-
call ale#Set('sh_shellcheck_change_directory', 1)
14-
15-
function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
16-
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
17-
18-
if !empty(l:shell_type)
19-
" Use the dash dialect for /bin/ash, etc.
20-
if l:shell_type is# 'ash'
21-
return 'dash'
22-
endif
23-
24-
return l:shell_type
25-
endif
26-
27-
" If there's no hashbang, try using Vim's buffer variables.
28-
if getbufvar(a:buffer, 'is_bash', 0)
29-
return 'bash'
30-
elseif getbufvar(a:buffer, 'is_sh', 0)
31-
return 'sh'
32-
elseif getbufvar(a:buffer, 'is_kornshell', 0)
33-
return 'ksh'
34-
endif
35-
36-
return ''
37-
endfunction
38-
39-
function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort
40-
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
41-
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
42-
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
43-
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
44-
let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
45-
\ ? ale#path#BufferCdString(a:buffer)
46-
\ : ''
47-
48-
if l:dialect is# 'auto'
49-
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
50-
endif
51-
52-
return l:cd_string
53-
\ . '%e'
54-
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
55-
\ . (!empty(l:options) ? ' ' . l:options : '')
56-
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
57-
\ . l:external_option
58-
\ . ' -f gcc -'
59-
endfunction
60-
61-
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
62-
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
63-
let l:output = []
64-
65-
for l:match in ale#util#GetMatches(a:lines, l:pattern)
66-
if l:match[4] is# 'error'
67-
let l:type = 'E'
68-
elseif l:match[4] is# 'note'
69-
let l:type = 'I'
70-
else
71-
let l:type = 'W'
72-
endif
73-
74-
let l:item = {
75-
\ 'lnum': str2nr(l:match[2]),
76-
\ 'type': l:type,
77-
\ 'text': l:match[5],
78-
\ 'code': l:match[6],
79-
\}
80-
81-
if !empty(l:match[3])
82-
let l:item.col = str2nr(l:match[3])
83-
endif
84-
85-
" If the filename is something like <stdin>, <nofile> or -, then
86-
" this is an error for the file we checked.
87-
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
88-
let l:item['filename'] = l:match[1]
89-
endif
90-
91-
call add(l:output, l:item)
92-
endfor
93-
94-
return l:output
95-
endfunction
96-
97-
call ale#linter#Define('sh', {
98-
\ 'name': 'shellcheck',
99-
\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
100-
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
101-
\ buffer,
102-
\ ale#Var(buffer, 'sh_shellcheck_executable'),
103-
\ '%e --version',
104-
\ function('ale_linters#sh#shellcheck#GetCommand'),
105-
\ )},
106-
\ 'callback': 'ale_linters#sh#shellcheck#Handle',
107-
\})
4+
call ale#handlers#shellcheck#DefineLinter('sh')
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
" Author: w0rp <devw0rp@gmail.com>
2+
" Description: This file adds support for using the shellcheck linter
3+
4+
function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort
5+
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
6+
7+
if !empty(l:shell_type)
8+
" Use the dash dialect for /bin/ash, etc.
9+
if l:shell_type is# 'ash'
10+
return 'dash'
11+
endif
12+
13+
return l:shell_type
14+
endif
15+
16+
" If there's no hashbang, try using Vim's buffer variables.
17+
if getbufvar(a:buffer, 'is_bash', 0)
18+
return 'bash'
19+
elseif getbufvar(a:buffer, 'is_sh', 0)
20+
return 'sh'
21+
elseif getbufvar(a:buffer, 'is_kornshell', 0)
22+
return 'ksh'
23+
endif
24+
25+
return ''
26+
endfunction
27+
28+
function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
29+
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
30+
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
31+
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
32+
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
33+
let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
34+
\ ? ale#path#BufferCdString(a:buffer)
35+
\ : ''
36+
37+
if l:dialect is# 'auto'
38+
let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer)
39+
endif
40+
41+
return l:cd_string
42+
\ . '%e'
43+
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
44+
\ . (!empty(l:options) ? ' ' . l:options : '')
45+
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
46+
\ . l:external_option
47+
\ . ' -f gcc -'
48+
endfunction
49+
50+
function! ale#handlers#shellcheck#Handle(buffer, lines) abort
51+
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
52+
let l:output = []
53+
54+
for l:match in ale#util#GetMatches(a:lines, l:pattern)
55+
if l:match[4] is# 'error'
56+
let l:type = 'E'
57+
elseif l:match[4] is# 'note'
58+
let l:type = 'I'
59+
else
60+
let l:type = 'W'
61+
endif
62+
63+
let l:item = {
64+
\ 'lnum': str2nr(l:match[2]),
65+
\ 'type': l:type,
66+
\ 'text': l:match[5],
67+
\ 'code': l:match[6],
68+
\}
69+
70+
if !empty(l:match[3])
71+
let l:item.col = str2nr(l:match[3])
72+
endif
73+
74+
" If the filename is something like <stdin>, <nofile> or -, then
75+
" this is an error for the file we checked.
76+
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
77+
let l:item['filename'] = l:match[1]
78+
endif
79+
80+
call add(l:output, l:item)
81+
endfor
82+
83+
return l:output
84+
endfunction
85+
86+
function! ale#handlers#shellcheck#DefineLinter(filetype) abort
87+
" This global variable can be set with a string of comma-separated error
88+
" codes to exclude from shellcheck. For example:
89+
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
90+
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
91+
call ale#Set('sh_shellcheck_executable', 'shellcheck')
92+
call ale#Set('sh_shellcheck_dialect', 'auto')
93+
call ale#Set('sh_shellcheck_options', '')
94+
call ale#Set('sh_shellcheck_change_directory', 1)
95+
96+
call ale#linter#Define(a:filetype, {
97+
\ 'name': 'shellcheck',
98+
\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
99+
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
100+
\ buffer,
101+
\ ale#Var(buffer, 'sh_shellcheck_executable'),
102+
\ '%e --version',
103+
\ function('ale#handlers#shellcheck#GetCommand'),
104+
\ )},
105+
\ 'callback': 'ale#handlers#shellcheck#Handle',
106+
\})
107+
endfunction
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
===============================================================================
2+
ALE Bats Integration *ale-bats-options*
3+
4+
5+
===============================================================================
6+
shellcheck *ale-bats-shellcheck*
7+
8+
The `shellcheck` linter for Bats uses the sh options for `shellcheck`; see:
9+
|ale-sh-shellcheck|.
10+
11+
12+
===============================================================================
13+
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

sources_non_forked/ale/doc/ale-rust.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Integration Information
99
files for Rust distributed in Vim >=8.0.0501 or upstream:
1010
https://github.com/rust-lang/rust.vim
1111

12-
Note that there are three possible linters for Rust files:
12+
Note that there are several possible linters and fixers for Rust files:
1313

1414
1. rustc -- The Rust compiler is used to check the currently edited file.
1515
So, if your project consists of multiple files, you will get some errors
@@ -23,7 +23,12 @@ Integration Information
2323
over cargo. rls implements the Language Server Protocol for incremental
2424
compilation of Rust code, and can check Rust files while you type. `rls`
2525
requires Rust files to contained in Cargo projects.
26-
4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
26+
4. analyzer -- If you have rust-analyzer installed, you might prefer using
27+
this linter over cargo and rls. rust-analyzer also implements the
28+
Language Server Protocol for incremental compilation of Rust code, and is
29+
the next iteration of rls. rust-analyzer, like rls, requires Rust files
30+
to contained in Cargo projects.
31+
5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
2732
consistently reformat your Rust code.
2833

2934
Only cargo is enabled by default. To switch to using rustc instead of cargo,
@@ -36,6 +41,25 @@ Integration Information
3641
Also note that rustc 1.12. or later is needed.
3742

3843

44+
===============================================================================
45+
analyzer *ale-rust-analyzer*
46+
47+
g:ale_rust_analyzer_executable *g:ale_rust_analyzer_executable*
48+
*b:ale_rust_analyzer_executable*
49+
Type: |String|
50+
Default: `'rust-analyzer'`
51+
52+
This variable can be modified to change the executable path for
53+
`rust-analyzer`.
54+
55+
56+
g:ale_rust_analyzer_config *g:ale_rust_analyzer_config*
57+
*b:ale_rust_analyzer_config*
58+
Type: |Dictionary|
59+
Default: `{}`
60+
61+
Dictionary with configuration settings for rust-analyzer.
62+
3963
===============================================================================
4064
cargo *ale-rust-cargo*
4165

sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Notes:
3535
* `shell` (-n flag)
3636
* `shellcheck`
3737
* `shfmt`
38+
* Bats
39+
* `shellcheck`
3840
* BibTeX
3941
* `bibclean`
4042
* Bourne Shell
@@ -408,6 +410,7 @@ Notes:
408410
* Rust
409411
* `cargo`!!
410412
* `rls`
413+
* `rust-analyzer`
411414
* `rustc` (see |ale-integration-rust|)
412415
* `rustfmt`
413416
* Sass

sources_non_forked/ale/doc/ale.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,6 +2279,8 @@ documented in additional help files.
22792279
gcc...................................|ale-asm-gcc|
22802280
awk.....................................|ale-awk-options|
22812281
gawk..................................|ale-awk-gawk|
2282+
bats....................................|ale-bats-options|
2283+
shellcheck............................|ale-bats-shellcheck|
22822284
bib.....................................|ale-bib-options|
22832285
bibclean..............................|ale-bib-bibclean|
22842286
c.......................................|ale-c-options|
@@ -2579,6 +2581,7 @@ documented in additional help files.
25792581
sorbet................................|ale-ruby-sorbet|
25802582
standardrb............................|ale-ruby-standardrb|
25812583
rust....................................|ale-rust-options|
2584+
analyzer..............................|ale-rust-analyzer|
25822585
cargo.................................|ale-rust-cargo|
25832586
rls...................................|ale-rust-rls|
25842587
rustc.................................|ale-rust-rustc|

sources_non_forked/ale/supported-tools.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ formatting.
4444
* shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set)
4545
* [shellcheck](https://www.shellcheck.net/)
4646
* [shfmt](https://github.com/mvdan/sh)
47+
* Bats
48+
* [shellcheck](https://www.shellcheck.net/)
4749
* BibTeX
4850
* [bibclean](http://ftp.math.utah.edu/pub/bibclean/)
4951
* Bourne Shell
@@ -417,6 +419,7 @@ formatting.
417419
* Rust
418420
* [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions)
419421
* [rls](https://github.com/rust-lang-nursery/rls) :warning:
422+
* [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning:
420423
* [rustc](https://www.rust-lang.org/) :warning:
421424
* [rustfmt](https://github.com/rust-lang-nursery/rustfmt)
422425
* Sass

sources_non_forked/lightline-ale/autoload/lightline/ale.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ endfunction
5252

5353
function! lightline#ale#linted() abort
5454
return get(g:, 'ale_enabled', 0) == 1
55+
\ && getbufvar(bufnr(''), 'ale_enabled', 1)
5556
\ && getbufvar(bufnr(''), 'ale_linted', 0) > 0
5657
\ && ale#engine#IsCheckingBuffer(bufnr('')) == 0
5758
endfunction

sources_non_forked/lightline.vim/.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
jobs:
610
test:

0 commit comments

Comments
 (0)