diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 5f31b61e..8d9ef73a 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -21,7 +21,7 @@ function! syntastic#c#ReadConfig(file) abort " {{{2 call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file) " search upwards from the current file's directory - let config = findfile(a:file, escape(expand('%:p:h', 1), ' ') . ';') + let config = syntastic#util#findFileInParent(a:file, expand('%:p:h', 1)) if config ==# '' call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found') return '' diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index bd3e2e13..ab949076 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -227,10 +227,18 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2 endfunction " }}}2 " start in directory a:where and walk up the parent folders until it finds a -" file matching a:what; return path to that file; do NOT use this function if -" a:what doesn't contain wildcards, use findfile(a:what, escape(a:where, ' ') . ';') -" instead -function! syntastic#util#findInParent(what, where) abort " {{{2 +" file named a:what; return path to that file +function! syntastic#util#findFileInParent(what, where) abort " {{{2 + let old_suffixesadd = &suffixesadd + let &suffixesadd = '' + let file = findfile(a:what, escape(a:where, ' ') . ';') + let &suffixesadd = old_suffixesadd + return file +endfunction " }}}2 + +" start in directory a:where and walk up the parent folders until it finds a +" file matching a:what; return path to that file +function! syntastic#util#findGlobInParent(what, where) abort " {{{2 let here = fnamemodify(a:where, ':p') let root = syntastic#util#Slash() diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index aa11345f..c62ec45c 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.6.0-109' +let g:_SYNTASTIC_VERSION = '3.6.0-110' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/syntax_checkers/c/pc_lint.vim b/syntax_checkers/c/pc_lint.vim index 347baac1..6efd17a1 100644 --- a/syntax_checkers/c/pc_lint.vim +++ b/syntax_checkers/c/pc_lint.vim @@ -23,7 +23,7 @@ if !exists('g:syntastic_pc_lint_config_file') endif function! SyntaxCheckers_c_pc_lint_GetLocList() dict - let config = findfile(g:syntastic_pc_lint_config_file, escape(expand('%:p:h', 1), ' ') . ';') + let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1)) call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 1c4f0a83..09408d15 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -35,7 +35,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict let make_options = {} let compile_command = 'elixir' - let mix_file = findfile('mix.exs', escape(expand('%:p:h', 1), ' ') . ';') + let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1)) if filereadable(mix_file) let compile_command = 'mix compile' diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 0b689b5d..789e9f3a 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -24,7 +24,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict elseif exists('g:vaxe_hxml') let hxml = g:vaxe_hxml else - let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h', 1)) + let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1)) endif let hxml = fnamemodify(hxml, ':p') diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 8b1d7a61..d9738c6e 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -315,7 +315,7 @@ endfunction " }}}2 function! s:GetMavenProperties() " {{{2 let mvn_properties = {} - let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';') + let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1)) if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . @@ -350,7 +350,7 @@ function! s:GetMavenProperties() " {{{2 endfunction " }}}2 function! s:GetMavenClasspath() " {{{2 - let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';') + let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1)) if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . @@ -394,7 +394,7 @@ function! s:GetMavenClasspath() " {{{2 endfunction " }}}2 function! s:MavenOutputDirectory() " {{{2 - let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';') + let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1)) if s:has_maven && filereadable(pom) let mvn_properties = s:GetMavenProperties() let output_dir = getcwd() diff --git a/syntax_checkers/javascript/flow.vim b/syntax_checkers/javascript/flow.vim index b928971b..6ef39790 100644 --- a/syntax_checkers/javascript/flow.vim +++ b/syntax_checkers/javascript/flow.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict endfunction function! SyntaxCheckers_javascript_flow_GetLocList() dict - if findfile('.flowconfig', escape(expand('%:p:h', 1), ' ') . ';') ==# '' + if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# '' return [] endif diff --git a/syntax_checkers/rst/sphinx.vim b/syntax_checkers/rst/sphinx.vim index 7d428212..96843876 100644 --- a/syntax_checkers/rst/sphinx.vim +++ b/syntax_checkers/rst/sphinx.vim @@ -30,7 +30,7 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict let srcdir = syntastic#util#var('rst_sphinx_source_dir') call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir) if srcdir == '' - let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';') + let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) if config == '' || !filereadable(config) call self.log('conf.py file not found') return [] @@ -41,7 +41,7 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict let confdir = syntastic#util#var('rst_sphinx_config_dir') call self.log('g:syntastic_rst_sphinx_config_dir =', confdir) if confdir == '' - let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';') + let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1)) let confdir = (config != '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir endif