Compare commits

..

4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
c849345a8d Add defensive ale#Set for c_build_dir_names in FindCompileCommands
Mirror the existing s:CanParseMakefile pattern to ensure the
g:ale_c_build_dir_names variable always exists when ale#Var is
called, even if test Save/Restore cycles delete it.

Co-authored-by: w0rp <3518142+w0rp@users.noreply.github.com>
2026-02-17 20:28:19 +00:00
copilot-swe-agent[bot]
014c959fee Improve comment clarity in FindCompileCommands
Co-authored-by: w0rp <3518142+w0rp@users.noreply.github.com>
2026-02-12 00:25:08 +00:00
copilot-swe-agent[bot]
520c775c6a Fix FindCompileCommands to handle absolute paths in c_build_dir_names
Use ale#path#GetAbsPath to resolve build directory paths, which correctly
handles both absolute and relative paths. When the dirname is absolute,
derive the project root from the parent of the build directory.

Co-authored-by: w0rp <3518142+w0rp@users.noreply.github.com>
2026-02-12 00:24:39 +00:00
copilot-swe-agent[bot]
7f79d30fb9 Initial plan 2026-02-12 00:20:49 +00:00
78 changed files with 103 additions and 631 deletions

View File

@@ -7,6 +7,6 @@ call ale#linter#Define('elixir', {
\ 'name': 'expert',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
\ 'command': '%e --stdio',
\ 'command': '%e',
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
\})

View File

@@ -1,40 +0,0 @@
" Author: Sam Bottoni
" Description: lilypond linter for LilyPond files
call ale#Set('lilypond_lilypond_executable', 'lilypond')
let g:ale_lilypond_lilypond_options = get(g:, 'ale_lilypond_lilypond_options', '')
function! ale_linters#lilypond#lilypond#GetCommand(buffer) abort
return '%e --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
\ . ale#Pad(ale#Var(a:buffer, 'lilypond_lilypond_options'))
\ . ' %t 2>&1'
endfunction
function! ale_linters#lilypond#lilypond#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
" Match: file:line:col: error|warning|programming error: message
let l:match = matchlist(l:line,
\ '\v^.*:(\d+):(\d+): (error|warning|programming error): (.*)$')
if !empty(l:match)
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
\ 'text': l:match[4]
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('lilypond', {
\ 'name': 'lilypond',
\ 'executable': {b -> ale#Var(b, 'lilypond_lilypond_executable')},
\ 'command': function('ale_linters#lilypond#lilypond#GetCommand'),
\ 'callback': 'ale_linters#lilypond#lilypond#Handle',
\})

View File

@@ -1,32 +0,0 @@
" Author: Armand Halbert <armand.halbert@gmail.com>
" Description: Harper for Markdown files
call ale#Set('markdown_harper_config', {
\ 'harper-ls': {
\ 'diagnosticSeverity': 'hint',
\ 'dialect': 'American',
\ 'linters': {
\ 'SpellCheck': v:true,
\ 'SentenceCapitalization': v:true,
\ 'RepeatedWords': v:true,
\ 'LongSentences': v:true,
\ 'AnA': v:true,
\ 'Spaces': v:true,
\ 'SpelledNumbers': v:false,
\ 'WrongQuotes': v:false,
\ },
\ },
\})
call ale#linter#Define('markdown', {
\ 'name': 'harper',
\ 'lsp': 'stdio',
\ 'executable': 'harper-ls',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#markdown#harper#GetProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'markdown_harper_config')},
\})
function! ale_linters#markdown#harper#GetProjectRoot(buffer) abort
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction

View File

@@ -5,6 +5,29 @@
call ale#Set('perl_perl_executable', 'perl')
" Please note that perl_perl_options does not exist here.
function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
" Build.PL, https://metacpan.org/pod/Module::Build
" dist.ini, https://metacpan.org/pod/Dist::Zilla
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
for l:root in l:potential_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
endfor
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
endfunction
call ale#Set('perl_languageserver_config', {})
function! s:get_lsp_config(buffer) abort
@@ -22,5 +45,5 @@ call ale#linter#Define('perl', {
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
\ 'lsp_config': {b -> s:get_lsp_config(b)},
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
\ })

View File

