diff options
75 files changed, 183 insertions, 116 deletions
diff --git a/ale_linters/css/stylelint.vim b/ale_linters/css/stylelint.vim index 38cb0e0b..e508f392 100644 --- a/ale_linters/css/stylelint.vim +++ b/ale_linters/css/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('css', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#css#stylelint#GetCommand'), diff --git a/ale_linters/elm/elm_ls.vim b/ale_linters/elm/elm_ls.vim index 2fa71adb..a02dbf42 100644 --- a/ale_linters/elm/elm_ls.vim +++ b/ale_linters/elm/elm_ls.vim @@ -28,7 +28,7 @@ endfunction call ale#linter#Define('elm', { \ 'name': 'elm_ls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ \ 'node_modules/.bin/elm-language-server', \ 'node_modules/.bin/elm-lsp', \ 'elm-lsp' diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 48ed82f3..a7f9ea7b 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -202,7 +202,7 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " elm-test needs to know the path of elm-make if elm isn't installed globally. " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler if l:is_v19 && l:is_using_elm_test - let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' ' else let l:elm_test_compiler_flag = ' ' @@ -222,13 +222,13 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) if l:is_test && l:is_v19 - return ale#node#FindExecutable( + return ale#path#FindExecutable( \ a:buffer, \ 'elm_make', \ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm'] \) else - return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) endif endfunction diff --git a/ale_linters/go/gopls.vim b/ale_linters/go/gopls.vim index f3f1bd6b..23082e9b 100644 --- a/ale_linters/go/gopls.vim +++ b/ale_linters/go/gopls.vim @@ -5,6 +5,21 @@ call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_options', '--mode stdio') call ale#Set('go_gopls_init_options', {}) +call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! s:GetGoPathExecutable(suffix) abort + let l:prefix = $GOPATH + + if !empty($GOPATH) + let l:prefix = $GOPATH + elseif has('win32') + let l:prefix = $USERPROFILE . '/go' + else + let l:prefix = $HOME . '/go' + endif + + return ale#path#Simplify(l:prefix . '/' . a:suffix) +endfunction function! ale_linters#go#gopls#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) @@ -29,7 +44,9 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gopls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')}, +\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [ +\ s:GetGoPathExecutable('bin/gopls'), +\ ])}, \ 'command': function('ale_linters#go#gopls#GetCommand'), \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), \ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim index bd4d1d31..8362bb1c 100644 --- a/ale_linters/handlebars/embertemplatelint.vim +++ b/ale_linters/handlebars/embertemplatelint.vim @@ -5,7 +5,7 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ + return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ \ 'node_modules/.bin/ember-template-lint', \]) endfunction diff --git a/ale_linters/html/angular.vim b/ale_linters/html/angular.vim index f550d665..17c0a751 100644 --- a/ale_linters/html/angular.vim +++ b/ale_linters/html/angular.vim @@ -11,7 +11,7 @@ function! ale_linters#html#angular#GetProjectRoot(buffer) abort endfunction function! ale_linters#html#angular#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'html_angular', [ + return ale#path#FindExecutable(a:buffer, 'html_angular', [ \ 'node_modules/@angular/language-server/bin/ngserver', \ 'node_modules/@angular/language-server/index.js', \]) diff --git a/ale_linters/html/htmlhint.vim b/ale_linters/html/htmlhint.vim index 3e01f51a..25bf5137 100644 --- a/ale_linters/html/htmlhint.vim +++ b/ale_linters/html/htmlhint.vim @@ -24,7 +24,7 @@ endfunction call ale#linter#Define('html', { \ 'name': 'htmlhint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ \ 'node_modules/.bin/htmlhint', \ ])}, \ 'command': function('ale_linters#html#htmlhint#GetCommand'), diff --git a/ale_linters/html/stylelint.vim b/ale_linters/html/stylelint.vim index ae8955f3..6b7aba40 100644 --- a/ale_linters/html/stylelint.vim +++ b/ale_linters/html/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('html_stylelint_options', '') call ale#Set('html_stylelint_use_global', 0) function! ale_linters#html#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'html_stylelint', [ + return ale#path#FindExecutable(a:buffer, 'html_stylelint', [ \ 'node_modules/.bin/stylelint', \]) endfunction diff --git a/ale_linters/ink/ls.vim b/ale_linters/ink/ls.vim index 1cc93583..00b2f323 100644 --- a/ale_linters/ink/ls.vim +++ b/ale_linters/ink/ls.vim @@ -6,7 +6,7 @@ call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('ink_ls_initialization_options', {}) function! ale_linters#ink#ls#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'ink_ls', [ + return ale#path#FindExecutable(a:buffer, 'ink_ls', [ \ 'ink-language-server', \ 'node_modules/.bin/ink-language-server', \]) diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim index 3135e2e9..601bac33 100644 --- a/ale_linters/javascript/flow.vim +++ b/ale_linters/javascript/flow.vim @@ -22,7 +22,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort return '' endif - return ale#node#FindExecutable(a:buffer, 'javascript_flow', [ + return ale#path#FindExecutable(a:buffer, 'javascript_flow', [ \ 'node_modules/.bin/flow', \]) endfunction diff --git a/ale_linters/javascript/flow_ls.vim b/ale_linters/javascript/flow_ls.vim index accaaa73..fec34011 100644 --- a/ale_linters/javascript/flow_ls.vim +++ b/ale_linters/javascript/flow_ls.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow-language-server', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_flow_ls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'node_modules/.bin/flow', \ ])}, \ 'command': '%e lsp --from ale-lsp', diff --git a/ale_linters/javascript/jscs.vim b/ale_linters/javascript/jscs.vim index 8905b3a1..ae3be68c 100644 --- a/ale_linters/javascript/jscs.vim +++ b/ale_linters/javascript/jscs.vim @@ -53,7 +53,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jscs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jscs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [ \ 'node_modules/.bin/jscs', \ ])}, \ 'command': function('ale_linters#javascript#jscs#GetCommand'), diff --git a/ale_linters/javascript/jshint.vim b/ale_linters/javascript/jshint.vim index d80a2250..26d4fda2 100644 --- a/ale_linters/javascript/jshint.vim +++ b/ale_linters/javascript/jshint.vim @@ -25,7 +25,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jshint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jshint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [ \ 'node_modules/.bin/jshint', \ ])}, \ 'command': function('ale_linters#javascript#jshint#GetCommand'), diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim index 1990adce..addf41dd 100644 --- a/ale_linters/javascript/standard.vim +++ b/ale_linters/javascript/standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale_linters#javascript#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/semistandard/bin/cmd.js', diff --git a/ale_linters/javascript/tsserver.vim b/ale_linters/javascript/tsserver.vim index 68c252c5..caf6972b 100644 --- a/ale_linters/javascript/tsserver.vim +++ b/ale_linters/javascript/tsserver.vim @@ -8,7 +8,7 @@ call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('javascript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [ \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', diff --git a/ale_linters/json/jsonlint.vim b/ale_linters/json/jsonlint.vim index f677b488..812540af 100644 --- a/ale_linters/json/jsonlint.vim +++ b/ale_linters/json/jsonlint.vim @@ -4,7 +4,7 @@ call ale#Set('json_jsonlint_executable', 'jsonlint') call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#json#jsonlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [ + return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [ \ 'node_modules/.bin/jsonlint', \ 'node_modules/jsonlint/lib/cli.js', \]) diff --git a/ale_linters/json/spectral.vim b/ale_linters/json/spectral.vim index c7d56234..14129c56 100644 --- a/ale_linters/json/spectral.vim +++ b/ale_linters/json/spectral.vim @@ -6,7 +6,7 @@ call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0 call ale#linter#Define('json', { \ 'name': 'spectral', -\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', diff --git a/ale_linters/less/lessc.vim b/ale_linters/less/lessc.vim index 4ec8b00e..8e21f5b4 100644 --- a/ale_linters/less/lessc.vim +++ b/ale_linters/less/lessc.vim @@ -38,7 +38,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'lessc', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_lessc', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [ \ 'node_modules/.bin/lessc', \ ])}, \ 'command': function('ale_linters#less#lessc#GetCommand'), diff --git a/ale_linters/less/stylelint.vim b/ale_linters/less/stylelint.vim index efb036c2..83f784c4 100644 --- a/ale_linters/less/stylelint.vim +++ b/ale_linters/less/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#less#stylelint#GetCommand'), diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim index ed87d1ad..6085e7ef 100644 --- a/ale_linters/markdown/remark_lint.vim +++ b/ale_linters/markdown/remark_lint.vim @@ -39,7 +39,7 @@ endfunction call ale#linter#Define('markdown', { \ 'name': 'remark_lint', \ 'aliases': ['remark-lint'], -\ 'executable': {b -> ale#node#FindExecutable(b, 'markdown_remark_lint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'markdown_remark_lint', [ \ 'node_modules/.bin/remark', \ ])}, \ 'command': function('ale_linters#markdown#remark_lint#GetCommand'), diff --git a/ale_linters/php/intelephense.vim b/ale_linters/php/intelephense.vim index aca619e3..0fdcc93e 100755 --- a/ale_linters/php/intelephense.vim +++ b/ale_linters/php/intelephense.vim @@ -26,7 +26,7 @@ call ale#linter#Define('php', { \ 'name': 'intelephense', \ 'lsp': 'stdio', \ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_intelephense', [])}, +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_intelephense', [])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), \}) diff --git a/ale_linters/php/langserver.vim b/ale_linters/php/langserver.vim index fdd1bf2b..c3d89a00 100644 --- a/ale_linters/php/langserver.vim +++ b/ale_linters/php/langserver.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'langserver', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_langserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_langserver', [ \ 'vendor/bin/php-language-server.php', \ ])}, \ 'command': 'php %e', diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim index 3d88ad5d..ce47a13b 100644 --- a/ale_linters/php/phpcs.vim +++ b/ale_linters/php/phpcs.vim @@ -44,7 +44,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpcs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_phpcs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_phpcs', [ \ 'vendor/bin/phpcs', \ 'phpcs' \ ])}, diff --git a/ale_linters/php/psalm.vim b/ale_linters/php/psalm.vim index 286c8a96..dbbe9453 100644 --- a/ale_linters/php/psalm.vim +++ b/ale_linters/php/psalm.vim @@ -18,7 +18,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'psalm', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_psalm', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_psalm', [ \ 'vendor/bin/psalm', \ ])}, \ 'command': function('ale_linters#php#psalm#GetCommand'), diff --git a/ale_linters/php/tlint.vim b/ale_linters/php/tlint.vim index 6bba8def..80bdd1f6 100644 --- a/ale_linters/php/tlint.vim +++ b/ale_linters/php/tlint.vim @@ -20,7 +20,7 @@ function! ale_linters#php#tlint#GetProjectRoot(buffer) abort endfunction function! ale_linters#php#tlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_tlint', [ + return ale#path#FindExecutable(a:buffer, 'php_tlint', [ \ 'vendor/bin/tlint', \ 'tlint', \]) diff --git a/ale_linters/pug/puglint.vim b/ale_linters/pug/puglint.vim index c819cc45..b552cc06 100644 --- a/ale_linters/pug/puglint.vim +++ b/ale_linters/pug/puglint.vim @@ -47,7 +47,7 @@ endfunction call ale#linter#Define('pug', { \ 'name': 'puglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'pug_puglint', [ \ 'node_modules/.bin/pug-lint', \ ])}, \ 'output_stream': 'stderr', diff --git a/ale_linters/purescript/ls.vim b/ale_linters/purescript/ls.vim index 1c5f937f..a20fae47 100644 --- a/ale_linters/purescript/ls.vim +++ b/ale_linters/purescript/ls.vim @@ -6,7 +6,7 @@ call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0 call ale#Set('purescript_ls_config', {}) function! ale_linters#purescript#ls#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'purescript_ls', [ + return ale#path#FindExecutable(a:buffer, 'purescript_ls', [ \ 'node_modules/.bin/purescript-language-server', \]) endfunction diff --git a/ale_linters/sass/sasslint.vim b/ale_linters/sass/sasslint.vim index 17cd3667..ff396e68 100644 --- a/ale_linters/sass/sasslint.vim +++ b/ale_linters/sass/sasslint.vim @@ -5,7 +5,7 @@ call ale#Set('sass_sasslint_options', '') call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sass#sasslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [ + return ale#path#FindExecutable(a:buffer, 'sass_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/ale_linters/sass/stylelint.vim b/ale_linters/sass/stylelint.vim index 7b14c6b4..22abef9b 100644 --- a/ale_linters/sass/stylelint.vim +++ b/ale_linters/sass/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', call ale#linter#Define('sass', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sass_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': '%e --stdin-filename %s', diff --git a/ale_linters/scss/sasslint.vim b/ale_linters/scss/sasslint.vim index cf13546e..99027051 100644 --- a/ale_linters/scss/sasslint.vim +++ b/ale_linters/scss/sasslint.vim @@ -5,7 +5,7 @@ call ale#Set('scss_sasslint_options', '') call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#scss#sasslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [ + return ale#path#FindExecutable(a:buffer, 'scss_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/ale_linters/scss/stylelint.vim b/ale_linters/scss/stylelint.vim index b5b21536..fea4ea8f 100644 --- a/ale_linters/scss/stylelint.vim +++ b/ale_linters/scss/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('scss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'scss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#scss#stylelint#GetCommand'), diff --git a/ale_linters/sh/language_server.vim b/ale_linters/sh/language_server.vim index 5a3b0e9a..c6781584 100644 --- a/ale_linters/sh/language_server.vim +++ b/ale_linters/sh/language_server.vim @@ -6,7 +6,7 @@ call ale#Set('sh_language_server_executable', 'bash-language-server') call ale#Set('sh_language_server_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sh#language_server#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'sh_language_server', [ + return ale#path#FindExecutable(a:buffer, 'sh_language_server', [ \ 'node_modules/.bin/bash-language-server', \]) endfunction diff --git a/ale_linters/stylus/stylelint.vim b/ale_linters/stylus/stylelint.vim index ce6f9426..b60e38ed 100644 --- a/ale_linters/stylus/stylelint.vim +++ b/ale_linters/stylus/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('stylus', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'stylus_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#stylus#stylelint#GetCommand'), diff --git a/ale_linters/sugarss/stylelint.vim b/ale_linters/sugarss/stylelint.vim index 6c705e46..879ff0ca 100644 --- a/ale_linters/sugarss/stylelint.vim +++ b/ale_linters/sugarss/stylelint.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('sugarss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sugarss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#sugarss#stylelint#GetCommand'), diff --git a/ale_linters/svelte/svelteserver.vim b/ale_linters/svelte/svelteserver.vim index bcd10be8..2200b582 100644 --- a/ale_linters/svelte/svelteserver.vim +++ b/ale_linters/svelte/svelteserver.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('svelte', { \ 'name': 'svelteserver', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'svelte_svelteserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'svelte_svelteserver', [ \ 'node_modules/.bin/svelteserver', \ ])}, \ 'command': '%e --stdio', diff --git a/ale_linters/swift/swiftlint.vim b/ale_linters/swift/swiftlint.vim index 237c45d3..d08c68f6 100644 --- a/ale_linters/swift/swiftlint.vim +++ b/ale_linters/swift/swiftlint.vim @@ -5,7 +5,7 @@ call ale#Set('swift_swiftlint_executable', 'swiftlint') call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftlint', [ \ 'Pods/SwiftLint/swiftlint', \ 'ios/Pods/SwiftLint/swiftlint', \ 'swiftlint', diff --git a/ale_linters/typescript/standard.vim b/ale_linters/typescript/standard.vim index da8f14eb..1d524a10 100644 --- a/ale_linters/typescript/standard.vim +++ b/ale_linters/typescript/standard.vim @@ -6,7 +6,7 @@ call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('typescript_standard_options', '') function! ale_linters#typescript#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_standard', [ + return ale#path#FindExecutable(a:buffer, 'typescript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', diff --git a/ale_linters/typescript/tsserver.vim b/ale_linters/typescript/tsserver.vim index 4726e40d..d97becca 100644 --- a/ale_linters/typescript/tsserver.vim +++ b/ale_linters/typescript/tsserver.vim @@ -8,7 +8,7 @@ call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('typescript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'typescript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'typescript_tsserver', [ \ '.yarn/sdks/typescript/bin/tsserver', \ 'node_modules/.bin/tsserver', \ ])}, diff --git a/ale_linters/vim/vimls.vim b/ale_linters/vim/vimls.vim index 26014d66..7003eb04 100644 --- a/ale_linters/vim/vimls.vim +++ b/ale_linters/vim/vimls.vim @@ -52,7 +52,7 @@ call ale#linter#Define('vim', { \ 'name': 'vimls', \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')}, -\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'vim_vimls', [ \ 'node_modules/.bin/vim-language-server', \ ])}, \ 'command': '%e --stdio', diff --git a/ale_linters/vue/vls.vim b/ale_linters/vue/vls.vim index ac451f3c..4bd75286 100644 --- a/ale_linters/vue/vls.vim +++ b/ale_linters/vue/vls.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('vue', { \ 'name': 'vls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'vue_vls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [ \ 'node_modules/.bin/vls', \ ])}, \ 'command': '%e --stdio', diff --git a/ale_linters/yaml/spectral.vim b/ale_linters/yaml/spectral.vim index bd4623a5..13654f06 100644 --- a/ale_linters/yaml/spectral.vim +++ b/ale_linters/yaml/spectral.vim @@ -6,7 +6,7 @@ call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0 call ale#linter#Define('yaml', { \ 'name': 'spectral', -\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_spectral', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', diff --git a/ale_linters/yaml/swaglint.vim b/ale_linters/yaml/swaglint.vim index 1f140e37..7fc2b430 100644 --- a/ale_linters/yaml/swaglint.vim +++ b/ale_linters/yaml/swaglint.vim @@ -32,7 +32,7 @@ endfunction call ale#linter#Define('yaml', { \ 'name': 'swaglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_swaglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_swaglint', [ \ 'node_modules/.bin/swaglint', \ ])}, \ 'command': '%e -r compact --stdin', diff --git a/autoload/ale/fixers/buildifier.vim b/autoload/ale/fixers/buildifier.vim index b676068d..48103b2e 100644 --- a/autoload/ale/fixers/buildifier.vim +++ b/autoload/ale/fixers/buildifier.vim @@ -6,7 +6,7 @@ call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables' call ale#Set('bazel_buildifier_options', '') function! ale#fixers#buildifier#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'bazel_buildifier', [ + return ale#path#FindExecutable(a:buffer, 'bazel_buildifier', [ \ 'buildifier', \]) endfunction diff --git a/autoload/ale/fixers/clangformat.vim b/autoload/ale/fixers/clangformat.vim index ecff080a..81498ebd 100644 --- a/autoload/ale/fixers/clangformat.vim +++ b/autoload/ale/fixers/clangformat.vim @@ -9,7 +9,7 @@ call ale#Set('c_clangformat_style_option', '') call ale#Set('c_clangformat_use_local_file', 0) function! ale#fixers#clangformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'c_clangformat', [ + return ale#path#FindExecutable(a:buffer, 'c_clangformat', [ \ 'clang-format', \]) endfunction diff --git a/autoload/ale/fixers/elm_format.vim b/autoload/ale/fixers/elm_format.vim index cd2be2c3..a4740db4 100644 --- a/autoload/ale/fixers/elm_format.vim +++ b/autoload/ale/fixers/elm_format.vim @@ -6,7 +6,7 @@ call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('elm_format_options', '--yes') function! ale#fixers#elm_format#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'elm_format', [ + return ale#path#FindExecutable(a:buffer, 'elm_format', [ \ 'node_modules/.bin/elm-format', \]) endfunction diff --git a/autoload/ale/fixers/erlfmt.vim b/autoload/ale/fixers/erlfmt.vim index e44046f1..f9951e9d 100644 --- a/autoload/ale/fixers/erlfmt.vim +++ b/autoload/ale/fixers/erlfmt.vim @@ -6,7 +6,7 @@ call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0 call ale#Set('erlang_erlfmt_options', '') function! ale#fixers#erlfmt#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) + return ale#path#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) endfunction function! ale#fixers#erlfmt#Fix(buffer) abort diff --git a/autoload/ale/fixers/fixjson.vim b/autoload/ale/fixers/fixjson.vim index 33ce0af3..4bad8f9b 100644 --- a/autoload/ale/fixers/fixjson.vim +++ b/autoload/ale/fixers/fixjson.vim @@ -6,7 +6,7 @@ call ale#Set('json_fixjson_options', '') call ale#Set('json_fixjson_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#fixjson#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_fixjson', [ + return ale#path#FindExecutable(a:buffer, 'json_fixjson', [ \ 'node_modules/.bin/fixjson', \]) endfunction diff --git a/autoload/ale/fixers/php_cs_fixer.vim b/autoload/ale/fixers/php_cs_fixer.vim index 5c59e262..c8f9c7b0 100644 --- a/autoload/ale/fixers/php_cs_fixer.vim +++ b/autoload/ale/fixers/php_cs_fixer.vim @@ -6,7 +6,7 @@ call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0) call ale#Set('php_cs_fixer_options', '') function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [ + return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [ \ 'vendor/bin/php-cs-fixer', \ 'php-cs-fixer' \]) diff --git a/autoload/ale/fixers/phpcbf.vim b/autoload/ale/fixers/phpcbf.vim index 0a61c657..494bf346 100644 --- a/autoload/ale/fixers/phpcbf.vim +++ b/autoload/ale/fixers/phpcbf.vim @@ -7,7 +7,7 @@ call ale#Set('php_phpcbf_executable', 'phpcbf') call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#phpcbf#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [ + return ale#path#FindExecutable(a:buffer, 'php_phpcbf', [ \ 'vendor/bin/phpcbf', \ 'phpcbf' \]) diff --git a/autoload/ale/fixers/prettier.vim b/autoload/ale/fixers/prettier.vim index a080d880..8a67e2ff 100644 --- a/autoload/ale/fixers/prettier.vim +++ b/autoload/ale/fixers/prettier.vim @@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_prettier_options', '') function! ale#fixers#prettier#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [ \ 'node_modules/.bin/prettier_d', \ 'node_modules/prettier-cli/index.js', \ 'node_modules/.bin/prettier', diff --git a/autoload/ale/fixers/prettier_eslint.vim b/autoload/ale/fixers/prettier_eslint.vim index 09fadd71..0b9c88b7 100644 --- a/autoload/ale/fixers/prettier_eslint.vim +++ b/autoload/ale/fixers/prettier_eslint.vim @@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_ex call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ \ 'node_modules/prettier-eslint-cli/dist/index.js', \ 'node_modules/.bin/prettier-eslint', \]) diff --git a/autoload/ale/fixers/prettier_standard.vim b/autoload/ale/fixers/prettier_standard.vim index 9d982ff6..c8c09e31 100644 --- a/autoload/ale/fixers/prettier_standard.vim +++ b/autoload/ale/fixers/prettier_standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_prettier_standard_use_global', get(g:, 'ale_use_global_ call ale#Set('javascript_prettier_standard_options', '') function! ale#fixers#prettier_standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_standard', [ \ 'node_modules/prettier-standard/lib/index.js', \ 'node_modules/.bin/prettier-standard', \]) diff --git a/autoload/ale/fixers/remark_lint.vim b/autoload/ale/fixers/remark_lint.vim index 3ce442f3..85593b44 100644 --- a/autoload/ale/fixers/remark_lint.vim +++ b/autoload/ale/fixers/remark_lint.vim @@ -6,7 +6,7 @@ call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executab call ale#Set('markdown_remark_lint_options', '') function! ale#fixers#remark_lint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [ + return ale#path#FindExecutable(a:buffer, 'markdown_remark_lint', [ \ 'node_modules/remark-cli/cli.js', \ 'node_modules/.bin/remark', \]) diff --git a/autoload/ale/fixers/standard.vim b/autoload/ale/fixers/standard.vim index 46decebf..b9d60ebb 100644 --- a/autoload/ale/fixers/standard.vim +++ b/autoload/ale/fixers/standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale#fixers#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', diff --git a/autoload/ale/fixers/stylelint.vim b/autoload/ale/fixers/stylelint.vim index da067198..650b9c4a 100644 --- a/autoload/ale/fixers/stylelint.vim +++ b/autoload/ale/fixers/stylelint.vim @@ -6,7 +6,7 @@ call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('stylelint_options', '') function! ale#fixers#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'stylelint', [ + return ale#path#FindExecutable(a:buffer, 'stylelint', [ \ 'node_modules/stylelint/bin/stylelint.js', \ 'node_modules/.bin/stylelint', \]) diff --git a/autoload/ale/fixers/swiftformat.vim b/autoload/ale/fixers/swiftformat.vim index 304182b2..cc553b7d 100644 --- a/autoload/ale/fixers/swiftformat.vim +++ b/autoload/ale/fixers/swiftformat.vim @@ -6,7 +6,7 @@ call ale#Set('swift_swiftformat_use_global', get(g:, 'ale_use_global_executables call ale#Set('swift_swiftformat_options', '') function! ale#fixers#swiftformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftformat', [ \ 'Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'swiftformat', diff --git a/autoload/ale/fixers/tidy.vim b/autoload/ale/fixers/tidy.vim index 1af4120b..2c79e73a 100644 --- a/autoload/ale/fixers/tidy.vim +++ b/autoload/ale/fixers/tidy.vim @@ -5,7 +5,7 @@ call ale#Set('html_tidy_executable', 'tidy') call ale#Set('html_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#tidy#Fix(buffer) abort - let l:executable = ale#node#FindExecutable( + let l:executable = ale#path#FindExecutable( \ a:buffer, \ 'html_tidy', \ ['tidy'], diff --git a/autoload/ale/handlers/alex.vim b/autoload/ale/handlers/alex.vim index 190a7f86..6ef4867f 100644 --- a/autoload/ale/handlers/alex.vim +++ b/autoload/ale/handlers/alex.vim @@ -3,7 +3,7 @@ scriptencoding utf-8 " Description: Error handling for errors in alex output format function! ale#handlers#alex#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'alex', [ + return ale#path#FindExecutable(a:buffer, 'alex', [ \ 'node_modules/.bin/alex', \ 'node_modules/alex/cli.js', \]) diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim index e953d40f..7c492968 100644 --- a/autoload/ale/handlers/eslint.vim +++ b/autoload/ale/handlers/eslint.vim @@ -36,7 +36,7 @@ function! ale#handlers#eslint#FindConfig(buffer) abort endfunction function! ale#handlers#eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables) + return ale#path#FindExecutable(a:buffer, 'javascript_eslint', s:executables) endfunction " Given a buffer, return an appropriate working directory for ESLint. @@ -49,7 +49,7 @@ function! ale#handlers#eslint#GetCwd(buffer) abort " If eslint is installed in a directory which contains the buffer, assume " it is the ESLint project root. Otherwise, use nearest node_modules. " Note: If node_modules not present yet, can't load local deps anyway. - let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) if !empty(l:executable) let l:nmi = strridx(l:executable, 'node_modules') diff --git a/autoload/ale/handlers/fecs.vim b/autoload/ale/handlers/fecs.vim index 5362edb9..064b927e 100644 --- a/autoload/ale/handlers/fecs.vim +++ b/autoload/ale/handlers/fecs.vim @@ -9,7 +9,7 @@ function! ale#handlers#fecs#GetCommand(buffer) abort endfunction function! ale#handlers#fecs#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_fecs', [ + return ale#path#FindExecutable(a:buffer, 'javascript_fecs', [ \ 'node_modules/.bin/fecs', \ 'node_modules/fecs/bin/fecs', \]) diff --git a/autoload/ale/handlers/ols.vim b/autoload/ale/handlers/ols.vim index 74130a26..c292c6d9 100644 --- a/autoload/ale/handlers/ols.vim +++ b/autoload/ale/handlers/ols.vim @@ -4,7 +4,7 @@ function! ale#handlers#ols#GetExecutable(buffer) abort let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' - return ale#node#FindExecutable(a:buffer, l:ols_setting, [ + return ale#path#FindExecutable(a:buffer, l:ols_setting, [ \ 'node_modules/.bin/ocaml-language-server', \]) endfunction diff --git a/autoload/ale/handlers/solhint.vim b/autoload/ale/handlers/solhint.vim index 61ab2a60..611aa7bd 100644 --- a/autoload/ale/handlers/solhint.vim +++ b/autoload/ale/handlers/solhint.vim @@ -66,7 +66,7 @@ function! ale#handlers#solhint#FindConfig(buffer) abort endfunction function! ale#handlers#solhint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'solidity_solhint', s:executables) + return ale#path#FindExecutable(a:buffer, 'solidity_solhint', s:executables) endfunction " Given a buffer, return an appropriate working directory for solhint. @@ -74,7 +74,7 @@ function! ale#handlers#solhint#GetCwd(buffer) abort " If solhint is installed in a directory which contains the buffer, assume " it is the solhint project root. Otherwise, use nearest node_modules. " Note: If node_modules not present yet, can't load local deps anyway. - let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) if !empty(l:executable) let l:nmi = strridx(l:executable, 'node_modules') diff --git a/autoload/ale/handlers/textlint.vim b/autoload/ale/handlers/textlint.vim index 6d495b0d..7a648617 100644 --- a/autoload/ale/handlers/textlint.vim +++ b/autoload/ale/handlers/textlint.vim @@ -6,7 +6,7 @@ call ale#Set('textlint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('textlint_options', '') function! ale#handlers#textlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'textlint', [ + return ale#path#FindExecutable(a:buffer, 'textlint', [ \ 'node_modules/.bin/textlint', \ 'node_modules/textlint/bin/textlint.js', \]) diff --git a/autoload/ale/handlers/tslint.vim b/autoload/ale/handlers/tslint.vim index 90579344..ee091d24 100644 --- a/autoload/ale/handlers/tslint.vim +++ b/autoload/ale/handlers/tslint.vim @@ -7,7 +7,7 @@ function! ale#handlers#tslint#InitVariables() abort endfunction function! ale#handlers#tslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [ + return ale#path#FindExecutable(a:buffer, 'typescript_tslint', [ \ 'node_modules/.bin/tslint', \]) endfunction diff --git a/autoload/ale/handlers/writegood.vim b/autoload/ale/handlers/writegood.vim index 8ae61a38..b5b91b3f 100644 --- a/autoload/ale/handlers/writegood.vim +++ b/autoload/ale/handlers/writegood.vim @@ -11,7 +11,7 @@ endfunction call ale#handlers#writegood#ResetOptions() function! ale#handlers#writegood#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'writegood', [ + return ale#path#FindExecutable(a:buffer, 'writegood', [ \ 'node_modules/.bin/write-good', \ 'node_modules/write-good/bin/write-good.js', \]) diff --git a/autoload/ale/handlers/xo.vim b/autoload/ale/handlers/xo.vim index c63278c0..a87c6d8f 100644 --- a/autoload/ale/handlers/xo.vim +++ b/autoload/ale/handlers/xo.vim @@ -9,7 +9,7 @@ call ale#Set('typescript_xo_options', '') function! ale#handlers#xo#GetExecutable(buffer) abort let l:type = ale#handlers#xo#GetType(a:buffer) - return ale#node#FindExecutable(a:buffer, l:type . '_xo', [ + return ale#path#FindExecutable(a:buffer, l:type . '_xo', [ \ 'node_modules/xo/cli.js', \ 'node_modules/.bin/xo', \]) diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index d26b9443..cbc79064 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -41,7 +41,7 @@ let s:default_ale_linters = { \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], -\ 'go': ['gofmt', 'golint', 'go vet'], +\ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], diff --git a/autoload/ale/node.vim b/autoload/ale/node.vim index 9b9b335a..9e11ca7e 100644 --- a/autoload/ale/node.vim +++ b/autoload/ale/node.vim @@ -3,38 +3,6 @@ call ale#Set('windows_node_executable_path', 'node.exe') -" Given a buffer number, a base variable name, and a list of paths to search -" for in ancestor directories, detect the executable path for a Node program. -" -" The use_global and executable options for the relevant program will be used. -function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort - if ale#Var(a:buffer, a:base_var_name . '_use_global') - return ale#Var(a:buffer, a:base_var_name . '_executable') - endif - - let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list) - - if !empty(l:nearest) - return l:nearest - endif - - return ale#Var(a:buffer, a:base_var_name . '_executable') -endfunction - -" Given a buffer number, a base variable name, and a list of paths to search -" for in ancestor directories, detect the executable path for a Node program. -function! ale#node#FindNearestExecutable(buffer, path_list) abort - for l:path in a:path_list - let l:executable = ale#path#FindNearestFile(a:buffer, l:path) - - if !empty(l:executable) - return l:executable - endif - endfor - - return '' -endfunction - " Create a executable string which executes a Node.js script command with a " Node.js executable if needed. " diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim index 00e31310..c7bfd47e 100644 --- a/autoload/ale/path.vim +++ b/autoload/ale/path.vim @@ -77,6 +77,42 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor return l:path endfunction +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +function! ale#path#FindNearestExecutable(buffer, path_list) abort + for l:path in a:path_list + if ale#path#IsAbsolute(l:path) + let l:executable = filereadable(l:path) ? l:path : '' + else + let l:executable = ale#path#FindNearestFile(a:buffer, l:path) + endif + + if !empty(l:executable) + return l:executable + endif + endfor + + return '' +endfunction + +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +" +" The use_global and executable options for the relevant program will be used. +function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort + if ale#Var(a:buffer, a:base_var_name . '_use_global') + return ale#Var(a:buffer, a:base_var_name . '_executable') + endif + + let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list) + + if !empty(l:nearest) + return l:nearest + endif + + return ale#Var(a:buffer, a:base_var_name . '_executable') +endfunction + " Return 1 if a path is an absolute path. function! ale#path#IsAbsolute(filename) abort if has('win32') && a:filename[:0] is# '\' diff --git a/doc/ale-go.txt b/doc/ale-go.txt index 8364fd5b..e2616a62 100644 --- a/doc/ale-go.txt +++ b/doc/ale-go.txt @@ -194,12 +194,30 @@ g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package* =============================================================================== gopls *ale-go-gopls* +gopls is the official Go language server, and is enabled for use with ALE by +default. + +To install the latest stable version of `gopls` to your `$GOPATH`, try the +following command: > + + GO111MODULE=on go get golang.org/x/tools/gopls@latest +< +If `$GOPATH` is readable by ALE, it should probably work without you having to +do anything else. See the `gopls` README file for more information: + +https://github.com/golang/tools/blob/master/gopls/README.md + + g:ale_go_gopls_executable *g:ale_go_gopls_executable* *b:ale_go_gopls_executable* Type: |String| Default: `'gopls'` - Location of the gopls binary file. + See |ale-integrations-local-executables| + + ALE will search for `gopls` in locally installed directories first by + default, and fall back on a globally installed `gopls` if it can't be found + otherwise. g:ale_go_gopls_options *g:ale_go_gopls_options* @@ -229,6 +247,15 @@ g:ale_go_gopls_init_options *g:ale_go_gopls_init_options* For a full list of supported analyzers, see: https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md + +g:ale_go_gopls_use_global *g:ale_go_gopls_use_global* + *b:ale_go_gopls_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== govet *ale-go-govet* diff --git a/doc/ale.txt b/doc/ale.txt index 96069d5a..b7059af9 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -1580,7 +1580,7 @@ g:ale_linters *g:ale_linters* \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], - \ 'go': ['gofmt', 'golint', 'go vet'], + \ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], diff --git a/supported-tools.md b/supported-tools.md index ce408936..0f33006b 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -192,7 +192,7 @@ formatting. * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: - * [gopls](https://github.com/golang/go/wiki/gopls) :warning: + * [gopls](https://github.com/golang/go/wiki/gopls) * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: diff --git a/test/linter/test_gopls.vader b/test/linter/test_gopls.vader index 0f1558e9..1c91fa10 100644 --- a/test/linter/test_gopls.vader +++ b/test/linter/test_gopls.vader @@ -1,5 +1,8 @@ Before: Save g:ale_go_go111module + Save $GOPATH + + let $GOPATH = '/non/existent/directory' call ale#assert#SetUpLinterTest('go', 'gopls') @@ -14,16 +17,32 @@ After: call ale#assert#TearDownLinterTest() -Execute(should set correct defaults): +Execute(The default command should be correct): AssertLinter 'gopls', ale#Escape('gopls') . ' --mode stdio' -Execute(should configure gopls callback executable): +Execute(The executable should be configurable): let b:ale_go_gopls_executable = 'boo' - let b:ale_go_gopls_options = '' - AssertLinter 'boo', ale#Escape('boo') + AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio' + +Execute(gopls should be found in GOPATH): + " This is a directory with a fake executable + let $GOPATH = ale#test#GetFilename('../test-files/go/gopath') + + AssertLinter + \ ale#test#GetFilename('../test-files/go/gopath/bin/gopls'), + \ ale#Escape(ale#test#GetFilename('../test-files/go/gopath/bin/gopls')) + \ . ' --mode stdio' + +Execute(Global settings should be preferre for gopls if use_global = 1): + " This is a directory with a fake executable + let $GOPATH = ale#test#GetFilename('../test-files/go/gopath') + let b:ale_go_gopls_executable = 'boo' + let b:ale_go_gopls_use_global = 1 + + AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio' -Execute(should set gopls options): +Execute(Settings options should work): call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') " let b:ale_completion_enabled = 1 let b:ale_go_gopls_options = '' @@ -39,18 +58,18 @@ Execute(should set gopls options): let b:ale_go_gopls_init_options = {'ui.diagnostic.analyses': {'composites': v:false}} AssertLSPOptions {'ui.diagnostic.analyses': {'composites': v:false}} -Execute(should support go environment variables): +Execute(Go environment variables should be passed on): let b:ale_go_go111module = 'off' AssertLinter 'gopls', \ ale#Env('GO111MODULE', 'off') . ale#Escape('gopls') . ' --mode stdio' -Execute(Should return directory for 'go.mod' if found in parent directory): +Execute(Project directories should be detected based on 'go.mod' being present): call ale#test#SetFilename('../test-files/go/test.go') AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go') -Execute(Should return nearest directory with '.git' if found in parent directory): +Execute(Project directories with .git should be detected): call ale#test#SetFilename('test.go') if !isdirectory(g:dir . '/.git') @@ -59,7 +78,7 @@ Execute(Should return nearest directory with '.git' if found in parent directory AssertLSPProject g:dir -Execute(Should ignore 'go.mod' and return '.git' dir if modules off): +Execute('go.mod' should be ignored if modules are off): call ale#test#SetFilename('../test-files/go/test.go') let b:ale_go_go111module = 'off' diff --git a/test/test-files/go/gopath/bin/gopls b/test/test-files/go/gopath/bin/gopls new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test-files/go/gopath/bin/gopls diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader index d4e708ec..419800de 100644 --- a/test/test_filetype_linter_defaults.vader +++ b/test/test_filetype_linter_defaults.vader @@ -22,7 +22,7 @@ Execute(The defaults for the csh filetype should be correct): AssertEqual [], GetLinterNames('csh') Execute(The defaults for the go filetype should be correct): - AssertEqual ['gofmt', 'golint', 'govet'], GetLinterNames('go') + AssertEqual ['gofmt', 'golint', 'gopls', 'govet'], GetLinterNames('go') let g:ale_linters_explicit = 1 |