mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-19 16:24:20 +08:00
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>
This commit is contained in:
@@ -246,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')
|
||||
|
||||
Reference in New Issue
Block a user