@@ -1,15 +0,0 @@
" Author: rymdbar <https://rymdbar.x20.se/>
" Description: Perl Navigator Language Server
" See: https://github.com/bscan/PerlNavigator
call ale#Set('perl_perlnavigator_config', {})
call ale#Set('perl_perlnavigator_executable', 'perlnavigator')
call ale#linter#Define('perl', {
\ 'name': 'perlnavigator',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'perl_perlnavigator_executable')},
\ 'command': '%e --stdio',
\ 'lsp_config': {b -> ale#Var(b, 'perl_perlnavigator_config')},
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ })

View File

@@ -7,34 +7,6 @@ call ale#Set('php_phpcs_options', '')
call ale#Set('php_phpcs_executable', 'phpcs')
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#phpcs#GetCwd(buffer) abort
let l:result = ale#path#Dirname(ale_linters#php#phpcs#FindProjectRoot(a:buffer))
return empty(l:result) ? v:null : l:result
endfunction
function! ale_linters#php#phpcs#FindProjectRoot(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml')
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'composer.json')
endif
return l:result
endfunction
function! ale_linters#php#phpcs#GetCommand(buffer) abort
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
let l:standard_option = !empty(l:standard)
@@ -76,7 +48,7 @@ call ale#linter#Define('php', {
\ 'vendor/bin/phpcs',
\ 'phpcs'
\ ])},
\ 'cwd': function('ale_linters#php#phpcs#GetCwd'),
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#php#phpcs#GetCommand'),
\ 'callback': 'ale_linters#php#phpcs#Handle',
\})

View File

@@ -8,10 +8,7 @@ call ale#Set('ruby_solargraph_executable', 'solargraph')
call ale#Set('ruby_solargraph_options', {})
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_solargraph_executable')
return ale#ruby#EscapeExecutable(l:executable, 'solargraph')
\ . ale#Pad('stdio')
return '%e' . ale#Pad('stdio')
endfunction
call ale#linter#Define('ruby', {

View File

@@ -25,10 +25,6 @@ endfunction
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
if empty(l:tf_dir)
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.')
endif
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
endfunction

View File

@@ -10,7 +10,7 @@ let s:sep = has('win32') ? '\' : '/'
" Set just so tests can override it.
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
call ale#Set('c_build_dir_names', [
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
\ 'build',
\ 'build/Debug',
\ 'build/Release',
@@ -18,6 +18,10 @@ call ale#Set('c_build_dir_names', [
\])
function! s:CanParseMakefile(buffer) abort
" Something somewhere seems to delete this setting in tests, so ensure we
" always have a default value.
call ale#Set('c_parse_makefile', 0)
return ale#Var(a:buffer, 'c_parse_makefile')
endfunction
@@ -242,6 +246,15 @@ function! ale#c#FindCompileCommands(buffer) abort
return [fnamemodify(l:json_file, ':h'), l:json_file]
endif
" Something somewhere seems to delete this setting in tests, so ensure
" we always have a default value.
call ale#Set('c_build_dir_names', [
\ 'build',
\ 'build/Debug',
\ 'build/Release',
\ 'bin',
\])
" Search in build directories if we can't find it in the project.
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')

View File

@@ -7,7 +7,7 @@ function! ale#fixers#alejandra#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -- -'
\}
endfunction

View File

@@ -12,7 +12,7 @@ function! ale#fixers#apkbuild_fixer#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -36,7 +36,7 @@ function! ale#fixers#clangtidy#GetCommand(buffer) abort
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
\ . ale#Pad(l:extra_options)
\ . (empty(l:extra_options) ? '' : ' ' . l:extra_options)
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction

View File

@@ -11,7 +11,7 @@ function! ale#fixers#dart_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,7 +11,7 @@ function! ale#fixers#dartfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -w'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,7 +11,7 @@ function! ale#fixers#dfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -i'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,7 +11,7 @@ function! ale#fixers#dotnet_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --folder --include %t "$(dirname %t)"',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,6 +11,6 @@ function! ale#fixers#dune#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -17,7 +17,7 @@ function! ale#fixers#elm_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
\ . ' %t'
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -12,7 +12,7 @@ function! ale#fixers#fish_indent#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -w '
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -13,7 +13,7 @@ function! ale#fixers#fourmolu#Fix(buffer) abort
return {
\ 'command': l:executable
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin-input-file '
\ . ale#Escape(@%),
\}

View File

