Skip to content

Commit 761bd10

Browse files
committed
Merge remote-tracking branch 'upstream/master'
* upstream/master: feat(markdown): add rumdl server and fixer (dense-analysis#5115) fix(terraform-ls): return current buffer dir when missing .terraform (dense-analysis#5103) fix expert lsp stdio and register capability (dense-analysis#5113) Add support for PerlNavigator (dense-analysis#5028) Use ale#Pad for option padding across the codebase (dense-analysis#5118) Add support for LilyPond syntax (dense-analysis#5117) feat: Load Prettier from cjs also fix(tests): fix ale_c_build_dir_names being unset in tests (dense-analysis#5109)
2 parents 5855f10 + c59c0d1 commit 761bd10

65 files changed

Lines changed: 555 additions & 72 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ale_linters/elixir/expert.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ call ale#linter#Define('elixir', {
77
\ 'name': 'expert',
88
\ 'lsp': 'stdio',
99
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
10-
\ 'command': '%e',
10+
\ 'command': '%e --stdio',
1111
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
1212
\})

ale_linters/lilypond/lilypond.vim

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
" Author: Sam Bottoni
2+
" Description: lilypond linter for LilyPond files
3+
4+
call ale#Set('lilypond_lilypond_executable', 'lilypond')
5+
6+
let g:ale_lilypond_lilypond_options = get(g:, 'ale_lilypond_lilypond_options', '')
7+
8+
function! ale_linters#lilypond#lilypond#GetCommand(buffer) abort
9+
return '%e --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
10+
\ . ale#Pad(ale#Var(a:buffer, 'lilypond_lilypond_options'))
11+
\ . ' %t 2>&1'
12+
endfunction
13+
14+
function! ale_linters#lilypond#lilypond#Handle(buffer, lines) abort
15+
let l:output = []
16+
17+
for l:line in a:lines
18+
" Match: file:line:col: error|warning|programming error: message
19+
let l:match = matchlist(l:line,
20+
\ '\v^.*:(\d+):(\d+): (error|warning|programming error): (.*)$')
21+
22+
if !empty(l:match)
23+
call add(l:output, {
24+
\ 'lnum': str2nr(l:match[1]),
25+
\ 'col': str2nr(l:match[2]),
26+
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
27+
\ 'text': l:match[4]
28+
\})
29+
endif
30+
endfor
31+
32+
return l:output
33+
endfunction
34+
35+
call ale#linter#Define('lilypond', {
36+
\ 'name': 'lilypond',
37+
\ 'executable': {b -> ale#Var(b, 'lilypond_lilypond_executable')},
38+
\ 'command': function('ale_linters#lilypond#lilypond#GetCommand'),
39+
\ 'callback': 'ale_linters#lilypond#lilypond#Handle',
40+
\})

ale_linters/markdown/rumdl.vim

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
" Author: Evan Chen <evan@evanchen.cc>
2+
" Description: Fast Markdown linter and formatter written in Rust
3+
4+
5+
call ale#Set('markdown_rumdl_executable', 'rumdl')
6+
call ale#Set('markdown_rumdl_options', '')
7+
8+
function! ale_linters#markdown#rumdl#GetProjectRoot(buffer) abort
9+
let l:dotconfig = ale#path#FindNearestFile(a:buffer, '.rumdl.toml')
10+
let l:config = ale#path#FindNearestFile(a:buffer, 'rumdl.toml')
11+
12+
if !empty(l:dotconfig) && !empty(l:config)
13+
let l:nearest = len(l:dotconfig) >= len(l:config) ? l:dotconfig : l:config
14+
15+
return fnamemodify(l:nearest, ':h')
16+
elseif !empty(l:dotconfig)
17+
return fnamemodify(l:dotconfig, ':h')
18+
elseif !empty(l:config)
19+
return fnamemodify(l:config, ':h')
20+
endif
21+
22+
" Try to find nearest pyproject.toml
23+
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
24+
25+
if !empty(l:pyproject_file)
26+
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
27+
endif
28+
29+
" Try to find nearest `git` directory
30+
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
31+
32+
if !empty(l:gitdir)
33+
return fnamemodify(l:gitdir . '/', ':p:h:h')
34+
endif
35+
36+
return fnamemodify(bufname(a:buffer), ':p:h')
37+
endfunction
38+
39+
call ale#linter#Define('markdown', {
40+
\ 'name': 'rumdl',
41+
\ 'lsp': 'stdio',
42+
\ 'executable': {b -> ale#Var(b, 'markdown_rumdl_executable')},
43+
\ 'command': {b -> ale#Escape(ale#Var(b, 'markdown_rumdl_executable'))
44+
\ . ' server --stdio'
45+
\ . ale#Pad(ale#Var(b, 'markdown_rumdl_options'))},
46+
\ 'project_root': function('ale_linters#markdown#rumdl#GetProjectRoot'),
47+
\ 'language': 'markdown',
48+
\})