@@ -11,6 +11,6 @@ function! ale#fixers#gofmt#Fix(buffer) abort
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -16,7 +16,7 @@ function! ale#fixers#goimports#Fix(buffer) abort
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . ' -l -w -srcdir %s'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -16,6 +16,6 @@ function! ale#fixers#golines#Fix(buffer) abort
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -15,7 +15,7 @@ function! ale#fixers#google_java_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . ale#Pad(l:options)
\ . ' ' . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --replace'
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@@ -11,7 +11,7 @@ function! ale#fixers#hackfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -i'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,6 +11,6 @@ function! ale#fixers#latexindent#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -l'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -7,7 +7,7 @@ function! ale#fixers#luafmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin',
\}
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#nickel_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . ' format'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -7,6 +7,6 @@ function! ale#fixers#nixpkgsfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#ocamlformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --name=%s'
\ . ' -'
\}

View File

@@ -13,6 +13,6 @@ function! ale#fixers#ocp_indent#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config))
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '': ' ' . l:options)
\}
endfunction

View File

@@ -10,6 +10,6 @@ function! ale#fixers#opafmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -7,6 +7,6 @@ function! ale#fixers#ormolu#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -11,7 +11,7 @@ function! ale#fixers#packer#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction

View File

@@ -11,7 +11,7 @@ function! ale#fixers#perltidy#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -b'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -7,6 +7,6 @@ function! ale#fixers#pgformatter#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -8,7 +8,6 @@ call ale#Set('javascript_prettier_options', '')
function! ale#fixers#prettier#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [
\ '.yarn/sdks/prettier/bin/prettier.cjs',
\ 'node_modules/.bin/prettier_d',
\ 'node_modules/prettier-cli/index.js',
\ 'node_modules/.bin/prettier',

View File

@@ -10,7 +10,7 @@ function! ale#fixers#ptop#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %s %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -10,6 +10,6 @@ function! ale#fixers#raco_fmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . ' fmt'
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#refmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --in-place'
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@@ -10,7 +10,7 @@ function! ale#fixers#rubyfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -10,6 +10,6 @@ function! ale#fixers#rustfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -11,7 +11,7 @@ function! ale#fixers#rustywind#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin'
\}
endfunction

View File

@@ -10,6 +10,6 @@ function! ale#fixers#scadformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -13,7 +13,7 @@ function! ale#fixers#scalafmt#GetCommand(buffer) abort
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t'
endfunction

View File

@@ -12,6 +12,6 @@ function! ale#fixers#shfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -filename=%s'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@@ -8,6 +8,6 @@ function! ale#fixers#sqlfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -w'
\ . ale#Pad(l:options),
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@@ -11,7 +11,7 @@ function! ale#fixers#terraform#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction

View File

@@ -8,7 +8,7 @@ function! ale#fixers#textlint#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' --fix'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,8 +11,8 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort
let l:rulesets = ale#handlers#ktlint#GetRulesets(a:buffer)
return ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . ale#Pad(l:rulesets)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . (empty(l:rulesets) ? '' : ' ' . l:rulesets)
\ . ' --stdin'
endfunction

View File

@@ -13,7 +13,7 @@ function! ale#handlers#languagetool#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'languagetool_options')
return ale#Escape(l:executable)
\ . ale#Pad(l:options) . ' %s'
\ . (empty(l:options) ? '' : ' ' . l:options) . ' %s'
endfunction
function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort

View File

@@ -1,24 +0,0 @@
" Author: rymdbar <https://rymdbar.x20.se/>
function! ale#handlers#perl#GetProjectRoot(buffer) abort
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
" Build.PL, https://metacpan.org/pod/Module::Build
" dist.ini, https://metacpan.org/pod/Dist::Zilla
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
for l:root in l:potential_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
endfor
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
endfunction

View File

@@ -329,27 +329,6 @@ function! ale#lsp#UpdateConfig(conn_id, buffer, config) abort
return 1
endfunction
function! ale#lsp#GetConnectionConfig(conn_id) abort
let l:conn = get(s:connections, a:conn_id, {})
return get(l:conn, 'config', {})
endfunction
" Send a JSON-RPC response to a server-initiated request (e.g. workspace/configuration).
" Unlike ale#lsp#Send, which builds outgoing requests/notifications with a 'method' field,
" this sends a response with 'id' + 'result' fields to reply to a request the server sent us.
function! ale#lsp#SendResponse(conn_id, id, result) abort
let l:conn = get(s:connections, a:conn_id, {})
if empty(l:conn)
return
endif
let l:body = json_encode({'jsonrpc': '2.0', 'id': a:id, 'result': a:result})
let l:data = 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body
call s:SendMessageData(l:conn, l:data)
endfunction
function! ale#lsp#CallInitCallbacks(conn_id) abort
let l:conn = get(s:connections, a:conn_id, {})

View File

@@ -241,12 +241,6 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
\ : a:response.result.items
call ale#lsp_linter#HandleLSPDiagnostics(a:conn_id, l:uri, l:diagnostics)
elseif l:method is# 'client/registerCapability'
call ale#lsp#SendResponse(a:conn_id, a:response.id, v:null)
elseif l:method is# 'workspace/configuration'
let l:items = get(get(a:response, 'params', {}), 'items', [])
let l:config = ale#lsp#GetConnectionConfig(a:conn_id)
call ale#lsp#SendResponse(a:conn_id, a:response.id, map(copy(l:items), 'l:config'))
elseif l:method is# 'window/showMessage'
call ale#lsp_window#HandleShowMessage(
\ s:lsp_linter_map[a:conn_id].name,

View File

@@ -1,29 +0,0 @@
===============================================================================
ALE LilyPond Integration *ale-lilypond-options*
===============================================================================
lilypond *ale-lilypond*
g:ale_lilypond_lilypond_executable *g:ale_lilypond_lilypond_executable*
*b:ale_lilypond_lilypond_executable*
Type: |String|
Default: `'lilypond'`
This variable can be changed to modify the executable used for lilypond.
g:ale_lilypond_lilypond_options *g:ale_lilypond_lilypond_options*
*b:ale_lilypond_lilypond_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to lilypond.
For example, to add custom include paths: >
let g:ale_lilypond_lilypond_options = '--include=/path/to/includes'
<
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -14,35 +14,6 @@ dprint *ale-markdown-dprint*
See |ale-dprint-options| and https://dprint.dev/plugins/markdown
===============================================================================
harper *ale-markdown-harper*
*ale-options.markdown_harper_config*
*g:ale_markdown_harper_config*
*b:ale_markdown_harper_config*
markdown_harper_config
g:ale_markdown_harper_config
Type: |Dictionary|
Default: `{'harper-ls': {'diagnosticSeverity': 'hint', 'dialect': 'American', ...}}`
Dictionary passed to harper-ls as LSP workspace configuration. The default
enables spell check, sentence capitalization, repeated words, long
sentences, a/an errors, and spacing rules, and disables spelled-out numbers
and wrong-quote checks.
Example: >
let g:ale_markdown_harper_config = {
\ 'harper-ls': {
\ 'diagnosticSeverity': 'warning',
\ 'linters': {
\ 'SpellCheck': v:true,
\ 'LongSentences': v:false,
\ },
\ },
\}
<
===============================================================================
markdownlint *ale-markdown-markdownlint*

View File

@@ -70,6 +70,7 @@ g:ale_perl_languageserver_config
For all available options and explanations, visit
https://metacpan.org/pod/Perl::LanguageServer#Extension-Settings
===============================================================================
perlcritic *ale-perl-perlcritic*
@@ -126,54 +127,6 @@ g:ale_perl_perlcritic_showrules
Defaults to off to reduce length of message.
===============================================================================
perlnavigator *ale-perl-perlnavigator*
*ale-options.perl_perlnavigator_executable*
*g:ale_perl_perlnavigator_executable*
*b:ale_perl_perlnavigator_executable*
perl_perlnavigator_executable
g:ale_perl_perlnavigator_executable
Type: |String|
Default: `'perlnavigator'`
This variable can be changed to modify the perlnavigator executable used for
linting perl.
*ale-options.perl_perlnavigator_config*
*g:ale_perl_perlnavigator_config*
*b:ale_perl_perlnavigator_config*
perl_perlnavigator_config
g:ale_perl_perlnavigator_config
Type: |Dictionary|
Default: `'{}'`
This variable can be changed to customize the lsp_config (sent as a
workspace/didChangeConfiguration command) for perlnavigator.
For example: >
let g:ale_perl_perlnavigator_config = {
\ 'perlnavigator': {
\ 'enableWarnings': 1,
\ 'includePaths': [ $HOME . '/MyPerlStuff/lib', '/tmp/tmp.7qSgUo34e' ],
\ 'perlEnvAdd': 1,
\ 'perlEnv': {
\ 'PERL_DL_NONLAZY': 1,
\ },
\ 'perlPath': substitute(g:ale_perl_perl_executable, '/perl$', '', ''),
\ 'perlcriticEnabled': 1,
\ 'perlcriticProfile': '$workspaceFolder/.perlcriticrc',
\ 'perltidyProfile': '$workspaceFolder/.perltidyrc',
\ 'perlcriticSeverity': 2,
\ },
\ }
\}
<
For all available options and explanations, visit
https://github.com/bscan/PerlNavigator?tab=readme-ov-file
===============================================================================
perltidy *ale-perl-perltidy*