ale_linters/perl/languageserver.vim

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,6 @@
55
call ale#Set('perl_perl_executable', 'perl')
66
" Please note that perl_perl_options does not exist here.
77

8-
function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
9-
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
10-
" Build.PL, https://metacpan.org/pod/Module::Build
11-
" dist.ini, https://metacpan.org/pod/Dist::Zilla
12-
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
13-
14-
for l:root in l:potential_roots
15-
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
16-
17-
if !empty(l:project_root)
18-
return fnamemodify(l:project_root . '/', ':p:h:h')
19-
endif
20-
endfor
21-
22-
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
23-
24-
if !empty(l:project_root)
25-
return fnamemodify(l:project_root . '/', ':p:h:h')
26-
endif
27-
28-
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
29-
endfunction
30-
318
call ale#Set('perl_languageserver_config', {})
329

3310
function! s:get_lsp_config(buffer) abort
@@ -45,5 +22,5 @@ call ale#linter#Define('perl', {
4522
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
4623
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
4724
\ 'lsp_config': {b -> s:get_lsp_config(b)},
48-
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
25+
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
4926
\ })

ale_linters/perl/perlnavigator.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
" Author: rymdbar <https://rymdbar.x20.se/>
2+
" Description: Perl Navigator Language Server
3+
" See: https://github.com/bscan/PerlNavigator
4+
5+
call ale#Set('perl_perlnavigator_config', {})
6+
call ale#Set('perl_perlnavigator_executable', 'perlnavigator')
7+
8+
call ale#linter#Define('perl', {
9+
\ 'name': 'perlnavigator',
10+
\ 'lsp': 'stdio',
11+
\ 'executable': {b -> ale#Var(b, 'perl_perlnavigator_executable')},
12+
\ 'command': '%e --stdio',
13+
\ 'lsp_config': {b -> ale#Var(b, 'perl_perlnavigator_config')},
14+
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
15+
\ })

ale_linters/terraform/terraform_ls.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ endfunction
2525
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
2626
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
2727

28+
if empty(l:tf_dir)
29+
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.')
30+
endif
31+
2832
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
2933
endfunction
3034

autoload/ale/fix/registry.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,11 @@ let s:default_registry = {
767767
\ 'suggested_filetypes': ['markdown'],
768768
\ 'description': 'Fix markdown files with markdownlint.',
769769
\ },
770+
\ 'rumdl': {
771+
\ 'function': 'ale#fixers#rumdl#Fix',
772+
\ 'suggested_filetypes': ['markdown'],
773+
\ 'description': 'Fix markdown files with rumdl.',
774+
\ },
770775
\}
771776

772777
" Reset the function registry to the default entries.

autoload/ale/fixers/alejandra.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function! ale#fixers#alejandra#Fix(buffer) abort
77

88
return {
99
\ 'command': ale#Escape(l:executable)
10-
\ . (empty(l:options) ? '' : ' ' . l:options)
10+
\ . ale#Pad(l:options)
1111
\ . ' -- -'
1212
\}
1313
endfunction

autoload/ale/fixers/apkbuild_fixer.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function! ale#fixers#apkbuild_fixer#Fix(buffer) abort
1212
return {
1313
\ 'command': ale#Escape(l:executable)
1414
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
15-
\ . (empty(l:options) ? '' : ' ' . l:options)
15+
\ . ale#Pad(l:options)
1616
\ . ' %t',
1717
\ 'read_temporary_file': 1,
1818
\}

autoload/ale/fixers/clangtidy.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function! ale#fixers#clangtidy#GetCommand(buffer) abort
3636

3737
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
3838
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
39-
\ . (empty(l:extra_options) ? '' : ' ' . l:extra_options)
39+
\ . ale#Pad(l:extra_options)
4040
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
4141
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
4242
endfunction

0 commit comments

Comments
 (0)