View File

@@ -227,8 +227,8 @@ g:ale_ruby_solargraph_executable
Type: |String|
Default: `'solargraph'`
Override the invoked solargraph binary. Set this to `'bundle'` to invoke
`'bundle` `exec` solargraph'.
Override the invoked solargraph binary. This is useful for running solargraph
from binstubs or a bundle.
===============================================================================

View File

@@ -383,8 +383,6 @@ Notes:
* `lessc`
* `prettier`
* `stylelint`
* LilyPond
* `lilypond`
* LLVM
* `llc`
* Lua
@@ -406,7 +404,6 @@ Notes:
* Markdown
* `alex`
* `cspell`
* `harper`
* `languagetool`!!
* `markdownlint`!!
* `marksman`
@@ -482,7 +479,6 @@ Notes:
* `languageserver`
* `perl -c`
* `perl-critic`
* `perlnavigator`
* `perltidy`
* Perl6
* `perl6 -c`

View File

@@ -3722,8 +3722,6 @@ documented in additional help files.
lessc.................................|ale-less-lessc|
prettier..............................|ale-less-prettier|
stylelint.............................|ale-less-stylelint|
lilypond................................|ale-lilypond-options|
lilypond..............................|ale-lilypond|
llvm....................................|ale-llvm-options|
llc...................................|ale-llvm-llc|
lua.....................................|ale-lua-options|
@@ -3740,7 +3738,6 @@ documented in additional help files.
markdown................................|ale-markdown-options|
cspell................................|ale-markdown-cspell|
dprint................................|ale-markdown-dprint|
harper................................|ale-markdown-harper|
markdownlint..........................|ale-markdown-markdownlint|
marksman..............................|ale-markdown-marksman|
mdl...................................|ale-markdown-mdl|
@@ -3807,7 +3804,6 @@ documented in additional help files.
perl..................................|ale-perl-perl|
perl language server..................|ale-perl-languageserver|
perlcritic............................|ale-perl-perlcritic|
perlnavigator.........................|ale-perl-perlnavigator|
perltidy..............................|ale-perl-perltidy|
perl6...................................|ale-perl6-options|
perl6.................................|ale-perl6-perl6|

View File

@@ -393,8 +393,6 @@ formatting.
* [lessc](https://www.npmjs.com/package/less)
* [prettier](https://github.com/prettier/prettier)
* [stylelint](https://github.com/stylelint/stylelint)
* LilyPond
* [lilypond](https://lilypond.org/)
* LLVM
* [llc](https://llvm.org/docs/CommandGuide/llc.html)
* Lua
@@ -416,7 +414,6 @@ formatting.
* Markdown
* [alex](https://github.com/get-alex/alex)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [harper](https://github.com/elijah-potter/harper) :speech_balloon:
* [languagetool](https://languagetool.org/) :floppy_disk: :speech_balloon:
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
* [marksman](https://github.com/artempyanykh/marksman) :speech_balloon:
@@ -489,10 +486,9 @@ formatting.
* Pawn
* [uncrustify](https://github.com/uncrustify/uncrustify)
* Perl
* [languageserver](https://metacpan.org/pod/Perl::LanguageServer) :speech_balloon:
* [languageserver](https://metacpan.org/pod/Perl::LanguageServer)
* [perl -c](https://perl.org/) :warning:
* [perl-critic](https://metacpan.org/pod/Perl::Critic)
* [perlnavigator](https://github.com/bscan/PerlNavigator) :speech_balloon:
* [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy)
* Perl6
* [perl6 -c](https://perl6.org) :warning:

View File

@@ -1,49 +0,0 @@
Before:
runtime ale_linters/lilypond/lilypond.vim
call ale#linter#Reset()
Execute(The lilypond handler should parse a single error correctly):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'col': 5,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected NOT_A_TOKEN',
\ }
\ ],
\ ale_linters#lilypond#lilypond#Handle(0, [
\ 'test.ly:2:5: error: syntax error, unexpected NOT_A_TOKEN'
\ ])
Execute(The lilypond handler should parse warnings and errors):
AssertEqual
\ [
\ {
\ 'lnum': 3,
\ 'col': 1,
\ 'type': 'W',
\ 'text': 'deprecated syntax',
\ },
\ {
\ 'lnum': 5,
\ 'col': 12,
\ 'type': 'E',
\ 'text': 'unknown symbol',
\ }
\ ],
\ ale_linters#lilypond#lilypond#Handle(0, [
\ 'test.ly:3:1: warning: deprecated syntax',
\ 'test.ly:5:12: error: unknown symbol'
\ ])
Execute(The lilypond handler should ignore non-matching lines):
AssertEqual
\ [],
\ ale_linters#lilypond#lilypond#Handle(0, [
\ 'This is some unrelated output',
\ 'Another line without structure'
\ ])
After:
call ale#linter#Reset()

View File

@@ -1,6 +1,4 @@
Before:
call ale#assert#SetUpLinterTest('c', 'cc')
Save g:ale_c_parse_makefile
Save g:ale_history_enabled
@@ -21,6 +19,8 @@ Before:
return g:get_cflags_return_value
endfunction
call ale#assert#SetUpLinterTest('c', 'cc')
let b:command_tail = ' -S -x c'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote %s:h'

View File

@@ -1,10 +1,10 @@
Before:
call ale#assert#SetUpLinterTest('c', 'clangtidy')
call ale#test#SetFilename('test.c')
Save g:ale_c_parse_makefile
let g:ale_c_parse_makefile = 0
call ale#assert#SetUpLinterTest('c', 'clangtidy')
call ale#test#SetFilename('test.c')
After:
call ale#assert#TearDownLinterTest()

View File

@@ -1,10 +1,10 @@
Before:
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
call ale#test#SetFilename('test.cpp')
Save g:ale_c_parse_makefile
let g:ale_c_parse_makefile = 0
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
call ale#test#SetFilename('test.cpp')
After:
call ale#assert#TearDownLinterTest()

View File

@@ -1,6 +1,4 @@
Before:
call ale#assert#SetUpLinterTest('cpp', 'cc')
Save g:ale_c_parse_makefile
Save g:ale_history_enabled
@@ -10,6 +8,7 @@ Before:
let g:get_cflags_return_value = ''
let g:executable_map = {}
runtime autoload/ale/c.vim
runtime autoload/ale/engine.vim
function! ale#engine#IsExecutable(buffer, executable) abort
@@ -20,6 +19,8 @@ Before:
return g:get_cflags_return_value
endfunction
call ale#assert#SetUpLinterTest('cpp', 'cc')
let b:command_tail = ' -S -x c++'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote %s:h'

View File

@@ -5,12 +5,12 @@ After:
call ale#assert#TearDownLinterTest()
Execute(should set correct defaults):
AssertLinter 'expert', ale#Escape('expert') . ' --stdio'
AssertLinter 'expert', ale#Escape('expert')
Execute(The executable should be configurable):
let b:ale_elixir_expert_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio'
AssertLinter 'foobar', ale#Escape('foobar')
Execute(should set correct LSP values):
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/app1/lib/app.ex')

View File

@@ -1,35 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('lilypond', 'lilypond')
call ale#test#SetFilename('test.ly')
let g:ale_lilypond_lilypond_executable = 'lilypond'
let g:ale_lilypond_lilypond_options = ''
After:
call ale#assert#TearDownLinterTest()
Execute(The executable should default to lilypond):
AssertLinter 'lilypond',
\ ale#Escape('lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp %t 2>&1'
Execute(Should be able to set a custom executable):
let g:ale_lilypond_lilypond_executable = 'bin/lilypond'
AssertLinter 'bin/lilypond',
\ ale#Escape('bin/lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp %t 2>&1'
Execute(Should be able to set custom options):
let g:ale_lilypond_lilypond_options = '--include=/path/to/includes'
AssertLinter 'lilypond',
\ ale#Escape('lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
\ . ' --include=/path/to/includes %t 2>&1'
Execute(Should be able to set both custom executable and options):
let g:ale_lilypond_lilypond_executable = '/usr/local/bin/lilypond'
let g:ale_lilypond_lilypond_options = '--include=/custom/path -dlog-file=/tmp/lily.log'
AssertLinter '/usr/local/bin/lilypond',
\ ale#Escape('/usr/local/bin/lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
\ . ' --include=/custom/path -dlog-file=/tmp/lily.log %t 2>&1'

View File

@@ -1,14 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('markdown', 'harper')
After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'harper-ls', ale#Escape('harper-ls') . ' --stdio'
Execute(Should accept configuration settings):
AssertLSPConfig g:ale_markdown_harper_config
let b:ale_markdown_harper_config = {'harper-ls': {'diagnosticSeverity': 'warning'}}
AssertLSPConfig {'harper-ls': {'diagnosticSeverity': 'warning'}}

View File

@@ -1,78 +0,0 @@
" Author: rymdbar <https://rymdbar.x20.se/>
Before:
call ale#assert#SetUpLinterTest('perl', 'perlnavigator')
After:
call ale#assert#TearDownLinterTest()
Execute(The default Perl command callback should be correct):
AssertLinter 'perlnavigator',
\ ale#Escape('perlnavigator') . ' --stdio'
Execute(Overriding the executable should work):
let b:ale_perl_perlnavigator_executable = 'plnav'
AssertLinter 'plnav', ale#Escape('plnav') . ' --stdio'
unlet b:ale_perl_perlnavigator_executable
Execute(The project root should be detected correctly in from build files):
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
call ale#test#SetFilename('../test-files/perl/' . mod . '/subdir/empty.pl')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl/' . mod)
endfor
Execute(The project root should be globally configurable):
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
" Configuring g:ale_root using a Dictionary works.
let g:ale_root.perlnavigator =
\ ale#path#Simplify(g:dir . '/../test-files/perl')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
unlet g:ale_root.perlnavigator
" As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there
" is a bug with g:ale_root which is thus missing here.
endfor
Execute(The project root should be per buffer configurable):
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
" Configuring b:ale_root using a String works.
let b:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
unlet b:ale_root
" Configuring b:ale_root using a Dictionary works.
let b:ale_root = {
\ 'perlnavigator': ale#path#Simplify(g:dir . '/../test-files/perl')
\ }
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
unlet b:ale_root.perlnavigator
endfor
Execute(The LSP values should be set correctly):
AssertLSPLanguage 'perl'
AssertLSPOptions {}
AssertLSPConfig {}
Execute(Should accept configuration settings):
let b:ale_perl_perlnavigator_config = {
\ 'perlnavigator': {
\ 'perlcriticEnabled': 1,
\ 'perlcriticProfile': '$workspaceFolder/.perlcriticrc',
\ },
\ }
AssertLSPConfig {
\ 'perlnavigator': {
\ 'perlcriticEnabled': 1,
\ 'perlcriticProfile': '$workspaceFolder/.perlcriticrc',
\ },
\ }

View File

@@ -11,7 +11,7 @@ Execute(The local phpcs executable should be used):
let g:executable = ale#path#Simplify(g:dir . '/../test-files/phpcs/project-with-phpcs/vendor/bin/phpcs')
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/phpcs/project-with-phpcs')
AssertLinterCwd '%s:h'
AssertLinter g:executable, ale#Escape(g:executable)
\ . ' -s --report=emacs --stdin-path=%s'

View File

@@ -13,13 +13,6 @@ Execute(command callback executable can be overridden):
let g:ale_ruby_solargraph_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' stdio'
Execute(Setting bundle appends 'exec solargraph'):
let g:ale_ruby_solargraph_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec solargraph'
\ . ' stdio'
Execute(should set solargraph for rails app):
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/models/thing.rb')
AssertLSPLanguage 'ruby'

View File

@@ -534,58 +534,6 @@ Execute(LSP pull model diagnostic responses that are 'unchanged' should be handl
\ g:ale_buffer_info[bufnr('')].loclist
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
Execute(workspace/configuration requests should be answered with the connection config):
let g:sent_responses = []
function! ale#lsp#GetConnectionConfig(conn_id) abort
return {'foo': 'bar'}
endfunction
function! ale#lsp#SendResponse(conn_id, id, result) abort
call add(g:sent_responses, [a:conn_id, a:id, a:result])
endfunction
call ale#lsp_linter#SetLSPLinterMap({'1': {'name': 'pylsp', 'aliases': [], 'lsp': 'stdio'}})
call ale#lsp_linter#HandleLSPResponse(1, {
\ 'jsonrpc': '2.0',
\ 'id': 7,
\ 'method': 'workspace/configuration',
\ 'params': {
\ 'items': [{'section': 'foo'}, {'section': 'bar'}],
\ },
\})
AssertEqual
\ [[1, 7, [{'foo': 'bar'}, {'foo': 'bar'}]]],
\ g:sent_responses
unlet! g:sent_responses
runtime autoload/ale/lsp.vim
Execute(client/registerCapability requests should be acknowledged):
let g:sent_responses = []
function! ale#lsp#SendResponse(conn_id, id, result) abort
call add(g:sent_responses, [a:conn_id, a:id, a:result])
endfunction
call ale#lsp_linter#SetLSPLinterMap({'1': {'name': 'expert', 'aliases': [], 'lsp': 'stdio'}})
call ale#lsp_linter#HandleLSPResponse(1, {
\ 'jsonrpc': '2.0',
\ 'id': 12,
\ 'method': 'client/registerCapability',
\ 'params': {
\ 'registrations': [{'id': 'abc', 'method': 'textDocument/didSave'}],
\ },
\})
AssertEqual
\ [[1, 12, v:null]],
\ g:sent_responses
unlet! g:sent_responses
runtime autoload/ale/lsp.vim
Execute(LSP errors should be logged in the history):
call ale#lsp_linter#SetLSPLinterMap({'347': {'name': 'foobar', 'aliases': [], 'lsp': 'stdio'}})
call ale#lsp_linter#HandleLSPResponse(347, {

View File

@@ -1,26 +1,16 @@
Before:
runtime autoload/ale/lsp.vim
runtime autoload/ale/job.vim
let g:conn_id = ale#lsp#Register('executable', '/foo/bar', '', {})
let g:sent_data = []
" Stub out these functions to capture calls without side effects.
" Stub out this function, so we test updating configs.
function! ale#lsp#Send(conn_id, message) abort
endfunction
function! ale#job#SendRaw(job_id, data) abort
call add(g:sent_data, a:data)
endfunction
After:
Restore
unlet! g:conn_id
unlet! g:conn
unlet! g:sent_data
unlet! g:remainder
unlet! g:messages
runtime autoload/ale/lsp.vim
@@ -29,27 +19,3 @@ Execute(Only send updates when the configuration dictionary changes):
AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1})
AssertEqual 0, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1})
AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {})
Execute(ale#lsp#GetConnectionConfig() should return empty dict for unknown connections):
AssertEqual {}, ale#lsp#GetConnectionConfig('unknown:conn')
Execute(ale#lsp#GetConnectionConfig() should return the current connection config):
call ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'foo': 'bar'})
AssertEqual {'foo': 'bar'}, ale#lsp#GetConnectionConfig(g:conn_id)
Execute(ale#lsp#SendResponse() should do nothing for unknown connections):
" Should not throw
call ale#lsp#SendResponse('unknown:conn', 1, [])
AssertEqual [], g:sent_data
Execute(ale#lsp#SendResponse() should send a JSON-RPC response message):
" Give the connection a job_id so s:SendMessageData routes to ale#job#SendRaw
let g:conn = ale#lsp#GetConnections()[g:conn_id]
let g:conn.job_id = 1
call ale#lsp#SendResponse(g:conn_id, 42, ['result_value'])
AssertEqual 1, len(g:sent_data)
let [g:remainder, g:messages] = ale#lsp#ReadMessageData(g:sent_data[0])
AssertEqual '', g:remainder
AssertEqual [{'jsonrpc': '2.0', 'id': 42, 'result': ['result_value']}], g:messages

View File

@@ -1,5 +1,4 @@
Before:
runtime autoload/ale/c.vim
Save g:ale_c_build_dir_names
call ale#test#SetDirectory('/testplugin/test')

View File

@@ -1,7 +1,4 @@
Before:
runtime autoload/ale/c.vim
Save g:ale_c_parse_makefile
Save g:ale_c_always_make
Save b:ale_c_always_make