1
0
Fork 0
mirror of synced 2024-11-22 00:35:35 -05:00

Update the plugins

This commit is contained in:
Rob Loach 2024-09-19 00:58:15 -04:00
parent ee7e062909
commit 22cf44758f
No known key found for this signature in database
GPG key ID: 627C60834A74A21A
197 changed files with 306893 additions and 203607 deletions

View file

@ -0,0 +1,11 @@
" Author: Hyuksang Kwon <gwonhyuksang@gmail.com>
" Description: eslint for astro files
call ale#linter#Define('astro', {
\ 'name': 'eslint',
\ 'output_stream': 'both',
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\})

View file

@ -15,7 +15,7 @@ function! ale_linters#cmake#cmake_lint#Command(buffer) abort
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
return ale#Escape(l:executable) . ' ' . l:options . ' %s'
endfunction
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort

View file

@ -11,6 +11,7 @@ endfunction
call ale#linter#Define('css', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -1,6 +1,7 @@
" Author: Nelson Yeung <nelsyeung@gmail.com>
" Description: Check Dart files with dart analysis server LSP
call ale#Set('dart_analysis_server_enable_language_server', 1)
call ale#Set('dart_analysis_server_executable', 'dart')
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
@ -12,12 +13,19 @@ function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
endfunction
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server')
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
let l:dart = resolve(exepath(l:executable))
return '%e '
let l:output = '%e '
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
\ . ' --lsp'
" Enable new language-server command
if l:language_server == 1
let l:output = '%e language-server --protocol=lsp'
endif
return l:output
endfunction
call ale#linter#Define('dart', {

View file

@ -16,7 +16,7 @@ function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
endfunction
function! ale_linters#elm#ls#GetOptions(buffer) abort
function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort
return {
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
@ -37,5 +37,5 @@ call ale#linter#Define('elm', {
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
\ 'language': 'elm',
\ 'initialization_options': function('elm_ls#GetOptions')
\ 'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions')
\})

View file

@ -26,9 +26,27 @@ function! s:AbbreviateMessage(text) abort
endfunction
function! s:GetCommand(buffer) abort
let l:file = ale#Escape(expand('#' . a:buffer . ':.'))
let l:cwd = s:GetCwd(a:buffer)
return '%e rock --output-format=parsable ' . l:file
let l:file = !empty(l:cwd)
\ ? expand('#' . a:buffer . ':p')[len(l:cwd) + 1:]
\ : expand('#' . a:buffer . ':.')
return '%e rock --output-format=parsable ' . ale#Escape(l:file)
endfunction
function! s:GetCwd(buffer) abort
let l:markers = ['elvis.config', 'rebar.lock', 'erlang.mk']
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:marker in l:markers
if filereadable(l:path . '/' . l:marker)
return l:path
endif
endfor
endfor
return ''
endfunction
call ale#linter#Define('erlang', {
@ -36,5 +54,6 @@ call ale#linter#Define('erlang', {
\ 'callback': 'ale_linters#erlang#elvis#Handle',
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')},
\ 'command': function('s:GetCommand'),
\ 'cwd': function('s:GetCwd'),
\ 'lint_file': 1,
\})

View file

@ -21,7 +21,14 @@ function! s:GetCommand(buffer) abort
endfunction
function! s:FindProjectRoot(buffer) abort
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
let l:markers = [
\ '_checkouts/',
\ '_build/',
\ 'deps/',
\ 'erlang_ls.config',
\ 'rebar.lock',
\ 'erlang.mk',
\]
" This is a way to find Erlang/OTP root (the one that is managed
" by kerl or asdf). Useful if :ALEGoToDefinition takes us there.

View file

@ -3,29 +3,13 @@
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable')
return ale#command#Run(
\ a:buffer,
\ ale#Escape(l:executable) . ' -h',
\ function('ale_linters#erlang#syntaxerl#GetCommand'),
\)
endfunction
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
endfunction
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
let l:loclist = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:loclist, {
\ 'lnum': l:match[1] + 0,
\ 'lnum': str2nr(l:match[1]),
\ 'text': l:match[3],
\ 'type': empty(l:match[2]) ? 'E' : 'W',
\})
@ -34,9 +18,27 @@ function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
return l:loclist
endfunction
function! s:GetExecutable(buffer) abort
return ale#Var(a:buffer, 'erlang_syntaxerl_executable')
endfunction
function! s:GetCommand(buffer) abort
let l:Callback = function('s:GetCommandFromHelpOutput')
return ale#command#Run(a:buffer, '%e -h', l:Callback, {
\ 'executable': s:GetExecutable(a:buffer),
\})
endfunction
function! s:GetCommandFromHelpOutput(buffer, output, metadata) abort
let l:has_b_option = match(a:output, '\V\C-b, --base\>') > -1
return l:has_b_option ? '%e -b %s %t' : '%e %t'
endfunction
call ale#linter#Define('erlang', {
\ 'name': 'syntaxerl',
\ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')},
\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)},
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
\ 'executable': function('s:GetExecutable'),
\ 'command': function('s:GetCommand'),
\})

View file

@ -0,0 +1,6 @@
" Author: Sam Saffron <sam.saffron@gmail.com>
" Description: Ember-template-lint for checking GJS (Glimmer JS) files
scriptencoding utf-8
call ale#handlers#embertemplatelint#DefineLinter('glimmer')

View file

@ -3,7 +3,7 @@
call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 0)
call ale#Set('go_golangci_lint_package', 1)
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
let l:filename = expand('#' . a:buffer . ':t')

View file

@ -1,62 +1,6 @@
" Author: Adrian Zalewski <aazalewski@hotmail.com>
" Description: Ember-template-lint for checking Handlebars files
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
scriptencoding utf-8
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
\ 'node_modules/.bin/ember-template-lint',
\])
endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
if ale#semver#GTE(a:version, [4, 0, 0])
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
return '%e --format=json --filename %s'
endif
return '%e --json --filename %s'
endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
\ '%e --version',
\ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
\)
endfunction
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
for l:error in get(values(l:json), 0, [])
if has_key(l:error, 'fatal')
call add(l:output, {
\ 'lnum': get(l:error, 'line', 1),
\ 'col': get(l:error, 'column', 1),
\ 'text': l:error.message,
\ 'type': l:error.severity == 1 ? 'W' : 'E',
\})
else
call add(l:output, {
\ 'lnum': l:error.line,
\ 'col': l:error.column,
\ 'text': l:error.rule . ': ' . l:error.message,
\ 'type': l:error.severity == 1 ? 'W' : 'E',
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('handlebars', {
\ 'name': 'embertemplatelint',
\ 'aliases': ['ember-template-lint'],
\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'),
\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'),
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
\})
call ale#handlers#embertemplatelint#DefineLinter('handlebars')

View file

@ -21,6 +21,7 @@ endfunction
call ale#linter#Define('html', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': function('ale_linters#html#stylelint#GetExecutable'),
\ 'command': function('ale_linters#html#stylelint#GetCommand'),
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',

View file

@ -0,0 +1,69 @@
" Description: Hurl linter using hurlfmt --check.
" https://hurl.dev/
call ale#Set('hurl_hurlfmt_executable', 'hurlfmt')
function! ale_linters#hurl#hurlfmt#GetCommand(buffer) abort
return '%e'
\ . ' --check --no-color '
endfunction
function! ale_linters#hurl#hurlfmt#HandleOutput(buffer, lines) abort
" Matches patterns:
"
" error: Parsing space
" --> test.hurl:11:48
" |
" 8 | header "Content-Type"= "application/json; charset=utf-8"
" | ^ expecting a space
" |
"
" error: Parsing URL
" --> test.hurl:11:48
" |
" 11 | PUT https://jsonplaceholder.typicode.com/posts/{post_id}}
" | ^ illegal character <{>
" |
"
" Note: hurlfmt seems to report always the first error only so we assume
" there is only one error to make parsing easier.
let l:output = []
if empty(a:lines)
return l:output
endif
let l:pattern = '\v(error|warning): (.+) --\> (.+):(\d+):(\d+) .+ \^ (.+) |'
let l:lines = join(a:lines, ' ')
for l:match in ale#util#GetMatches(l:lines, l:pattern)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': match[4] + 0,
\ 'col': match[5] + 0,
\ 'end_col': match[5] + 0,
\ 'text': match[2] . ' : ' . match[6],
\ 'type': (match[1] is# 'error') ? 'E' : 'W'
\})
endfor
return l:output
endfunction
function! ale_linters#hurl#hurlfmt#GetType(severity) abort
if a:severity is? 'convention'
\|| a:severity is? 'warning'
\|| a:severity is? 'refactor'
return 'W'
endif
return 'E'
endfunction
call ale#linter#Define('hurl', {
\ 'name': 'hurlfmt',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'hurl_hurlfmt_executable')},
\ 'command': function('ale_linters#hurl#hurlfmt#GetCommand'),
\ 'callback': 'ale_linters#hurl#hurlfmt#HandleOutput',
\})

View file

@ -0,0 +1,11 @@
" Author: Filip Gospodinov <f@gospodinov.ch>
" Description: biome for JavaScript files
call ale#linter#Define('javascript', {
\ 'name': 'biome',
\ 'lsp': 'stdio',
\ 'language': function('ale#handlers#biome#GetLanguage'),
\ 'executable': function('ale#handlers#biome#GetExecutable'),
\ 'command': '%e lsp-proxy',
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
\})

View file

@ -0,0 +1,10 @@
" Description: biome for json files
call ale#linter#Define('json', {
\ 'name': 'biome',
\ 'lsp': 'stdio',
\ 'language': function('ale#handlers#biome#GetLanguage'),
\ 'executable': function('ale#handlers#biome#GetExecutable'),
\ 'command': '%e lsp-proxy',
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
\})

View file

@ -0,0 +1,10 @@
" Description: biome for jsonc files
call ale#linter#Define('jsonc', {
\ 'name': 'biome',
\ 'lsp': 'stdio',
\ 'language': function('ale#handlers#biome#GetLanguage'),
\ 'executable': function('ale#handlers#biome#GetExecutable'),
\ 'command': '%e lsp-proxy',
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
\})

View file

@ -12,6 +12,7 @@ endfunction
call ale#linter#Define('less', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -0,0 +1,19 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Odin.
function! ale_linters#odin#ols#GetProjectRoot(buffer) abort
return fnamemodify('', ':h')
endfunction
call ale#Set('odin_ols_executable', 'ols')
call ale#Set('odin_ols_config', {})
call ale#linter#Define('odin', {
\ 'name': 'ols',
\ 'lsp': 'stdio',
\ 'language': 'odin',
\ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')},
\ 'executable': {b -> ale#Var(b, 'odin_ols_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'),
\})

View file

@ -57,13 +57,15 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
return l:output
endif
for l:err in l:res.files[expand('#' . a:buffer .':p')].messages
for l:key in keys(l:res.files)
for l:err in l:res.files[l:key].messages
call add(l:output, {
\ 'lnum': l:err.line,
\ 'text': l:err.message,
\ 'type': 'E',
\})
endfor
endfor
return l:output
endfunction

View file

@ -7,6 +7,7 @@ call ale#Set('python_bandit_use_config', 1)
call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_bandit_auto_pipenv', 0)
call ale#Set('python_bandit_auto_poetry', 0)
call ale#Set('python_bandit_auto_uv', 0)
function! ale_linters#python#bandit#GetExecutable(buffer) abort
if (
@ -23,6 +24,11 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_bandit_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
endfunction
@ -39,7 +45,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
endif
endif
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run bandit'
\ : ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_flake8_change_directory', 'project')
call ale#Set('python_flake8_auto_pipenv', 0)
call ale#Set('python_flake8_auto_poetry', 0)
call ale#Set('python_flake8_auto_uv', 0)
function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
@ -23,6 +24,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flake8_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
endif
@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flake8#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run flake8'
\ : ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables'
call ale#Set('python_flakehell_change_directory', 'project')
call ale#Set('python_flakehell_auto_pipenv', 0)
call ale#Set('python_flakehell_auto_poetry', 0)
call ale#Set('python_flakehell_auto_uv', 0)
function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
@ -23,6 +24,11 @@ function! ale_linters#python#flakehell#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flakehell_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
endif
@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
if (l:executable =~? 'pipenv\|poetry$')
if (l:executable =~? 'pipenv\|poetry\|uv$')
let l:exec_args = ' run flakehell'
elseif (l:executable is? 'python')
let l:exec_args = ' -m flakehell'

View file

@ -4,6 +4,8 @@
call ale#Set('python_jedils_executable', 'jedi-language-server')
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_jedils_auto_pipenv', 0)
call ale#Set('python_jedils_auto_poetry', 0)
call ale#Set('python_jedils_auto_uv', 0)
function! ale_linters#python#jedils#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv'))
@ -11,12 +13,22 @@ function! ale_linters#python#jedils#GetExecutable(buffer) abort
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_jedils_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_jedils_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run jedi-language-server'
\ : ''
let l:env_string = ''

View file

@ -8,6 +8,7 @@ call ale#Set('python_mypy_options', '')
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_mypy_auto_pipenv', 0)
call ale#Set('python_mypy_auto_poetry', 0)
call ale#Set('python_mypy_auto_uv', 0)
function! ale_linters#python#mypy#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv'))
@ -20,6 +21,11 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_mypy_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
endfunction
@ -43,7 +49,7 @@ endfunction
function! ale_linters#python#mypy#GetCommand(buffer) abort
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run mypy'
\ : ''

View file

@ -3,6 +3,7 @@
call ale#Set('python_prospector_auto_pipenv', 0)
call ale#Set('python_prospector_auto_poetry', 0)
call ale#Set('python_prospector_auto_uv', 0)
let g:ale_python_prospector_executable =
\ get(g:, 'ale_python_prospector_executable', 'prospector')
@ -23,13 +24,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_prospector_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
endfunction
function! ale_linters#python#prospector#GetCommand(buffer) abort
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run prospector'
\ : ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '')
function! ale_linters#python#pycln#GetExecutable(buffer) abort
@ -20,6 +21,11 @@ function! ale_linters#python#pycln#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
@ -36,7 +42,7 @@ endfunction
function! ale_linters#python#pycln#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycln'
\ : ''

View file

@ -6,6 +6,7 @@ call ale#Set('python_pycodestyle_options', '')
call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pycodestyle_auto_pipenv', 0)
call ale#Set('python_pycodestyle_auto_poetry', 0)
call ale#Set('python_pycodestyle_auto_uv', 0)
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv'))
@ -18,13 +19,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycodestyle_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
endfunction
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycodestyle'
\ : ''

View file

@ -6,6 +6,7 @@ call ale#Set('python_pydocstyle_options', '')
call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pydocstyle_auto_pipenv', 0)
call ale#Set('python_pydocstyle_auto_poetry', 0)
call ale#Set('python_pydocstyle_auto_uv', 0)
function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
@ -18,12 +19,17 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pydocstyle_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pydocstyle'
\ : ''

View file

@ -5,6 +5,7 @@ call ale#Set('python_pyflakes_executable', 'pyflakes')
call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyflakes_auto_pipenv', 0)
call ale#Set('python_pyflakes_auto_poetry', 0)
call ale#Set('python_pyflakes_auto_uv', 0)
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv'))
@ -17,13 +18,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
endfunction
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pyflakes'
\ : ''

View file

@ -6,6 +6,7 @@ call ale#Set('python_pylama_options', '')
call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylama_auto_pipenv', 0)
call ale#Set('python_pylama_auto_poetry', 0)
call ale#Set('python_pylama_auto_uv', 0)
call ale#Set('python_pylama_change_directory', 1)
function! ale_linters#python#pylama#GetExecutable(buffer) abort
@ -19,12 +20,17 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylama_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
endfunction
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylama'
\ : ''
@ -53,7 +59,7 @@ endfunction
function! ale_linters#python#pylama#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylama'
\ : ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_pylint_change_directory', 1)
call ale#Set('python_pylint_auto_pipenv', 0)
call ale#Set('python_pylint_auto_poetry', 0)
call ale#Set('python_pylint_auto_uv', 0)
call ale#Set('python_pylint_use_msg_id', 0)
function! ale_linters#python#pylint#GetExecutable(buffer) abort
@ -20,6 +21,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylint_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction
@ -38,7 +44,7 @@ endfunction
function! ale_linters#python#pylint#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylint'
\ : ''

View file

@ -6,6 +6,7 @@ call ale#Set('python_pylsp_options', '')
call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylsp_auto_pipenv', 0)
call ale#Set('python_pylsp_auto_poetry', 0)
call ale#Set('python_pylsp_auto_uv', 0)
call ale#Set('python_pylsp_config', {})
function! ale_linters#python#pylsp#GetExecutable(buffer) abort
@ -19,6 +20,11 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylsp_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
endfunction
@ -37,7 +43,7 @@ endfunction
function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylsp'
\ : ''
let l:env_string = ''

View file

@ -5,6 +5,7 @@ call ale#Set('python_pyre_executable', 'pyre')
call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyre_auto_pipenv', 0)
call ale#Set('python_pyre_auto_poetry', 0)
call ale#Set('python_pyre_auto_uv', 0)
function! ale_linters#python#pyre#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv'))
@ -17,12 +18,17 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyre_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
endfunction
function! ale_linters#python#pyre#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent'
let l:exec_args = (l:executable =~? 'pipenv\|poetry\|uv$' ? ' run pyre' : '') . ' persistent'
return ale#Escape(l:executable) . l:exec_args
endfunction

View file

@ -3,6 +3,7 @@ call ale#Set('python_pyright_executable', 'pyright-langserver')
call ale#Set('python_pyright_config', {})
call ale#Set('python_pyright_auto_pipenv', 0)
call ale#Set('python_pyright_auto_poetry', 0)
call ale#Set('python_pyright_auto_uv', 0)
" Force the cwd of the server to be the same as the project root to
" fix issues with treating local files matching first or third party library
@ -59,12 +60,17 @@ function! ale_linters#python#pyright#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyright_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pyright-langserver'
\ : ''
let l:env_string = ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_refurb_change_directory', 1)
call ale#Set('python_refurb_auto_pipenv', 0)
call ale#Set('python_refurb_auto_poetry', 0)
call ale#Set('python_refurb_auto_uv', 0)
function! ale_linters#python#refurb#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv'))
@ -19,6 +20,11 @@ function! ale_linters#python#refurb#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_refurb_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
endfunction
@ -35,7 +41,7 @@ endfunction
function! ale_linters#python#refurb#GetCommand(buffer) abort
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run refurb'
\ : ''

View file

@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_ruff_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0)
call ale#Set('python_ruff_auto_uv', 0)
call ale#fix#registry#Add('ruff',
\ 'ale#fixers#ruff#Fix',
@ -25,6 +26,11 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
@ -41,13 +47,18 @@ endfunction
function! ale_linters#python#ruff#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
" NOTE: ruff version `0.0.69` supports liniting input from stdin
" NOTE: ruff 0.3.0 deprecates `ruff <path>` in favor of `ruff check <path>`
let l:exec_args = l:exec_args
\ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '')
" NOTE: ruff version `0.0.69` supports linting input from stdin
" NOTE: ruff version `0.1.0` deprecates `--format text`
return ale#Escape(l:executable) . l:exec_args . ' -q'
\ . ' --no-fix'
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
\ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format json-lines' : ' --format json-lines')
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s')
@ -56,8 +67,15 @@ endfunction
function! ale_linters#python#ruff#Handle(buffer, lines) abort
let l:output = []
" Read all lines of ruff output and parse use all the valid JSONL lines.
for l:line in a:lines
try
let l:item = json_decode(l:line)
catch
let l:item = v:null
endtry
if !empty(l:item)
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
@ -67,6 +85,7 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endif
endfor
return l:output

View file

@ -5,6 +5,7 @@ call ale#Set('python_unimport_options', '')
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_unimport_auto_pipenv', 0)
call ale#Set('python_unimport_auto_poetry', 0)
call ale#Set('python_unimport_auto_uv', 0)
function! ale_linters#python#unimport#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
@ -17,12 +18,17 @@ function! ale_linters#python#unimport#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
endfunction
function! ale_linters#python#unimport#GetCommand(buffer) abort
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run unimport'
\ : ''

View file

@ -5,6 +5,9 @@ call ale#Set('python_vulture_executable', 'vulture')
call ale#Set('python_vulture_options', '')
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_vulture_change_directory', 1)
call ale#Set('python_vulture_auto_pipenv', 0)
call ale#Set('python_vulture_auto_poetry', 0)
call ale#Set('python_vulture_auto_uv', 0)
" The directory to change to before running vulture
function! s:GetDir(buffer) abort
@ -16,6 +19,21 @@ function! s:GetDir(buffer) abort
endfunction
function! ale_linters#python#vulture#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_vulture_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_vulture_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_vulture_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
endfunction
@ -29,7 +47,7 @@ endfunction
function! ale_linters#python#vulture#GetCommand(buffer) abort
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run vulture'
\ : ''
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')

View file

@ -0,0 +1,172 @@
call ale#Set('ruby_steep_executable', 'steep')
call ale#Set('ruby_steep_options', '')
" Find the nearest dir containing a Steepfile
function! ale_linters#ruby#steep#FindRoot(buffer) abort
for l:name in ['Steepfile']
let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, l:name),
\ ':h'
\)
if l:dir isnot# '.' && isdirectory(l:dir)
return l:dir
endif
endfor
return ''
endfunction
" Rename path relative to root
function! ale_linters#ruby#steep#RelativeToRoot(buffer, path) abort
let l:separator = has('win32') ? '\' : '/'
let l:steep_root = ale_linters#ruby#steep#FindRoot(a:buffer)
" path isn't under root
if l:steep_root is# ''
return ''
endif
let l:steep_root_prefix = l:steep_root . l:separator
" win32 path separators get interpreted by substitute, escape them
if has('win32')
let l:steep_root_pat = substitute(l:steep_root_prefix, '\\', '\\\\', 'g')
else
let l:steep_root_pat = l:steep_root_prefix
endif
return substitute(a:path, l:steep_root_pat, '', '')
endfunction
function! ale_linters#ruby#steep#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_steep_executable')
" steep check needs to apply some config from the file path so:
" - steep check can't use stdin (no path)
" - steep check can't use %t (path outside of project)
" => we can only use %s
" somehow :ALEInfo shows that ALE still appends '< %t' to the command
" => luckily steep check ignores stdin
" somehow steep has a problem with absolute path to file but a path
" relative to Steepfile directory works:
" see https://github.com/soutaro/steep/pull/975
" => change to Steepfile directory and remove leading path
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p')
let l:buffer_filename = fnameescape(l:buffer_filename)
let l:relative = ale_linters#ruby#steep#RelativeToRoot(a:buffer, l:buffer_filename)
" if file is not under steep root, steep can't type check
if l:relative is# ''
" don't execute
return ''
endif
return ale#ruby#EscapeExecutable(l:executable, 'steep')
\ . ' check '
\ . ale#Var(a:buffer, 'ruby_steep_options')
\ . ' ' . fnameescape(l:relative)
endfunction
function! ale_linters#ruby#steep#GetType(severity) abort
if a:severity is? 'information'
\|| a:severity is? 'hint'
return 'I'
endif
if a:severity is? 'warning'
return 'W'
endif
return 'E'
endfunction
" Handle output from steep
function! ale_linters#ruby#steep#HandleOutput(buffer, lines) abort
let l:output = []
let l:in = 0
let l:item = {}
for l:line in a:lines
" Look for first line of a message block
" If not in-message (l:in == 0) that's expected
" If in-message (l:in > 0) that's less expected but let's recover
let l:match = matchlist(l:line, '^\([^:]*\):\([0-9]*\):\([0-9]*\): \[\([^]]*\)\] \(.*\)')
if len(l:match) > 0
" Something is lingering: recover by pushing what is there
if len(l:item) > 0
call add(l:output, l:item)
let l:item = {}
endif
let l:filename = l:match[1]
" Steep's reported column is offset by 1 (zero-indexed?)
let l:item = {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 1,
\ 'type': ale_linters#ruby#steep#GetType(l:match[4]),
\ 'text': l:match[5],
\}
" Done with this line, mark being in-message and go on with next line
let l:in = 1
continue
endif
" We're past the first line of a message block
if l:in > 0
" Look for code in subsequent lines of the message block
if l:line =~# '^│ Diagnostic ID:'
let l:match = matchlist(l:line, '^│ Diagnostic ID: \(.*\)')
if len(l:match) > 0
let l:item.code = l:match[1]
endif
" Done with the line
continue
endif
" Look for last line of the message block
if l:line =~# '^└'
" Done with the line, mark looking for underline and go on with the next line
let l:in = 2
continue
endif
" Look for underline right after last line
if l:in == 2
let l:match = matchlist(l:line, '\([~][~]*\)')
if len(l:match) > 0
let l:item.end_col = l:item['col'] + len(l:match[1]) - 1
endif
call add(l:output, l:item)
" Done with the line, mark looking for first line and go on with the next line
let l:in = 0
let l:item = {}
continue
endif
endif
endfor
return l:output
endfunction
call ale#linter#Define('ruby', {
\ 'name': 'steep',
\ 'executable': {b -> ale#Var(b, 'ruby_steep_executable')},
\ 'language': 'ruby',
\ 'command': function('ale_linters#ruby#steep#GetCommand'),
\ 'project_root': function('ale_linters#ruby#steep#FindRoot'),
\ 'callback': 'ale_linters#ruby#steep#HandleOutput',
\})

View file

@ -5,6 +5,7 @@ call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables',
call ale#linter#Define('sass', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -11,6 +11,7 @@ endfunction
call ale#linter#Define('scss', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -11,7 +11,7 @@ function! ale_linters#sql#sqlfluff#Executable(buffer) abort
return ale#Var(a:buffer, 'sql_sqlfluff_executable')
endfunction
function! ale_linters#sql#sqlfluff#Command(buffer) abort
function! ale_linters#sql#sqlfluff#Command(buffer, version) abort
let l:executable = ale_linters#sql#sqlfluff#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'sql_sqlfluff_options')
@ -35,7 +35,7 @@ function! ale_linters#sql#sqlfluff#Command(buffer) abort
return l:cmd
endfunction
function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
function! ale_linters#sql#sqlfluff#Handle(buffer, version, lines) abort
let l:output = []
let l:json_lines = ale#util#FuzzyJSONDecode(a:lines, [])
@ -50,6 +50,20 @@ function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
return l:output
endif
if ale#semver#GTE(a:version, [3, 0, 0])
for l:violation in get(l:json, 'violations', [])
call add(l:output, {
\ 'filename': l:json.filepath,
\ 'lnum': l:violation.start_line_no,
\ 'end_lnum': l:violation.end_line_no,
\ 'col': l:violation.start_line_pos,
\ 'end_col': l:violation.end_line_pos,
\ 'text': l:violation.description,
\ 'code': l:violation.code,
\ 'type': 'W',
\})
endfor
else
for l:violation in get(l:json, 'violations', [])
call add(l:output, {
\ 'filename': l:json.filepath,
@ -60,6 +74,7 @@ function! ale_linters#sql#sqlfluff#Handle(buffer, lines) abort
\ 'type': 'W',
\})
endfor
endif
return l:output
endfunction
@ -67,6 +82,19 @@ endfunction
call ale#linter#Define('sql', {
\ 'name': 'sqlfluff',
\ 'executable': function('ale_linters#sql#sqlfluff#Executable'),
\ 'command': function('ale_linters#sql#sqlfluff#Command'),
\ 'callback': 'ale_linters#sql#sqlfluff#Handle',
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#sql#sqlfluff#Executable(buffer),
\ '%e --version',
\ function('ale_linters#sql#sqlfluff#Command'),
\ )},
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#sql#sqlfluff#Executable(buffer),
\ '%e --version',
\ {buffer, version -> ale_linters#sql#sqlfluff#Handle(
\ buffer,
\ l:version,
\ lines)},
\ )},
\})

View file

@ -12,6 +12,7 @@ endfunction
call ale#linter#Define('stylus', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -13,6 +13,7 @@ endfunction
call ale#linter#Define('sugarss', {
\ 'name': 'stylelint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},

View file

@ -1,29 +1,34 @@
" Author: Andrew Balmos - <andrew@balmos.org>
" Description: chktex for LaTeX files
let g:ale_tex_chktex_executable =
\ get(g:, 'ale_tex_chktex_executable', 'chktex')
call ale#Set('tex_chktex_executable', 'chktex')
call ale#Set('tex_chktex_options', '-I')
let g:ale_tex_chktex_options =
\ get(g:, 'ale_tex_chktex_options', '-I')
function! ale_linters#tex#chktex#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'tex_chktex_executable')
endfunction
function! ale_linters#tex#chktex#GetCommand(buffer) abort
" Check for optional .chktexrc
let l:chktex_config = ale#path#FindNearestFile(
\ a:buffer,
\ '.chktexrc')
function! ale_linters#tex#chktex#GetCommand(buffer, version) abort
let l:options = ''
let l:command = ale#Var(a:buffer, 'tex_chktex_executable')
" Avoid bug when used without -p (last warning has gibberish for a filename)
let l:command .= ' -v0 -p stdin -q'
let l:options .= ' -v0 -p stdin -q'
if !empty(l:chktex_config)
let l:command .= ' -l ' . ale#Escape(l:chktex_config)
" Avoid bug of reporting wrong column when using tabs (issue #723)
if ale#semver#GTE(a:version, [1, 7, 7])
let l:options .= ' -S TabSize=1'
endif
let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
" Check for optional .chktexrc
let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc')
return l:command
if !empty(l:chktex_config)
let l:options .= ' -l ' . ale#Escape(l:chktex_config)
endif
let l:options .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
return '%e' . l:options
endfunction
function! ale_linters#tex#chktex#Handle(buffer, lines) abort
@ -48,7 +53,12 @@ endfunction
call ale#linter#Define('tex', {
\ 'name': 'chktex',
\ 'executable': 'chktex',
\ 'command': function('ale_linters#tex#chktex#GetCommand'),
\ 'executable': function('ale_linters#tex#chktex#GetExecutable'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#tex#chktex#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#tex#chktex#GetCommand'),
\ )},
\ 'callback': 'ale_linters#tex#chktex#Handle'
\})

View file

@ -0,0 +1,11 @@
" Author: Filip Gospodinov <f@gospodinov.ch>
" Description: biome for TypeScript files
call ale#linter#Define('typescript', {
\ 'name': 'biome',
\ 'lsp': 'stdio',
\ 'language': function('ale#handlers#biome#GetLanguage'),
\ 'executable': function('ale#handlers#biome#GetExecutable'),
\ 'command': '%e lsp-proxy',
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
\})

View file

@ -0,0 +1,53 @@
" Author: Alvin Rolling <alvinrolling@gmail.com>
" Description: slang for verilog files
" Set this option to change Slang lint options
if !exists('g:ale_verilog_slang_options')
let g:ale_verilog_slang_options = ''
endif
" --lint-only
function! ale_linters#verilog#slang#GetCommand(buffer) abort
return 'slang -Weverything '
\ . '-I%s:h '
\ . ale#Var(a:buffer, 'verilog_slang_options') .' '
\ . '%t'
endfunction
function! s:RemoveUnicodeQuotes(text) abort
let l:text = a:text
let l:text = substitute(l:text, '[`´]', '''', 'g')
let l:text = substitute(l:text, '[“”]', '"', 'g')
return l:text
endfunction
function! ale_linters#verilog#slang#Handle(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': str2nr(l:match[2]),
\ 'type': (l:match[4] is# 'error') ? 'E' : 'W',
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
\}
if !empty(l:match[3])
let l:item.col = str2nr(l:match[3])
endif
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('verilog', {
\ 'name': 'slang',
\ 'output_stream': 'stderr',
\ 'executable': 'slang',
\ 'command': function('ale_linters#verilog#slang#GetCommand'),
\ 'callback': 'ale_linters#verilog#slang#Handle',
\ 'read_buffer': 0,
\})

View file

@ -5,6 +5,11 @@ call ale#Set('yaml_actionlint_executable', 'actionlint')
call ale#Set('yaml_actionlint_options', '')
function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
" Only execute actionlint on YAML files in /.github/ paths.
if expand('#' . a:buffer . ':p') !~# '\v[/\\]\.github[/\\]'
return ''
endif
let l:options = ale#Var(a:buffer, 'yaml_actionlint_options')
if l:options !~# '-no-color'
@ -15,21 +20,33 @@ function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
let l:options .= ale#Pad('-oneline')
endif
return '%e' . ale#Pad(l:options)
return '%e' . ale#Pad(l:options) . ' - '
endfunction
function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort
" Matches patterns line the following:
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$'
let l:pattern = '\v^.{-}:(\d+):(\d+): (.+) \[(.+)\]$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[4]
let l:text = l:match[3]
" Handle sub-linter errors like the following:
"validate.yml:19:9: shellcheck reported issue in this script: SC2086:info:1:15: Double quote to prevent globbing and word splitting [shellcheck]
if l:code is# 'shellcheck'
let l:shellcheck_match = matchlist(l:text, '\v^.+: (SC\d{4}):.+:\d+:\d+: (.+)$')
let l:text = l:shellcheck_match[2]
let l:code = 'shellcheck ' . l:shellcheck_match[1]
endif
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3],
\ 'code': l:match[4],
\ 'text': l:text,
\ 'code': l:code,
\ 'type': 'E',
\}

View file

@ -35,20 +35,92 @@ function! ale#definition#UpdateTagStack() abort
endif
endfunction
function! ale#definition#FormatTSServerResponse(response_item, options) abort
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': a:response_item.file,
\ 'lnum': a:response_item.start.line,
\ 'col': a:response_item.start.offset,
\}
else
return {
\ 'filename': a:response_item.file,
\ 'line': a:response_item.start.line,
\ 'column': a:response_item.start.offset,
\}
endif
endfunction
function! ale#definition#HandleTSServerResponse(conn_id, response) abort
if has_key(a:response, 'request_seq')
\&& has_key(s:go_to_definition_map, a:response.request_seq)
let l:options = remove(s:go_to_definition_map, a:response.request_seq)
if get(a:response, 'success', v:false) is v:true && !empty(a:response.body)
let l:filename = a:response.body[0].file
let l:line = a:response.body[0].start.line
let l:column = a:response.body[0].start.offset
let l:item_list = []
for l:response_item in a:response.body
call add(
\ l:item_list,
\ ale#definition#FormatTSServerResponse(l:response_item, l:options)
\)
endfor
if empty(l:item_list)
call ale#util#Execute('echom ''No definitions found''')
elseif len(l:item_list) == 1
let l:filename = l:item_list[0].filename
if get(l:options, 'open_in') is# 'quickfix'
let l:line = l:item_list[0].lnum
let l:column = l:item_list[0].col
else
let l:line = l:item_list[0].line
let l:column = l:item_list[0].column
endif
call ale#definition#UpdateTagStack()
call ale#util#Open(l:filename, l:line, l:column, l:options)
else
if get(l:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:item_list, 'a')
call ale#util#Execute('cc 1')
else
call ale#definition#UpdateTagStack()
call ale#preview#ShowSelection(l:item_list, l:options)
endif
endif
endif
endif
endfunction
function! ale#definition#FormatLSPResponse(response_item, options) abort
if has_key(a:response_item, 'targetUri')
" LocationLink items use targetUri
let l:uri = a:response_item.targetUri
let l:line = a:response_item.targetRange.start.line + 1
let l:column = a:response_item.targetRange.start.character + 1
else
" LocationLink items use uri
let l:uri = a:response_item.uri
let l:line = a:response_item.range.start.line + 1
let l:column = a:response_item.range.start.character + 1
endif
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': ale#util#ToResource(l:uri),
\ 'lnum': l:line,
\ 'col': l:column,
\}
else
return {
\ 'filename': ale#util#ToResource(l:uri),
\ 'line': l:line,
\ 'column': l:column,
\}
endif
endfunction
function! ale#definition#HandleLSPResponse(conn_id, response) abort
@ -65,21 +137,29 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
let l:result = []
endif
for l:item in l:result
if has_key(l:item, 'targetUri')
" LocationLink items use targetUri
let l:uri = l:item.targetUri
let l:line = l:item.targetRange.start.line + 1
let l:column = l:item.targetRange.start.character + 1
else
" LocationLink items use uri
let l:uri = l:item.uri
let l:line = l:item.range.start.line + 1
let l:column = l:item.range.start.character + 1
endif
let l:item_list = []
for l:response_item in l:result
call add(l:item_list,
\ ale#definition#FormatLSPResponse(l:response_item, l:options)
\)
endfor
if empty(l:item_list)
call ale#util#Execute('echom ''No definitions found''')
elseif len(l:item_list) == 1
call ale#definition#UpdateTagStack()
let l:uri = ale#util#ToURI(l:item_list[0].filename)
if get(l:options, 'open_in') is# 'quickfix'
let l:line = l:item_list[0].lnum
let l:column = l:item_list[0].col
else
let l:line = l:item_list[0].line
let l:column = l:item_list[0].column
endif
let l:uri_handler = ale#uri#GetURIHandler(l:uri)
if l:uri_handler is# v:null
@ -88,9 +168,16 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
else
call l:uri_handler.OpenURILink(l:uri, l:line, l:column, l:options, a:conn_id)
endif
break
endfor
else
if get(l:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:item_list, 'a')
call ale#util#Execute('cc 1')
else
call ale#definition#UpdateTagStack()
call ale#preview#ShowSelection(l:item_list, l:options)
endif
endif
endif
endfunction

View file

@ -37,6 +37,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['bib'],
\ 'description': 'Format bib files using bibclean.',
\ },
\ 'biome': {
\ 'function': 'ale#fixers#biome#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'jsonc'],
\ 'description': 'Fix JavaScript and TypeScript using biome.',
\ },
\ 'black': {
\ 'function': 'ale#fixers#black#Fix',
\ 'suggested_filetypes': ['python'],
@ -98,6 +103,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
\ 'description': 'Apply fecs format to a file.',
\ },
\ 'hurlfmt': {
\ 'function': 'ale#fixers#hurlfmt#Fix',
\ 'suggested_filetypes': ['hurl'],
\ 'description': 'Fix hurl files with hurlfmt.',
\ },
\ 'tidy': {
\ 'function': 'ale#fixers#tidy#Fix',
\ 'suggested_filetypes': ['html'],
@ -127,7 +137,7 @@ let s:default_registry = {
\ },
\ 'eslint': {
\ 'function': 'ale#fixers#eslint#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript'],
\ 'suggested_filetypes': ['javascript', 'typescript', 'astro'],
\ 'description': 'Apply eslint --fix to a file.',
\ },
\ 'mix_format': {
@ -142,7 +152,7 @@ let s:default_registry = {
\ },
\ 'prettier': {
\ 'function': 'ale#fixers#prettier#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby'],
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby', 'astro'],
\ 'description': 'Apply prettier to a file.',
\ },
\ 'prettier_eslint': {
@ -291,6 +301,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['solidity'],
\ 'description': 'Fix Solidity files with forge fmt.',
\ },
\ 'gleam_format': {
\ 'function': 'ale#fixers#gleam_format#Fix',
\ 'suggested_filetypes': ['gleam'],
\ 'description': 'Fix Gleam files with gleam format.',
\ },
\ 'gofmt': {
\ 'function': 'ale#fixers#gofmt#Fix',
\ 'suggested_filetypes': ['go'],
@ -546,6 +561,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['html', 'htmldjango'],
\ 'description': 'Fix HTML files with html-beautify from js-beautify.',
\ },
\ 'htmlbeautifier': {
\ 'function': 'ale#fixers#htmlbeautifier#Fix',
\ 'suggested_filetypes': ['eruby'],
\ 'description': 'Fix ERB files with htmlbeautifier gem.',
\ },
\ 'lua-format': {
\ 'function': 'ale#fixers#lua_format#Fix',
\ 'suggested_filetypes': ['lua'],
@ -641,6 +661,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['nickel'],
\ 'description': 'Fix nickel files with nickel format',
\ },
\ 'rubyfmt': {
\ 'function': 'ale#fixers#rubyfmt#Fix',
\ 'suggested_filetypes': ['ruby'],
\ 'description': 'A formatter for Ruby source code',
\ },
\}
" Reset the function registry to the default entries.

View file

@ -4,22 +4,40 @@
call ale#Set('python_autoflake_executable', 'autoflake')
call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autoflake_options', '')
call ale#Set('python_autoflake_auto_pipenv', 0)
call ale#Set('python_autoflake_auto_poetry', 0)
call ale#Set('python_autoflake_auto_uv', 0)
function! ale#fixers#autoflake#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoflake_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoflake_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoflake_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_autoflake', ['autoflake'])
endfunction
function! ale#fixers#autoflake#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autoflake',
\ ['autoflake'],
\)
let l:executable = ale#fixers#autoflake#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run autoflake'
\ : ''
let l:options = ale#Var(a:buffer, 'python_autoflake_options')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --in-place '
\ . ' %t',

View file

@ -4,23 +4,41 @@
call ale#Set('python_autoimport_executable', 'autoimport')
call ale#Set('python_autoimport_options', '')
call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autoimport_auto_pipenv', 0)
call ale#Set('python_autoimport_auto_poetry', 0)
call ale#Set('python_autoimport_auto_uv', 0)
function! ale#fixers#autoimport#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoimport_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoimport_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoimport_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_autoimport', ['autoimport'])
endfunction
function! ale#fixers#autoimport#Fix(buffer) abort
let l:executable = ale#fixers#autoimport#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run autoimport'
\ : ''
let l:options = ale#Var(a:buffer, 'python_autoimport_options')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autoimport',
\ ['autoimport'],
\)
if !executable(l:executable)
return 0
endif
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable)
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}

View file

@ -4,22 +4,40 @@
call ale#Set('python_autopep8_executable', 'autopep8')
call ale#Set('python_autopep8_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autopep8_options', '')
call ale#Set('python_autopep8_auto_pipenv', 0)
call ale#Set('python_autopep8_auto_poetry', 0)
call ale#Set('python_autopep8_auto_uv', 0)
function! ale#fixers#autopep8#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autopep8_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autopep8_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autopep8_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_autopep8', ['autopep8'])
endfunction
function! ale#fixers#autopep8#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autopep8',
\ ['autopep8'],
\)
let l:executable = ale#fixers#autopep8#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run autopep8'
\ : ''
let l:options = ale#Var(a:buffer, 'python_autopep8_options')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}

View file

@ -1,17 +1,12 @@
" Author: Akiomi Kamakura <akiomik@gmail.com>
" Description: Fixing files with biome (ex.rome).
function! ale#fixers#biome#Fix(buffer) abort
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'javascript_biome_options')
let l:node = ale#Var(a:buffer, 'javascript_biome_node_executable')
let l:options = ale#Var(a:buffer, 'biome_options')
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--apply-unsafe' : '--apply'
return {
\ 'command': (has('win32') ? (ale#Escape(l:node) . ' ') : '')
\ . ale#Escape(l:executable)
\ . ' check --apply'
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(l:executable) . ' check ' . l:apply
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
\}
endfunction

View file

@ -6,6 +6,7 @@ call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_black_options', '')
call ale#Set('python_black_auto_pipenv', 0)
call ale#Set('python_black_auto_poetry', 0)
call ale#Set('python_black_auto_uv', 0)
call ale#Set('python_black_change_directory', 1)
function! ale#fixers#black#GetExecutable(buffer) abort
@ -19,6 +20,11 @@ function! ale#fixers#black#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_black_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
endfunction
@ -26,7 +32,7 @@ function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'black'])
endif

View file

@ -0,0 +1,13 @@
" Author: Arash Mousavi <arash-m>
" Description: Support for HTML Beautifier https://github.com/threedaymonk/htmlbeautifier
call ale#Set('eruby_htmlbeautifier_executable', 'htmlbeautifier')
function! ale#fixers#htmlbeautifier#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_htmlbeautifier_executable')
return {
\ 'command': ale#Escape(l:executable) . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -0,0 +1,15 @@
call ale#Set('hurl_hurlfmt_executable', 'hurlfmt')
function! ale#fixers#hurlfmt#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'hurl_hurlfmt_executable')
return ale#Escape(l:executable)
\ . ' --out hurl'
endfunction
function! ale#fixers#hurlfmt#Fix(buffer) abort
return {
\ 'command': ale#fixers#hurlfmt#GetCommand(a:buffer)
\}
endfunction

View file

@ -6,6 +6,7 @@ call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_isort_options', '')
call ale#Set('python_isort_auto_pipenv', 0)
call ale#Set('python_isort_auto_poetry', 0)
call ale#Set('python_isort_auto_uv', 0)
function! ale#fixers#isort#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv'))
@ -18,6 +19,11 @@ function! ale#fixers#isort#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_isort_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction
@ -25,7 +31,7 @@ function! ale#fixers#isort#GetCmd(buffer) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort'])
endif
@ -36,7 +42,7 @@ function! ale#fixers#isort#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort'])
endif

View file

@ -4,6 +4,7 @@
call ale#Set('php_cs_fixer_executable', 'php-cs-fixer')
call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('php_cs_fixer_options', '')
call ale#Set('php_cs_fixer_fix_options', '')
function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [
@ -18,7 +19,8 @@ function! ale#fixers#php_cs_fixer#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . ale#Var(a:buffer, 'php_cs_fixer_options')
\ . ' fix %t',
\ . ' fix ' . ale#Var(a:buffer, 'php_cs_fixer_fix_options')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -79,6 +79,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
\ 'openapi': 'yaml',
\ 'html': 'html',
\ 'ruby': 'ruby',
\ 'astro': 'astro',
\}
for l:filetype in l:filetypes

View file

@ -7,6 +7,7 @@ call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '')
function! ale#fixers#pycln#GetCwd(buffer) abort
@ -31,12 +32,17 @@ function! ale#fixers#pycln#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
function! ale#fixers#pycln#GetCommand(buffer) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycln'
\ : ''
@ -47,7 +53,7 @@ function! ale#fixers#pycln#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'pycln'])
endif

View file

@ -7,6 +7,7 @@ call ale#Set('python_pyflyby_use_global', get(g:, 'ale_use_global_executables',
call ale#Set('python_pyflyby_options', '')
call ale#Set('python_pyflyby_auto_pipenv', 0)
call ale#Set('python_pyflyby_auto_poetry', 0)
call ale#Set('python_pyflyby_auto_uv', 0)
function! ale#fixers#pyflyby#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv'))
@ -19,6 +20,11 @@ function! ale#fixers#pyflyby#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflyby_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports'])
endfunction
@ -27,7 +33,7 @@ function! ale#fixers#pyflyby#Fix(buffer) abort
let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'tidy-imports'])
endif

View file

@ -4,22 +4,40 @@
call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports')
call ale#Set('python_reorder_python_imports_options', '')
call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_reorder_python_imports_auto_pipenv', 0)
call ale#Set('python_reorder_python_imports_auto_poetry', 0)
call ale#Set('python_reorder_python_imports_auto_uv', 0)
function! ale#fixers#reorder_python_imports#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_reorder_python_imports', ['reorder-python-imports'])
endfunction
function! ale#fixers#reorder_python_imports#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_reorder_python_imports',
\ ['reorder-python-imports'],
\)
let l:executable = ale#fixers#reorder_python_imports#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run reorder-python-imports'
\ : ''
let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\}
endfunction

View file

@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_ruff_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0)
call ale#Set('python_ruff_auto_uv', 0)
function! ale#fixers#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory')
@ -30,12 +31,17 @@ function! ale#fixers#ruff#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
function! ale#fixers#ruff#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
@ -46,10 +52,15 @@ function! ale#fixers#ruff#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff'])
endif
" NOTE: ruff 0.5.0 removes `ruff <path>` in favor of `ruff check <path>`
if ale#semver#GTE(a:version, [0, 5, 0])
call extend(l:cmd, ['check'])
endif
let l:options = ale#Var(a:buffer, 'python_ruff_options')
if !empty(l:options)

View file

@ -7,6 +7,7 @@ call ale#Set('python_ruff_format_use_global', get(g:, 'ale_use_global_executable
call ale#Set('python_ruff_format_change_directory', 1)
call ale#Set('python_ruff_format_auto_pipenv', 0)
call ale#Set('python_ruff_format_auto_poetry', 0)
call ale#Set('python_ruff_format_auto_uv', 0)
function! ale#fixers#ruff_format#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_format_change_directory')
@ -30,12 +31,17 @@ function! ale#fixers#ruff_format#GetExecutable(buffer) abort
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_format_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_ruff_format', ['ruff'])
endfunction
function! ale#fixers#ruff_format#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
@ -46,7 +52,7 @@ function! ale#fixers#ruff_format#Fix(buffer) abort
let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff'])
endif

View file

@ -3,17 +3,35 @@
call ale#Set('python_yapf_executable', 'yapf')
call ale#Set('python_yapf_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_yapf_auto_pipenv', 0)
call ale#Set('python_yapf_auto_poetry', 0)
call ale#Set('python_yapf_auto_uv', 0)
function! ale#fixers#yapf#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_yapf_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_yapf_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_yapf_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_yapf', ['yapf'])
endfunction
function! ale#fixers#yapf#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_yapf',
\ ['yapf'],
\)
let l:executable = ale#fixers#yapf#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run yapf'
\ : ''
let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf')
let l:config_options = !empty(l:config)
@ -21,6 +39,6 @@ function! ale#fixers#yapf#Fix(buffer) abort
\ : ''
return {
\ 'command': ale#Escape(l:executable) . l:config_options,
\ 'command': ale#Escape(l:executable) . l:exec_args . l:config_options,
\}
endfunction

View file

@ -1,14 +1,58 @@
" Author: Akiomi Kamakura <akiomik@gmail.com>
" Description: Functions for working with biome, for fixing files.
" Author: Filip Gospodinov <f@gospodinov.ch>
" Description: Functions for working with biome, for checking or fixing files.
call ale#Set('javascript_biome_node_executable', 'node.exe')
call ale#Set('javascript_biome_executable', 'biome')
call ale#Set('javascript_biome_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_biome_options', '')
call ale#Set('biome_executable', 'biome')
call ale#Set('biome_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('biome_options', '')
call ale#Set('biome_fixer_apply_unsafe', 0)
call ale#Set('biome_lsp_project_root', '')
function! ale#handlers#biome#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'javascript_biome', [
return ale#path#FindExecutable(a:buffer, 'biome', [
\ 'node_modules/@biomejs/cli-linux-x64/biome',
\ 'node_modules/@biomejs/cli-linux-arm64/biome',
\ 'node_modules/@biomejs/cli-win32-x64/biome.exe',
\ 'node_modules/@biomejs/cli-win32-arm64/biome.exe',
\ 'node_modules/@biomejs/cli-darwin-x64/biome',
\ 'node_modules/@biomejs/cli-darwin-arm64/biome',
\ 'node_modules/.bin/biome',
\ 'node_modules/@biomejs/biome/bin/biome',
\])
endfunction
function! ale#handlers#biome#GetLanguage(buffer) abort
return getbufvar(a:buffer, '&filetype')
endfunction
function! ale#handlers#biome#GetProjectRoot(buffer) abort
let l:project_root = ale#Var(a:buffer, 'biome_lsp_project_root')
if !empty(l:project_root)
return l:project_root
endif
let l:possible_project_roots = [
\ 'biome.json',
\ 'biome.jsonc',
\ 'package.json',
\ '.git',
\ bufname(a:buffer),
\]
for l:possible_root in l:possible_project_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root)
if empty(l:project_root)
let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root)
endif
if !empty(l:project_root)
" dir:p expands to /full/path/to/dir/ whereas
" file:p expands to /full/path/to/file (no trailing slash)
" Appending '/' ensures that :h:h removes the path's last segment
" regardless of whether it is a directory or not.
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
endfor
return ''
endfunction

View file

@ -11,12 +11,31 @@ function! ale#handlers#cspell#GetExecutable(buffer) abort
\)
endfunction
function! ale#handlers#cspell#GetLanguageId(buffer) abort
let l:filetype = getbufvar(a:buffer, '&filetype')
if l:filetype is# 'tex'
" Vim's tex corresponds to latex language-id in cspell
return 'latex'
elseif l:filetype is# 'plaintex'
" Vim's plaintex corresponds to tex language-id in cspell
return 'tex'
else
" Fallback to filetype for everything else.
return l:filetype
endif
endfunction
function! ale#handlers#cspell#GetCommand(buffer) abort
let l:executable = ale#handlers#cspell#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'cspell_options')
let l:language_id = ale#handlers#cspell#GetLanguageId(a:buffer)
let l:language_id_option = empty(l:language_id) ? '' : '--language-id="' . l:language_id . '"'
return ale#node#Executable(a:buffer, l:executable)
\ . ' lint --no-color --no-progress --no-summary'
\ . ale#Pad(l:language_id_option)
\ . ale#Pad(l:options)
\ . ' -- stdin'
endfunction

View file

@ -0,0 +1,66 @@
" Author: Adrian Zalewski <aazalewski@hotmail.com>
" Description: Ember-template-lint for checking Handlebars files
function! ale#handlers#embertemplatelint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
\ 'node_modules/.bin/ember-template-lint',
\])
endfunction
function! ale#handlers#embertemplatelint#GetCommand(buffer, version) abort
if ale#semver#GTE(a:version, [4, 0, 0])
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
return '%e --format=json --filename %s'
endif
return '%e --json --filename %s'
endfunction
function! ale#handlers#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ ale#handlers#embertemplatelint#GetExecutable(a:buffer),
\ '%e --version',
\ function('ale#handlers#embertemplatelint#GetCommand'),
\)
endfunction
function! ale#handlers#embertemplatelint#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
for l:error in get(values(l:json), 0, [])
if has_key(l:error, 'fatal')
call add(l:output, {
\ 'lnum': get(l:error, 'line', 1),
\ 'col': get(l:error, 'column', 1),
\ 'text': l:error.message,
\ 'type': l:error.severity == 1 ? 'W' : 'E',
\})
else
call add(l:output, {
\ 'lnum': l:error.line,
\ 'col': l:error.column,
\ 'text': l:error.rule . ': ' . l:error.message,
\ 'type': l:error.severity == 1 ? 'W' : 'E',
\})
endif
endfor
return l:output
endfunction
function! ale#handlers#embertemplatelint#DefineLinter(filetype) abort
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define(a:filetype, {
\ 'name': 'embertemplatelint',
\ 'aliases': ['ember-template-lint'],
\ 'executable': function('ale#handlers#embertemplatelint#GetExecutable'),
\ 'command': function('ale#handlers#embertemplatelint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#embertemplatelint#Handle',
\})
endfunction

View file

@ -18,7 +18,11 @@ call ale#Set('javascript_eslint_suppress_missing_config', 0)
function! ale#handlers#eslint#FindConfig(buffer) abort
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:basename in [
\ 'eslint.config.js',
\ 'eslint.config.mjs',
\ 'eslint.config.cjs',
\ '.eslintrc.js',
\ '.eslintrc.cjs',
\ '.eslintrc.yaml',
\ '.eslintrc.yml',
\ '.eslintrc.json',
@ -41,31 +45,7 @@ endfunction
" Given a buffer, return an appropriate working directory for ESLint.
function! ale#handlers#eslint#GetCwd(buffer) abort
" ESLint 6 loads plugins/configs/parsers from the project root
" By default, the project root is simply the CWD of the running process.
" https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md
" https://github.com/dense-analysis/ale/issues/2787
"
" 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#path#FindNearestExecutable(a:buffer, s:executables)
if !empty(l:executable)
let l:modules_index = strridx(l:executable, 'node_modules')
let l:modules_root = l:modules_index > -1 ? l:executable[0:l:modules_index - 2] : ''
let l:sdks_index = strridx(l:executable, ale#path#Simplify('.yarn/sdks'))
let l:sdks_root = l:sdks_index > -1 ? l:executable[0:l:sdks_index - 2] : ''
else
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules')
let l:modules_root = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
let l:sdks_dir = ale#path#FindNearestDirectory(a:buffer, ale#path#Simplify('.yarn/sdks'))
let l:sdks_root = !empty(l:sdks_dir) ? fnamemodify(l:sdks_dir, ':h:h:h') : ''
endif
return strlen(l:modules_root) > strlen(l:sdks_root) ? l:modules_root : l:sdks_root
return ale#path#Dirname(ale#handlers#eslint#FindConfig(a:buffer))
endfunction
function! ale#handlers#eslint#GetCommand(buffer) abort

View file

@ -49,6 +49,7 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
let l:format = ale#semver#GTE(a:version, [0, 7, 0]) ? 'json1' : 'gcc'
if l:dialect is# 'auto'
let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer)
@ -59,10 +60,69 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
\ . l:external_option
\ . ' -f gcc -'
\ . ' -f ' . l:format . ' -'
endfunction
function! ale#handlers#shellcheck#Handle(buffer, lines) abort
function! s:HandleShellcheckJSON(buffer, lines) abort
try
let l:errors = json_decode(a:lines[0])
catch
return []
endtry
if !has_key(l:errors, 'comments')
return []
endif
let l:output = []
for l:error in l:errors['comments']
if l:error['level'] is# 'error'
let l:type = 'E'
elseif l:error['level'] is# 'info'
let l:type = 'I'
elseif l:error['level'] is# 'style'
let l:type = 'I'
else
let l:type = 'W'
endif
let l:item = {
\ 'lnum': l:error['line'],
\ 'type': l:type,
\ 'text': l:error['message'],
\ 'code': 'SC' . l:error['code'],
\ 'detail': l:error['message'] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/SC" . l:error['code'],
\}
if has_key(l:error, 'column')
let l:item.col = l:error['column']
endif
if has_key(l:error, 'endColumn')
let l:item.end_col = l:error['endColumn'] - 1
endif
if has_key(l:error, 'endLine')
let l:item.end_lnum = l:error['endLine']
endif
" If the filename is something like <stdin>, <nofile> or -, then
" this is an error for the file we checked.
if has_key(l:error, 'file')
if l:error['file'] isnot# '-' && l:error['file'][0] isnot# '<'
let l:item['filename'] = l:error['file']
endif
endif
call add(l:output, l:item)
endfor
return l:output
endfunction
function! s:HandleShellcheckGCC(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
let l:output = []
@ -80,6 +140,7 @@ function! ale#handlers#shellcheck#Handle(buffer, lines) abort
\ 'type': l:type,
\ 'text': l:match[5],
\ 'code': l:match[6],
\ 'detail': l:match[5] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . l:match[6],
\}
if !empty(l:match[3])
@ -98,6 +159,12 @@ function! ale#handlers#shellcheck#Handle(buffer, lines) abort
return l:output
endfunction
function! ale#handlers#shellcheck#Handle(buffer, version, lines) abort
return ale#semver#GTE(a:version, [0, 7, 0])
\ ? s:HandleShellcheckJSON(a:buffer, a:lines)
\ : s:HandleShellcheckGCC(a:buffer, a:lines)
endfunction
function! ale#handlers#shellcheck#DefineLinter(filetype) abort
" This global variable can be set with a string of comma-separated error
" codes to exclude from shellcheck. For example:
@ -118,6 +185,14 @@ function! ale#handlers#shellcheck#DefineLinter(filetype) abort
\ '%e --version',
\ function('ale#handlers#shellcheck#GetCommand'),
\ )},
\ 'callback': 'ale#handlers#shellcheck#Handle',
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#Var(buffer, 'sh_shellcheck_executable'),
\ '%e --version',
\ {buffer, version -> ale#handlers#shellcheck#Handle(
\ buffer,
\ l:version,
\ lines)},
\ )},
\})
endfunction

View file

@ -117,10 +117,10 @@ function! ale#hover#ParseLSPResult(contents) abort
for l:line in split(l:item, "\n")
if l:fence_language is v:null
" Look for the start of a code fence. (```python, etc.)
let l:match = matchlist(l:line, '^``` *\([^ ]\+\) *$')
let l:match = matchlist(l:line, '^``` *\([^ ]\+\)\? *$')
if !empty(l:match)
let l:fence_language = l:match[1]
let l:fence_language = len(l:match) > 1 ? l:match[1] : 'text'
if !empty(l:marked_list)
call add(l:fence_lines, '')

View file

@ -40,6 +40,7 @@ let s:default_ale_linter_aliases = {
" NOTE: Update the g:ale_linters documentation when modifying this.
let s:default_ale_linters = {
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'astro': ['eslint'],
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'],
@ -47,9 +48,9 @@ let s:default_ale_linters = {
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],
\ 'json': ['jsonlint', 'spectral', 'vscodejson'],
\ 'json': ['biome', 'jsonlint', 'spectral', 'vscodejson'],
\ 'json5': [],
\ 'jsonc': [],
\ 'jsonc': ['biome'],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'],
@ -60,7 +61,7 @@ let s:default_ale_linters = {
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'],
\ 'yaml': ['actionlint', 'spectral', 'yaml-language-server', 'yamllint'],
\}
" Testing/debugging helper to unload all linters.

View file

@ -3,6 +3,7 @@
call ale#Set('python_auto_pipenv', '0')
call ale#Set('python_auto_poetry', '0')
call ale#Set('python_auto_uv', '0')
let s:sep = has('win32') ? '\' : '/'
" bin is used for Unix virtualenv directories, and Scripts is for Windows.
@ -43,6 +44,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/poetry.lock')
\|| filereadable(l:path . '/pyproject.toml')
\|| filereadable(l:path . '/.tool-versions')
\|| filereadable(l:path . '/uv.lock')
return l:path
endif
endfor
@ -192,3 +194,8 @@ endfunction
function! ale#python#PoetryPresent(buffer) abort
return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction
" Detects whether a poetry environment is present.
function! ale#python#UvPresent(buffer) abort
return findfile('uv.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction

View file

@ -161,7 +161,7 @@ endfunction
function! s:GroupCmd() abort
if s:supports_sign_groups
return ' group=ale '
return ' group=ale_signs '
else
return ' '
endif
@ -180,13 +180,13 @@ endfunction
function! ale#sign#ParsePattern() abort
if s:supports_sign_groups
" Matches output like :
" line=4 id=1 group=ale name=ALEErrorSign
" строка=1 id=1000001 группа=ale имя=ALEErrorSign
" 行=1 識別子=1000001 グループ=ale 名前=ALEWarningSign
" línea=12 id=1000001 grupo=ale nombre=ALEWarningSign
" riga=1 id=1000001 gruppo=ale nome=ALEWarningSign
" Zeile=235 id=1000001 Gruppe=ale Name=ALEErrorSign
let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=ale>.*\=(ALE[a-zA-Z]+Sign)'
" line=4 id=1 group=ale_signs name=ALEErrorSign
" строка=1 id=1000001 группа=ale_signs имя=ALEErrorSign
" 行=1 識別子=1000001 グループ=ale_signs 名前=ALEWarningSign
" línea=12 id=1000001 grupo=ale_signs nombre=ALEWarningSign
" riga=1 id=1000001 gruppo=ale_signs nome=ALEWarningSign
" Zeile=235 id=1000001 Gruppe=ale_signs Name=ALEErrorSign
let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=ale_signs>.*\=(ALE[a-zA-Z]+Sign)'
else
" Matches output like :
" line=4 id=1 name=ALEErrorSign
@ -203,7 +203,7 @@ endfunction
" Given a buffer number, return a List of placed signs [line, id, group]
function! ale#sign#ParseSignsWithGetPlaced(buffer) abort
let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale' : '' })[0].signs
let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale_signs' : '' })[0].signs
let l:result = []
let l:is_dummy_sign_set = 0
@ -489,7 +489,7 @@ endfunction
" Remove all signs.
function! ale#sign#Clear() abort
if s:supports_sign_groups
sign unplace group=ale *
sign unplace group=ale_signs *
else
sign unplace *
endif

View file

@ -0,0 +1,16 @@
===============================================================================
ALE Astro Integration *ale-astro-options*
===============================================================================
eslint *ale-astro-eslint*
See |ale-javascript-eslint| for information about the available options.
===============================================================================
prettier *ale-astro-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -27,6 +27,19 @@ g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable*
This variable can be set to change the path of dart.
g:ale_dart_analysis_server_enable_language_server
*g:ale_dart_analysis_server_enable_language_server*
*b:ale_dart_analysis_server_enable_language_server*
Type: |Number|
Default: `1`
When set to `1`, ALE will use the new `dart language-server` command,
available from Dart version 2.16.0, to launch the language server. When set
to `0`, ALE will instead use the deprecated
`./snapshots/analysis_server.dart.snapshot --lsp` command used by older
versions of Dart.
===============================================================================
dart-analyze *ale-dart-analyze*

View file

@ -7,6 +7,7 @@ There are four linters for `eruby` files:
- `erblint`
- `erubis`
- `erubi`
- `htmlbeautifier`
- `ruumba`
`erb` is in the Ruby standard library and is mostly universal. `erubis` is the
@ -47,6 +48,18 @@ g:ale_eruby_erblint_options *g:ale_ruby_erblint_options*
This variable can be change to modify flags given to erblint.
===============================================================================
htmlbeautifier *ale-eruby-htmlbeautifier*
g:ale_eruby_htmlbeautifier_executable *g:ale_eruby_htmlbeautifier_executable*
*b:ale_eruby_htmlbeautifier_executable*
Type: |String|
Default: `'htmlbeautifier'`
Override the invoked htmlbeautifier binary. This is useful for running
htmlbeautifier from binstubs or a bundle.
===============================================================================
ruumba *ale-eruby-ruumba*

View file

@ -0,0 +1,17 @@
===============================================================================
ALE Hurl Integration *ale-hurl-options*
===============================================================================
hurlfmt *ale-hurl-hurlfmt*
g:ale_hurl_hurlfmt_executable *g:ale_hurl_hurlfmt_executable*
*b:ale_hurl_hurlfmt_executable*
Type: |String|
Default: `'hurlfmt'`
Override the invoked hurlfmt binary.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -25,6 +25,12 @@ To this: >
<
===============================================================================
biome *ale-javascript-biome*
Check the docs over at |ale-typescript-biome|.
===============================================================================
clang-format *ale-javascript-clangformat*

View file

@ -2,6 +2,12 @@
ALE JSON Integration *ale-json-options*
===============================================================================
biome *ale-json-biome*
Check the docs over at |ale-typescript-biome|.
===============================================================================
clang-format *ale-json-clangformat*

View file

@ -2,6 +2,12 @@
ALE JSONC Integration *ale-jsonc-options*
===============================================================================
biome *ale-jsonc-biome*
Check the docs over at |ale-typescript-biome|.
===============================================================================
eslint *ale-jsonc-eslint*

View file

@ -0,0 +1,29 @@
===============================================================================
ALE Odin Integration *ale-odin-options*
*ale-integration-odin*
===============================================================================
Integration Information
Currently, the only supported linter for Odin is ols.
===============================================================================
ols *ale-odin-ols*
g:ale_odin_ols_executable *g:ale_odin_ols_executable*
*b:ale_odin_ols_executable*
Type: |String|
Default: `'ols'`
This variable can be modified to change the executable path for `ols`.
g:ale_odin_ols_config *g:ale_odin_ols_config*
*b:ale_odin_ols_config*
Type: |Dictionary|
Default: `{}`
Dictionary with configuration settings for ols.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -20,6 +20,15 @@ g:ale_python_auto_poetry *g:ale_python_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_auto_uv *g:ale_python_auto_uv*
*b:ale_python_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_auto_virtualenv *g:ale_python_auto_virtualenv*
*b:ale_python_auto_virtualenv*
Type: |Number|
@ -96,6 +105,33 @@ g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global*
See |ale-integrations-local-executables|
g:ale_python_autoflake_auto_pipenv *g:ale_python_autoflake_auto_pipenv*
*b:ale_python_autoflake_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_autoflake_auto_poetry *g:ale_python_autoflake_auto_poetry*
*b:ale_python_autoflake_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_autoflake_auto_uv *g:ale_python_autoflake_auto_uv*
*b:ale_python_autoflake_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
autoimport *ale-python-autoimport*
@ -123,6 +159,33 @@ g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global*
See |ale-integrations-local-executables|
g:ale_python_autoimport_auto_pipenv *g:ale_python_autoimport_auto_pipenv*
*b:ale_python_autoimport_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_autoimport_auto_poetry *g:ale_python_autoimport_auto_poetry*
*b:ale_python_autoimport_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_autoimport_auto_uv *g:ale_python_autoimport_auto_uv*
*b:ale_python_autoimport_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
autopep8 *ale-python-autopep8*
@ -150,6 +213,33 @@ g:ale_python_autopep8_use_global *g:ale_python_autopep8_use_global*
See |ale-integrations-local-executables|
g:ale_python_autopep8_auto_pipenv *g:ale_python_autopep8_auto_pipenv*
*b:ale_python_autopep8_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_autopep8_auto_poetry *g:ale_python_autopep8_auto_poetry*
*b:ale_python_autopep8_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_autopep8_auto_uv *g:ale_python_autopep8_auto_uv*
*b:ale_python_autopep8_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
bandit *ale-python-bandit*
@ -210,6 +300,15 @@ g:ale_python_bandit_auto_poetry *g:ale_python_bandit_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_bandit_auto_uv *g:ale_python_bandit_auto_uv*
*b:ale_python_bandit_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
black *ale-python-black*
@ -255,6 +354,15 @@ g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_black_auto_uv *g:ale_python_black_auto_uv*
*b:ale_python_black_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_black_change_directory *g:ale_python_black_change_directory*
*b:ale_python_black_change_directory*
Type: |Number|
@ -345,6 +453,15 @@ g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_flake8_auto_uv *g:ale_python_flake8_auto_uv*
*b:ale_python_flake8_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
flakehell *ale-python-flakehell*
@ -410,6 +527,15 @@ g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_flakehell_auto_uv *g:ale_python_flakehell_auto_uv*
*b:ale_python_flakehell_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
isort *ale-python-isort*
@ -455,6 +581,15 @@ g:ale_python_isort_auto_poetry *g:ale_python_isort_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_isort_auto_uv *g:ale_python_isort_auto_uv*
*b:ale_python_isort_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
mypy *ale-python-mypy*
@ -483,6 +618,15 @@ g:ale_python_mypy_auto_poetry *g:ale_python_mypy_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_mypy_auto_uv *g:ale_python_mypy_auto_uv*
*b:ale_python_mypy_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_mypy_executable *g:ale_python_mypy_executable*
*b:ale_python_mypy_executable*
Type: |String|
@ -591,6 +735,15 @@ g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_prospector_auto_uv *g:ale_python_prospector_auto_uv*
*b:ale_python_prospector_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pycln *ale-python-pycln*
@ -663,6 +816,15 @@ g:ale_python_pycln_auto_poetry *g:ale_python_pycln_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pycln_auto_uv *g:ale_python_pycln_auto_uv*
*b:ale_python_pycln_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pycodestyle *ale-python-pycodestyle*
@ -712,6 +874,15 @@ g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pycodestyle_auto_uv *g:ale_python_pycodestyle_auto_uv*
*b:ale_python_pycodestyle_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pydocstyle *ale-python-pydocstyle*
@ -761,6 +932,15 @@ g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pydocstyle_auto_uv *g:ale_python_pydocstyle_auto_uv*
*b:ale_python_pydocstyle_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pyflakes *ale-python-pyflakes*
@ -793,6 +973,15 @@ g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pyflakes_auto_uv *g:ale_python_pyflakes_auto_uv*
*b:ale_python_pyflakes_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pyflyby *ale-python-pyflyby*
@ -839,6 +1028,15 @@ g:ale_python_pyflyby_auto_poetry *g:ale_python_pyflyby_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pyflyby_auto_uv *g:ale_python_pyflyby_auto_uv*
*b:ale_python_pyflyby_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pylama *ale-python-pylama*
@ -902,6 +1100,14 @@ g:ale_python_pylama_auto_poetry *g:ale_python_pylama_auto_poetry*
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_pylama_auto_uv *g:ale_python_pylama_auto_uv*
*b:ale_python_pylama_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pylint *ale-python-pylint*
@ -976,6 +1182,15 @@ g:ale_python_pylint_auto_poetry *g:ale_python_pylint_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pylint_auto_uv *g:ale_python_pylint_auto_uv*
*b:ale_python_pylint_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id*
*b:ale_python_pylint_use_msg_id*
Type: |Number|
@ -1028,6 +1243,15 @@ g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pylsp_auto_uv *g:ale_python_pylsp_auto_uv*
*b:ale_python_pylsp_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_pylsp_config *g:ale_python_pylsp_config*
*b:ale_python_pylsp_config*
Type: |Dictionary|
@ -1109,6 +1333,15 @@ g:ale_python_pyre_auto_poetry *g:ale_python_pyre_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_pyre_auto_uv *g:ale_python_pyre_auto_uv*
*b:ale_python_pyre_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pyright *ale-python-pyright*
@ -1168,6 +1401,33 @@ g:ale_python_pyright_config *g:ale_python_pyright_config*
\}
<
g:ale_python_pyright_auto_pipenv *g:ale_python_pyright_auto_pipenv*
*b:ale_python_pyright_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_pyright_auto_poetry *g:ale_python_pyright_auto_poetry*
*b:ale_python_pyright_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_pyright_auto_uv *g:ale_python_pyright_auto_uv*
*b:ale_python_pyright_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
refurb *ale-python-refurb*
@ -1229,6 +1489,15 @@ g:ale_python_refurb_auto_poetry *g:ale_python_refurb_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_refurb_auto_uv *g:ale_python_refurb_auto_uv*
*b:ale_python_refurb_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
reorder-python-imports *ale-python-reorder_python_imports*
@ -1259,6 +1528,36 @@ g:ale_python_reorder_python_imports_use_global
See |ale-integrations-local-executables|
g:ale_python_reorder_python_imports_auto_pipenv
*g:ale_python_reorder_python_imports_auto_pipenv*
*b:ale_python_reorder_python_imports_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_reorder_python_imports_auto_poetry
*g:ale_python_reorder_python_imports_auto_poetry*
*b:ale_python_reorder_python_imports_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_reorder_python_imports_auto_uv
*g:ale_python_reorder_python_imports_auto_uv*
*b:ale_python_reorder_python_imports_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
ruff *ale-python-ruff*
@ -1322,6 +1621,15 @@ g:ale_python_ruff_auto_poetry *g:ale_python_ruff_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_ruff_auto_uv *g:ale_python_ruff_auto_uv*
*b:ale_python_ruff_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
ruff-format *ale-python-ruff-format*
@ -1386,6 +1694,15 @@ g:ale_python_ruff_format_auto_poetry *g:ale_python_ruff_format_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_ruff_format_auto_uv *g:ale_python_ruff_format_auto_uv*
*b:ale_python_ruff_format_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
unimport *ale-python-unimport*
@ -1410,6 +1727,15 @@ g:ale_python_unimport_auto_poetry *g:ale_python_unimport_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_unimport_auto_uv *g:ale_python_unimport_auto_uv*
*b:ale_python_unimport_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
g:ale_python_unimport_executable *g:ale_python_unimport_executable*
*b:ale_python_unimport_executable*
Type: |String|
@ -1476,6 +1802,32 @@ g:ale_python_vulture_use_global *g:ale_python_vulture_use_global*
See |ale-integrations-local-executables|
g:ale_python_vulture_auto_pipenv *g:ale_python_vulture_auto_pipenv*
*b:ale_python_vulture_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_vulture_auto_poetry *g:ale_python_vulture_auto_poetry*
*b:ale_python_vulture_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_vulture_auto_uv *g:ale_python_vulture_auto_uv*
*b:ale_python_vulture_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
yapf *ale-python-yapf*
@ -1496,5 +1848,32 @@ g:ale_python_yapf_use_global *g:ale_python_yapf_use_global*
See |ale-integrations-local-executables|
g:ale_python_yapf_auto_pipenv *g:ale_python_yapf_auto_pipenv*
*b:ale_python_yapf_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_yapf_auto_poetry *g:ale_python_yapf_auto_poetry*
*b:ale_python_yapf_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
g:ale_python_yapf_auto_uv *g:ale_python_yapf_auto_uv*
*b:ale_python_yapf_auto_uv*
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -258,6 +258,24 @@ g:ale_ruby_syntax_tree_options *g:ale_ruby_syntax_tree_options*
This variable can be changed to modify flags given to SyntaxTree.
===============================================================================
rubyfmt *ale-ruby-rubyfmt*
g:ale_ruby_rubyfmt_executable *g:ale_ruby_rubyfmt_executable*
*b:ale_ruby_rubyfmt_executable*
Type: |String|
Default: `'rubyfmt'`
This option can be changed to change the path for `rubyfmt`.
g:ale_ruby_rubyfmt_options *g:ale_ruby_rubyfmt_options*
*b:ale_ruby_rubyfmt_options*
Type: |String|
Default: `''`
This option can be changed to pass extra options to `'rubyfmt'`.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -37,6 +37,9 @@ Notes:
* ASM
* `gcc`
* `llvm-mc`
* Astro
* `eslint`
* `prettier`
* AVRA
* `avra`
* Awk
@ -182,6 +185,7 @@ Notes:
* `erblint`
* `erubi`
* `erubis`
* `htmlbeautifier`
* `ruumba`
* Erlang
* `SyntaxErl`
@ -202,6 +206,9 @@ Notes:
* `fusion-lint`
* Git Commit Messages
* `gitlint`
* Gleam
* `gleam_format`
* `gleamlsp`
* GLSL
* `glslang`
* `glslls`
@ -271,6 +278,8 @@ Notes:
* `rustywind`
* `tidy`
* `write-good`
* Hurl
* `hurlfmt`
* Idris
* `idris`
* Ink
@ -290,6 +299,7 @@ Notes:
* `javalsp`
* `uncrustify`
* JavaScript
* `biome`
* `clang-format`
* `cspell`
* `deno`
@ -307,6 +317,7 @@ Notes:
* `xo`
* JSON
* `VSCode JSON language server`
* `biome`
* `clang-format`
* `cspell`
* `dprint`
@ -319,6 +330,7 @@ Notes:
* JSON5
* `eslint`
* JSONC
* `biome`
* `eslint`
* Jsonnet
* `jsonnet-lint`
@ -418,6 +430,8 @@ Notes:
* `ocamllsp`
* `ocp-indent`
* `ols`
* Odin
* `ols`
* OpenApi
* `ibm_validator`
* `prettier`
@ -558,10 +572,12 @@ Notes:
* `reek`
* `rubocop`
* `ruby`
* `rubyfmt`
* `rufo`
* `solargraph`
* `sorbet`
* `standardrb`
* `steep`
* `syntax_tree`
* Rust
* `cargo`!!
@ -650,6 +666,7 @@ Notes:
* TOML
* `dprint`
* TypeScript
* `biome`
* `cspell`
* `deno`
* `dprint`
@ -669,6 +686,7 @@ Notes:
* Verilog
* `hdl-checker`
* `iverilog`
* slang
* `verilator`
* `vlog`
* `xvlog`

View file

@ -2,6 +2,56 @@
ALE TypeScript Integration *ale-typescript-options*
===============================================================================
biome *ale-typescript-biome*
g:ale_biome_executable *g:ale_biome_executable*
*b:ale_biome_executable*
Type: |String|
Default: `'biome'`
g:ale_biome_options *g:ale_biome_options*
*b:ale_biome_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to `biome check` when
applying fixes.
g:ale_biome_use_global *g:ale_biome_use_global*
*b:ale_biome_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_biome_fixer_apply_unsafe *g:ale_biome_fixer_apply_unsafe*
*b:ale_biome_fixer_apply_unsafe*
Type: |Number|
Default: `0`
If set to `1`, biome will apply unsafe fixes along with safe fixes.
g:ale_biome_lsp_project_root *g:ale_biome_lsp_project_root*
*b:ale_biome_lsp_project_root*
Type: |String|
Default: `''`
If this variable is left unset, ALE will try to find the project root by
executing the following steps in the given order:
1. Find an ancestor directory containing a biome.json.
2. Find an ancestor directory containing a biome.jsonc.
3. Find an ancestor directory containing a package.json.
4. Find an ancestor directory containing a .git folder.
5. Use the directory of the current buffer (if the buffer was opened from
a file).
===============================================================================
cspell *ale-typescript-cspell*

View file

@ -3,7 +3,7 @@ ALE Verilog/SystemVerilog Integration *ale-verilog-options*
===============================================================================
ALE can use six different linters for Verilog HDL:
ALE can use seven different linters for Verilog HDL:
HDL Checker
Using `hdl_checker --lsp`
@ -11,6 +11,9 @@ ALE can use six different linters for Verilog HDL:
iverilog:
Using `iverilog -t null -Wall`
slang:
Using `slang -Weverything`
verilator
Using `verilator --lint-only -Wall`
@ -21,7 +24,7 @@ ALE can use six different linters for Verilog HDL:
Using `xvlog`
Yosys
Using `ysoys -Q -T -p 'read_verilog'`
Using `yosys -Q -T -p 'read_verilog'`
By default, both 'verilog' and 'systemverilog' filetypes are checked.
@ -64,6 +67,15 @@ iverilog *ale-verilog-iverilog*
No additional options
===============================================================================
slang *ale-verilog-slang*
g:ale_verilog_slang_option *g:ale_verilog_slang_options*
*b:ale_verilog_slang_options*
Type: String
Default: ''
This variable can be changed to modify 'slang' command arguments.
===============================================================================
verilator *ale-verilog-verilator*
@ -73,7 +85,7 @@ g:ale_verilog_verilator_options *g:ale_verilog_verilator_options*
Type: |String|
Default: `''`
This variable can be changed to modify 'verilator' command arguments
This variable can be changed to modify 'verilator' command arguments.
For example `'-sv --default-language "1800-2012"'` if you want to enable
SystemVerilog parsing and select the 2012 version of the language.

View file

@ -186,11 +186,11 @@ script like so. >
exec docker run -i --rm -v "$(pwd):/data" cytopia/pylint "$@"
<
You will run to run Docker commands with `-i` in order to read from stdin.
You will want to run Docker commands with `-i` in order to read from stdin.
With the above script in mind, you might configure ALE to lint your Python
project with `pylint` by providing the path to the script to execute, and
mappings which describe how to between the two file systems in your
mappings which describe how to change between the two file systems in your
`python.vim` |ftplugin| file, like so: >
if expand('%:p') =~# '^/home/w0rp/git/test-pylint/'
@ -1670,7 +1670,7 @@ g:ale_linters *g:ale_linters*
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'],
\ 'yaml': ['actionlint', 'spectral', 'yaml-language-server', 'yamllint'],
\}
<
This option can be used to enable only a particular set of linters for a
@ -2899,6 +2899,9 @@ documented in additional help files.
asm.....................................|ale-asm-options|
gcc...................................|ale-asm-gcc|
llvm_mc...............................|ale-asm-llvm_mc|
astro...................................|ale-astro-options|
eslint................................|ale-astro-eslint|
prettier..............................|ale-astro-prettier|
avra....................................|ale-avra-options|
avra..................................|ale-avra-avra|
awk.....................................|ale-awk-options|
@ -3020,6 +3023,7 @@ documented in additional help files.
eruby...................................|ale-eruby-options|
erb-formatter.........................|ale-eruby-erbformatter|
erblint...............................|ale-eruby-erblint|
htmlbeautifier........................|ale-eruby-htmlbeautifier|
ruumba................................|ale-eruby-ruumba|
fish....................................|ale-fish-options|
fish_indent...........................|ale-fish-fish_indent|
@ -3031,6 +3035,9 @@ documented in additional help files.
fusion-lint...........................|ale-fuse-fusionlint|
git commit..............................|ale-gitcommit-options|
gitlint...............................|ale-gitcommit-gitlint|
gleam...................................|ale-gleam-options|
gleam_format..........................|ale-gleam-gleam_format|
gleamlsp..............................|ale-gleam-gleamlsp|
glsl....................................|ale-glsl-options|
glslang...............................|ale-glsl-glslang|
glslls................................|ale-glsl-glslls|
@ -3095,6 +3102,8 @@ documented in additional help files.
tidy..................................|ale-html-tidy|
vscodehtml............................|ale-html-vscode|
write-good............................|ale-html-write-good|
hurl....................................|ale-hurl-options|
hurlfmt...............................|ale-hurl-hurlfmt|
idris...................................|ale-idris-options|
idris.................................|ale-idris-idris|
ink.....................................|ale-ink-options|
@ -3114,6 +3123,7 @@ documented in additional help files.
eclipselsp............................|ale-java-eclipselsp|
uncrustify............................|ale-java-uncrustify|
javascript..............................|ale-javascript-options|
biome.................................|ale-javascript-biome|
clang-format..........................|ale-javascript-clangformat|
cspell................................|ale-javascript-cspell|
deno..................................|ale-javascript-deno|
@ -3130,6 +3140,7 @@ documented in additional help files.
standard..............................|ale-javascript-standard|
xo....................................|ale-javascript-xo|
json....................................|ale-json-options|
biome.................................|ale-json-biome|
clang-format..........................|ale-json-clangformat|
cspell................................|ale-json-cspell|
dprint................................|ale-json-dprint|
@ -3141,6 +3152,7 @@ documented in additional help files.
spectral..............................|ale-json-spectral|
vscodejson............................|ale-json-vscode|
jsonc...................................|ale-jsonc-options|
biome.................................|ale-jsonc-biome|
eslint................................|ale-jsonc-eslint|
jsonnet.................................|ale-jsonnet-options|
jsonnetfmt............................|ale-jsonnet-jsonnetfmt|
@ -3220,6 +3232,8 @@ documented in additional help files.
ols...................................|ale-ocaml-ols|
ocamlformat...........................|ale-ocaml-ocamlformat|
ocp-indent............................|ale-ocaml-ocp-indent|
odin....................................|ale-odin-options|
ols...................................|ale-odin-ols|
openapi.................................|ale-openapi-options|
ibm_validator.........................|ale-openapi-ibm-validator|
prettier..............................|ale-openapi-prettier|
@ -3350,6 +3364,7 @@ documented in additional help files.
sorbet................................|ale-ruby-sorbet|
standardrb............................|ale-ruby-standardrb|
syntax_tree...........................|ale-ruby-syntax_tree|
rubyfmt...............................|ale-ruby-rubyfmt|
rust....................................|ale-rust-options|
analyzer..............................|ale-rust-analyzer|
cargo.................................|ale-rust-cargo|
@ -3436,6 +3451,7 @@ documented in additional help files.
toml....................................|ale-toml-options|
dprint................................|ale-toml-dprint|
typescript..............................|ale-typescript-options|
biome.................................|ale-typescript-biome|
cspell................................|ale-typescript-cspell|
deno..................................|ale-typescript-deno|
dprint................................|ale-typescript-dprint|
@ -3453,6 +3469,7 @@ documented in additional help files.
verilog/systemverilog...................|ale-verilog-options|
hdl-checker...........................|ale-verilog-hdl-checker|
iverilog..............................|ale-verilog-iverilog|
slang.................................|ale-verilog-slang|
verilator.............................|ale-verilog-verilator|
vlog..................................|ale-verilog-vlog|
xvlog.................................|ale-verilog-xvlog|

View file

@ -183,6 +183,9 @@ let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0)
" Enable automatic detection of poetry for Python linters.
let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0)
" Enable automatic detection of uv for Python linters.
let g:ale_python_auto_uv = get(g:, 'ale_python_auto_uv', 0)
" Enable automatic adjustment of environment variables for Python linters.
" The variables are set based on ALE's virtualenv detection.
let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0)

View file

@ -46,6 +46,9 @@ formatting.
* ASM
* [gcc](https://gcc.gnu.org)
* [llvm-mc](https://llvm.org)
* Astro
* [eslint](http://eslint.org/)
* [prettier](https://github.com/prettier/prettier)
* AVRA
* [avra](https://github.com/Ro5bert/avra)
* Awk
@ -191,6 +194,7 @@ formatting.
* [erblint](https://github.com/Shopify/erb-lint)
* [erubi](https://github.com/jeremyevans/erubi)
* [erubis](https://github.com/kwatch/erubis)
* [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier)
* [ruumba](https://github.com/ericqweinstein/ruumba)
* Erlang
* [SyntaxErl](https://github.com/ten0s/syntaxerl)
@ -211,6 +215,9 @@ formatting.
* [fusion-lint](https://github.com/RyanSquared/fusionscript)
* Git Commit Messages
* [gitlint](https://github.com/jorisroovers/gitlint)
* Gleam
* [gleam_format](https://github.com/gleam-lang/gleam)
* [gleamlsp](https://github.com/gleam-lang/gleam)
* GLSL
* [glslang](https://github.com/KhronosGroup/glslang)
* [glslls](https://github.com/svenstaro/glsl-language-server)
@ -280,6 +287,8 @@ formatting.
* [rustywind](https://github.com/avencera/rustywind)
* [tidy](http://www.html-tidy.org/)
* [write-good](https://github.com/btford/write-good)
* Hurl
* [hurlfmt](https://hurl.dev)
* Idris
* [idris](http://www.idris-lang.org/)
* Ink
@ -299,6 +308,7 @@ formatting.
* [javalsp](https://github.com/georgewfraser/vscode-javac)
* [uncrustify](https://github.com/uncrustify/uncrustify)
* JavaScript
* [biome](https://biomejs.dev/)
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [deno](https://deno.land/)
@ -316,6 +326,7 @@ formatting.
* [xo](https://github.com/sindresorhus/xo)
* JSON
* [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [biome](https://biomejs.dev/)
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [dprint](https://dprint.dev)
@ -328,6 +339,7 @@ formatting.
* JSON5
* [eslint](http://eslint.org/) :warning:
* JSONC
* [biome](https://biomejs.dev/)
* [eslint](http://eslint.org/) :warning:
* Jsonnet
* [jsonnet-lint](https://jsonnet.org/learning/tools.html)
@ -427,6 +439,8 @@ formatting.
* [ocamllsp](https://github.com/ocaml/ocaml-lsp)
* [ocp-indent](https://github.com/OCamlPro/ocp-indent)
* [ols](https://github.com/freebroccolo/ocaml-language-server)
* Odin
* [ols](https://github.com/DanielGavin/ols)
* OpenApi
* [ibm_validator](https://github.com/IBM/openapi-validator)
* [prettier](https://github.com/prettier/prettier)
@ -567,10 +581,12 @@ formatting.
* [reek](https://github.com/troessner/reek)
* [rubocop](https://github.com/bbatsov/rubocop)
* [ruby](https://www.ruby-lang.org)
* [rubyfmt](https://github.com/fables-tales/rubyfmt)
* [rufo](https://github.com/ruby-formatter/rufo)
* [solargraph](https://solargraph.org)
* [sorbet](https://github.com/sorbet/sorbet)
* [standardrb](https://github.com/testdouble/standard)
* [steep](https://github.com/soutaro/steep)
* [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree)
* Rust
* [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions)
@ -659,6 +675,7 @@ formatting.
* TOML
* [dprint](https://dprint.dev)
* TypeScript
* [biome](https://biomejs.dev/)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [deno](https://deno.land/)
* [dprint](https://dprint.dev/)
@ -678,6 +695,7 @@ formatting.
* Verilog
* [hdl-checker](https://pypi.org/project/hdl-checker)
* [iverilog](https://github.com/steveicarus/iverilog)
* [slang](https://github.com/MikePopoloski/slang)
* [verilator](http://www.veripool.org/projects/verilator/wiki/Intro)
* [vlog](https://www.mentor.com/products/fv/questa/)
* [xvlog](https://www.xilinx.com/products/design-tools/vivado.html)
@ -708,7 +726,7 @@ formatting.
* XML
* [xmllint](http://xmlsoft.org/xmllint.html)
* YAML
* [actionlint](https://github.com/rhysd/actionlint) :warning:
* [actionlint](https://github.com/rhysd/actionlint)
* [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: :warning:
* [gitlablint](https://github.com/elijah-roberts/gitlab-lint)
* [prettier](https://github.com/prettier/prettier)

View file

@ -4,3 +4,7 @@ dist.bat
*.zip
tags
*.sw[a-p]
# Github token.
github_token

View file

@ -0,0 +1,54 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
#version: 1
env_files:
# GoReleaser requires an API token with the 'repo' scope selected to deploy
# the artifacts to GitHub. You can create one here
# https://github.com/settings/tokens/new.
github_token: ./github_token
#before:
# hooks:
# # You may remove this if you don't use go modules.
# - go mod tidy
# # you may remove this if you don't need go generate
# - go generate ./...
builds:
- skip: true
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: '{{ .Tag }}-next'
changelog:
use: github-native
sort: asc
release:
draft: false
replace_existing_draft: true

View file

@ -1,7 +1,7 @@
*bufexplorer.txt* Buffer Explorer Last Change: 01 May 2023
*bufexplorer.txt* Buffer Explorer Last Change: 13 Aug 2024
Buffer Explorer *buffer-explorer* *bufexplorer*
Version 7.4.26
Version 7.4.27
Plugin for easily exploring (or browsing) Vim|:buffers|.
@ -263,6 +263,10 @@ The default is 1.
===============================================================================
CHANGE LOG *bufexplorer-changelog*
7.4.27 May 30, 2024
- Thanks to GitHub user NotNormallyAGitUser, for the recommendation to
change the display of the relative path to replace $HOME with "~".
This save valuable screen real estate.
7.4.26 May 01, 2023
What's Changed
- wipe explorer buffer on hide by @basharh in
@ -795,9 +799,9 @@ TODO *bufexplorer-todo*
===============================================================================
CREDITS *bufexplorer-credits*
Author: Jeff Lanzarotta <delux256-vim at outlook dot com>
Author: Jeff Lanzarotta <my name at gmail dot com>
Credit must go out to Bram Moolenaar and all the Vim developers for
Credit must go out to Bram Moolenaar (RIP) and all the Vim developers for
making the world's best editor (IMHO). I also want to thank everyone who
helped and gave me suggestions. I wouldn't want to leave anyone out so I
won't list names.
@ -805,7 +809,7 @@ won't list names.
===============================================================================
COPYRIGHT *bufexplorer-copyright*
Copyright (c) 2001-2022, Jeff Lanzarotta
Copyright (c) 2001-2024, Jeff Lanzarotta
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -0,0 +1,16 @@
https://goreleaser.com/quick-start/
To make a release...
1. Make changes.
2. Commit and push changes.
3. git tag -a v7.4.27 -m "Release v7.4.27."
4. git push origin v7.4.27
5. goreleaser release --clean
6. Go to github and make the release.
If something happens and the tag is messed up, you will need to delete the
local and remote tag and release again. To delete the tag:
1. git tag -d v7.4.27
2. git push --delete origin v7.4.27

View file

@ -1,5 +1,5 @@
"============================================================================
" Copyright: Copyright (c) 2001-2023, Jeff Lanzarotta
" Copyright: Copyright (c) 2001-2024, Jeff Lanzarotta
" All rights reserved.
"
" Redistribution and use in source and binary forms, with or
@ -36,7 +36,7 @@
" Name Of File: bufexplorer.vim
" Description: Buffer Explorer Vim Plugin
" Maintainer: Jeff Lanzarotta (my name at gmail dot com)
" Last Changed: Monday, 01 May 2023
" Last Changed: Tuesday, 13 August 2024
" Version: See g:bufexplorer_version for version number.
" Usage: This file should reside in the plugin directory and be
" automatically sourced.
@ -74,7 +74,7 @@ endif
"1}}}
" Version number
let g:bufexplorer_version = "7.4.26"
let g:bufexplorer_version = "7.4.27"
" Plugin Code {{{1
" Check for Vim version {{{2
@ -770,12 +770,12 @@ function! s:BuildBufferList()
" Are we to split the path and file name?
if g:bufExplorerSplitOutPathName
let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
let path = buf[type]
let path = substitute( buf[type], $HOME."\\>", "~", "" )
let pad = (g:bufExplorerShowUnlisted) ? s:allpads.shortname : s:listedpads.shortname
let line .= buf.shortname." ".strpart(pad.path, s:StringWidth(buf.shortname))
else
let type = (g:bufExplorerShowRelativePath) ? "relativename" : "fullname"
let path = buf[type]
let path = substitute( buf[type], $HOME."\\>", "~", "" )
let line .= path
endif

View file

@ -0,0 +1,20 @@
name: Auto-close PR
on:
pull_request_target:
types: [opened, reopened]
jobs:
close:
name: Run
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- run: |
gh pr close ${{ github.event.pull_request.number }} --comment \
"At the moment we are not accepting contributions to the repository.
Feedback for Copilot.vim can be given in the [Copilot community discussions](https://github.com/orgs/community/discussions/categories/copilot)."
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,4 +1,4 @@
# Copilot.vim
# GitHub Copilot for Vim and Neovim
GitHub Copilot uses OpenAI Codex to suggest code and entire functions in
real-time right from your editor. Trained on billions of lines of public
@ -48,7 +48,7 @@ Terms](https://docs.github.com/en/site-policy/github-terms/github-terms-for-addi
git clone https://github.com/github/copilot.vim.git `
$HOME/AppData/Local/nvim/pack/github/start/copilot.vim
4. Start Neovim and invoke `:Copilot setup`.
4. Start Vim/Neovim and invoke `:Copilot setup`.
[Node.js]: https://nodejs.org/en/download/
[Neovim]: https://github.com/neovim/neovim/releases/latest

View file

@ -1,11 +1,6 @@
if exists('g:autoloaded_copilot')
finish
endif
let g:autoloaded_copilot = 1
scriptencoding utf-8
let s:has_nvim_ghost_text = has('nvim-0.6') && exists('*nvim_buf_get_mark')
let s:has_nvim_ghost_text = has('nvim-0.7') && exists('*nvim_buf_get_mark')
let s:vim_minimum_version = '9.0.0185'
let s:has_vim_ghost_text = has('patch-' . s:vim_minimum_version) && has('textprop')
let s:has_ghost_text = s:has_nvim_ghost_text || s:has_vim_ghost_text
@ -39,81 +34,68 @@ function! s:EditorConfiguration() abort
\ }
endfunction
function! s:StatusNotification(params, ...) abort
let status = get(a:params, 'status', '')
if status ==? 'error'
let s:agent_error = a:params.message
else
unlet! s:agent_error
endif
endfunction
function! copilot#Init(...) abort
call timer_start(0, { _ -> s:Start() })
call copilot#util#Defer({ -> exists('s:client') || s:Start() })
endfunction
function! s:Running() abort
return exists('s:agent.job') || exists('s:agent.client_id')
return exists('s:client.job') || exists('s:client.client_id')
endfunction
function! s:Start() abort
if s:Running()
if s:Running() || exists('s:client.startup_error')
return
endif
let s:agent = copilot#agent#New({'methods': {
\ 'statusNotification': function('s:StatusNotification'),
\ 'PanelSolution': function('copilot#panel#Solution'),
\ 'PanelSolutionsDone': function('copilot#panel#SolutionsDone'),
\ 'copilot/openURL': function('s:OpenURL'),
\ },
\ 'editorConfiguration' : s:EditorConfiguration()})
let s:client = copilot#client#New({'editorConfiguration' : s:EditorConfiguration()})
endfunction
function! s:Stop() abort
if exists('s:agent')
let agent = remove(s:, 'agent')
call agent.Close()
if exists('s:client')
let client = remove(s:, 'client')
call client.Close()
endif
endfunction
function! copilot#Agent() abort
function! copilot#Client() abort
call s:Start()
return s:agent
return s:client
endfunction
function! copilot#RunningAgent() abort
function! copilot#RunningClient() abort
if s:Running()
return s:agent
return s:client
else
return v:null
endif
endfunction
function! s:NodeVersionWarning() abort
if exists('s:agent.node_version') && s:agent.node_version =~# '^16\.'
if has('nvim-0.7') && !has(luaeval('vim.version().api_prerelease') ? 'nvim-0.8.1' : 'nvim-0.8.0')
let s:editor_warning = 'Neovim 0.7 support is deprecated and will be dropped in a future release of copilot.vim.'
endif
if has('vim_starting') && exists('s:editor_warning')
call copilot#logger#Warn(s:editor_warning)
endif
function! s:EditorVersionWarning() abort
if exists('s:editor_warning')
echohl WarningMsg
echo "Warning: Node.js 16 is approaching end of life and support will be dropped in a future release of copilot.vim."
echohl NONE
elseif exists('s:agent.node_version_warning')
echohl WarningMsg
echo 'Warning:' s:agent.node_version_warning
echohl NONE
echo 'Warning: ' . s:editor_warning
echohl None
endif
endfunction
function! copilot#Request(method, params, ...) abort
let agent = copilot#Agent()
return call(agent.Request, [a:method, a:params] + a:000)
let client = copilot#Client()
return call(client.Request, [a:method, a:params] + a:000)
endfunction
function! copilot#Call(method, params, ...) abort
let agent = copilot#Agent()
return call(agent.Call, [a:method, a:params] + a:000)
let client = copilot#Client()
return call(client.Call, [a:method, a:params] + a:000)
endfunction
function! copilot#Notify(method, params, ...) abort
let agent = copilot#Agent()
return call(agent.Notify, [a:method, a:params] + a:000)
let client = copilot#Client()
return call(client.Notify, [a:method, a:params] + a:000)
endfunction
function! copilot#NvimNs() abort
@ -125,37 +107,21 @@ function! copilot#Clear() abort
call timer_stop(remove(g:, '_copilot_timer'))
endif
if exists('b:_copilot')
call copilot#agent#Cancel(get(b:_copilot, 'first', {}))
call copilot#agent#Cancel(get(b:_copilot, 'cycling', {}))
call copilot#client#Cancel(get(b:_copilot, 'first', {}))
call copilot#client#Cancel(get(b:_copilot, 'cycling', {}))
endif
call s:UpdatePreview()
unlet! b:_copilot
return ''
endfunction
function! s:Reject(bufnr) abort
try
let dict = getbufvar(a:bufnr, '_copilot')
if type(dict) == v:t_dict && !empty(get(dict, 'shown_choices', {}))
call copilot#Request('notifyRejected', {'uuids': keys(dict.shown_choices)})
let dict.shown_choices = {}
endif
catch
call copilot#logger#Exception()
endtry
endfunction
function! copilot#Dismiss() abort
call s:Reject('%')
call copilot#Clear()
call s:UpdatePreview()
return ''
endfunction
let s:filetype_defaults = {
\ 'yaml': 0,
\ 'markdown': 0,
\ 'help': 0,
\ 'gitcommit': 0,
\ 'gitrebase': 0,
\ 'hgcommit': 0,
@ -192,26 +158,41 @@ endfunction
function! copilot#Enabled() abort
return get(g:, 'copilot_enabled', 1)
\ && empty(s:BufferDisabled())
\ && empty(copilot#Agent().StartupError())
endfunction
let s:inline_invoked = 1
let s:inline_automatic = 2
function! copilot#Complete(...) abort
if exists('g:_copilot_timer')
call timer_stop(remove(g:, '_copilot_timer'))
endif
let params = copilot#doc#Params()
if !exists('b:_copilot.params') || b:_copilot.params !=# params
let b:_copilot = {'params': params, 'first':
\ copilot#Request('getCompletions', params)}
let target = [bufnr(''), getbufvar('', 'changedtick'), line('.'), col('.')]
if !exists('b:_copilot.target') || b:_copilot.target !=# target
if exists('b:_copilot.first')
call copilot#client#Cancel(b:_copilot.first)
endif
if exists('b:_copilot.cycling')
call copilot#client#Cancel(b:_copilot.cycling)
endif
let params = {
\ 'textDocument': {'uri': bufnr('')},
\ 'position': copilot#util#AppendPosition(),
\ 'formattingOptions': {'insertSpaces': &expandtab ? v:true : v:false, 'tabSize': shiftwidth()},
\ 'context': {'triggerKind': s:inline_automatic}}
let b:_copilot = {
\ 'target': target,
\ 'params': params,
\ 'first': copilot#Request('textDocument/inlineCompletion', params)}
let g:_copilot_last = b:_copilot
endif
let completion = b:_copilot.first
if !a:0
return completion.Await()
else
call copilot#agent#Result(completion, a:1)
call copilot#client#Result(completion, function(a:1, [b:_copilot]))
if a:0 > 1
call copilot#agent#Error(completion, a:2)
call copilot#client#Error(completion, function(a:2, [b:_copilot]))
endif
endif
endfunction
@ -221,37 +202,37 @@ function! s:HideDuringCompletion() abort
endfunction
function! s:SuggestionTextWithAdjustments() abort
let empty = ['', 0, 0, {}]
try
if mode() !~# '^[iR]' || (s:HideDuringCompletion() && pumvisible()) || !exists('b:_copilot.suggestions')
return ['', 0, 0, '']
return empty
endif
let choice = get(b:_copilot.suggestions, b:_copilot.choice, {})
if !has_key(choice, 'range') || choice.range.start.line != line('.') - 1 || type(choice.text) !=# v:t_string
return ['', 0, 0, '']
if !has_key(choice, 'range') || choice.range.start.line != line('.') - 1 || type(choice.insertText) !=# v:t_string
return empty
endif
let line = getline('.')
let offset = col('.') - 1
let choice_text = strpart(line, 0, copilot#doc#UTF16ToByteIdx(line, choice.range.start.character)) . choice.text
let choice_text = strpart(line, 0, copilot#util#UTF16ToByteIdx(line, choice.range.start.character)) . substitute(choice.insertText, "\n*$", '', '')
let typed = strpart(line, 0, offset)
let end_offset = copilot#doc#UTF16ToByteIdx(line, choice.range.end.character)
let end_offset = copilot#util#UTF16ToByteIdx(line, choice.range.end.character)
if end_offset < 0
let end_offset = len(line)
endif
let delete = strpart(line, offset, end_offset - offset)
let uuid = get(choice, 'uuid', '')
if typed =~# '^\s*$'
let leading = matchstr(choice_text, '^\s\+')
let unindented = strpart(choice_text, len(leading))
if strpart(typed, 0, len(leading)) == leading && unindented !=# delete
return [unindented, len(typed) - len(leading), strchars(delete), uuid]
return [unindented, len(typed) - len(leading), strchars(delete), choice]
endif
elseif typed ==# strpart(choice_text, 0, offset)
return [strpart(choice_text, offset), 0, strchars(delete), uuid]
return [strpart(choice_text, offset), 0, strchars(delete), choice]
endif
catch
call copilot#logger#Exception()
endtry
return ['', 0, 0, '']
return empty
endfunction
@ -271,12 +252,12 @@ function! s:GetSuggestionsCyclingCallback(context, result) abort
let callbacks = remove(a:context, 'cycling_callbacks')
let seen = {}
for suggestion in a:context.suggestions
let seen[suggestion.text] = 1
let seen[suggestion.insertText] = 1
endfor
for suggestion in get(a:result, 'completions', [])
if !has_key(seen, suggestion.text)
for suggestion in get(a:result, 'items', [])
if !has_key(seen, suggestion.insertText)
call add(a:context.suggestions, suggestion)
let seen[suggestion.text] = 1
let seen[suggestion.insertText] = 1
endif
endfor
for Callback in callbacks
@ -290,9 +271,11 @@ function! s:GetSuggestionsCycling(callback) abort
elseif exists('b:_copilot.cycling')
call a:callback(b:_copilot)
elseif exists('b:_copilot.suggestions')
let params = deepcopy(b:_copilot.first.params)
let params.context.triggerKind = s:inline_invoked
let b:_copilot.cycling_callbacks = [a:callback]
let b:_copilot.cycling = copilot#Request('getCompletionsCycling',
\ b:_copilot.first.params,
let b:_copilot.cycling = copilot#Request('textDocument/inlineCompletion',
\ params,
\ function('s:GetSuggestionsCyclingCallback', [b:_copilot]),
\ function('s:GetSuggestionsCyclingCallback', [b:_copilot]),
\ )
@ -310,10 +293,10 @@ function! copilot#Previous() abort
endfunction
function! copilot#GetDisplayedSuggestion() abort
let [text, outdent, delete, uuid] = s:SuggestionTextWithAdjustments()
let [text, outdent, delete, item] = s:SuggestionTextWithAdjustments()
return {
\ 'uuid': uuid,
\ 'item': item,
\ 'text': text,
\ 'outdentSize': outdent,
\ 'deleteSize': delete}
@ -330,8 +313,8 @@ endfunction
function! s:UpdatePreview() abort
try
let [text, outdent, delete, uuid] = s:SuggestionTextWithAdjustments()
let text = split(text, "\n", 1)
let [text, outdent, delete, item] = s:SuggestionTextWithAdjustments()
let text = split(text, "\r\n\\=\\|\n", 1)
if empty(text[-1])
call remove(text, -1)
endif
@ -348,7 +331,7 @@ function! s:UpdatePreview() abort
call s:ClearPreview()
if s:has_nvim_ghost_text
let data = {'id': 1}
let data.virt_text_win_col = virtcol('.') - 1
let data.virt_text_pos = 'overlay'
let append = strpart(getline('.'), col('.') - 1 + delete)
let data.virt_text = [[text[0] . append . repeat(' ', delete - len(text[0])), s:hlgroup]]
if len(text) > 1
@ -361,8 +344,27 @@ function! s:UpdatePreview() abort
endif
let data.hl_mode = 'combine'
call nvim_buf_set_extmark(0, copilot#NvimNs(), line('.')-1, col('.')-1, data)
elseif s:has_vim_ghost_text
let new_suffix = text[0]
let current_suffix = getline('.')[col('.') - 1 :]
let inset = ''
while delete > 0 && !empty(new_suffix)
let last_char = matchstr(new_suffix, '.$')
let new_suffix = matchstr(new_suffix, '^.\{-\}\ze.$')
if last_char ==# matchstr(current_suffix, '.$')
if !empty(inset)
call prop_add(line('.'), col('.') + len(current_suffix), {'type': s:hlgroup, 'text': inset})
let inset = ''
endif
let current_suffix = matchstr(current_suffix, '^.\{-\}\ze.$')
let delete -= 1
else
call prop_add(line('.'), col('.'), {'type': s:hlgroup, 'text': text[0]})
let inset = last_char . inset
endif
endwhile
if !empty(new_suffix . inset)
call prop_add(line('.'), col('.'), {'type': s:hlgroup, 'text': new_suffix . inset})
endif
for line in text[1:]
call prop_add(line('.'), 0, {'type': s:hlgroup, 'text_align': 'below', 'text': line})
endfor
@ -370,28 +372,35 @@ function! s:UpdatePreview() abort
call prop_add(line('.'), col('$'), {'type': s:annot_hlgroup, 'text': ' ' . annot})
endif
endif
if !has_key(b:_copilot.shown_choices, uuid)
let b:_copilot.shown_choices[uuid] = v:true
call copilot#Request('notifyShown', {'uuid': uuid})
endif
call copilot#Notify('textDocument/didShowCompletion', {'item': item})
catch
return copilot#logger#Exception()
endtry
endfunction
function! s:HandleTriggerResult(result) abort
if !exists('b:_copilot')
return
endif
let b:_copilot.suggestions = get(a:result, 'completions', [])
let b:_copilot.choice = 0
let b:_copilot.shown_choices = {}
function! s:HandleTriggerResult(state, result) abort
let a:state.suggestions = type(a:result) == type([]) ? a:result : get(empty(a:result) ? {} : a:result, 'items', [])
let a:state.choice = 0
if get(b:, '_copilot') is# a:state
call s:UpdatePreview()
endif
endfunction
function! s:HandleTriggerError(state, result) abort
let a:state.suggestions = []
let a:state.choice = 0
let a:state.error = a:result
if get(b:, '_copilot') is# a:state
call s:UpdatePreview()
endif
endfunction
function! copilot#Suggest() abort
if !s:Running()
return ''
endif
try
call copilot#Complete(function('s:HandleTriggerResult'), function('s:HandleTriggerResult'))
call copilot#Complete(function('s:HandleTriggerResult'), function('s:HandleTriggerError'))
catch
call copilot#logger#Exception()
endtry
@ -400,30 +409,52 @@ endfunction
function! s:Trigger(bufnr, timer) abort
let timer = get(g:, '_copilot_timer', -1)
unlet! g:_copilot_timer
if a:bufnr !=# bufnr('') || a:timer isnot# timer || mode() !=# 'i'
return
endif
unlet! g:_copilot_timer
return copilot#Suggest()
endfunction
function! copilot#IsMapped() abort
return get(g:, 'copilot_assume_mapped') ||
\ hasmapto('copilot#Accept(', 'i')
endfunction
function! copilot#Schedule(...) abort
if !s:has_ghost_text || !copilot#Enabled() || !copilot#IsMapped()
function! copilot#Schedule() abort
if !s:has_ghost_text || !s:Running() || !copilot#Enabled()
call copilot#Clear()
return
endif
call s:UpdatePreview()
let delay = a:0 ? a:1 : get(g:, 'copilot_idle_delay', 15)
let delay = get(g:, 'copilot_idle_delay', 45)
call timer_stop(get(g:, '_copilot_timer', -1))
let g:_copilot_timer = timer_start(delay, function('s:Trigger', [bufnr('')]))
endfunction
function! copilot#OnInsertLeave() abort
return copilot#Clear()
function! s:Attach(bufnr, ...) abort
try
return copilot#Client().Attach(a:bufnr)
catch
call copilot#logger#Exception()
endtry
endfunction
function! copilot#OnFileType() abort
if empty(s:BufferDisabled()) && &l:modifiable && &l:buflisted
call copilot#util#Defer(function('s:Attach'), bufnr(''))
endif
endfunction
function! s:Focus(bufnr, ...) abort
if s:Running() && copilot#Client().IsAttached(a:bufnr)
call copilot#Client().Notify('textDocument/didFocus', {'textDocument': {'uri': copilot#Client().Attach(a:bufnr).uri}})
endif
endfunction
function! copilot#OnBufEnter() abort
let bufnr = bufnr('')
call copilot#util#Defer(function('s:Focus'), bufnr)
endfunction
function! copilot#OnInsertLeavePre() abort
call copilot#Clear()
call s:ClearPreview()
endfunction
function! copilot#OnInsertEnter() abort
@ -443,7 +474,6 @@ function! copilot#OnCursorMovedI() abort
endfunction
function! copilot#OnBufUnload() abort
call s:Reject(+expand('<abuf>'))
endfunction
function! copilot#OnVimLeavePre() abort
@ -468,11 +498,19 @@ function! copilot#Accept(...) abort
if empty(text)
let text = s.text
endif
call copilot#Request('notifyAccepted', {'uuid': s.uuid, 'acceptedLength': copilot#doc#UTF16Width(text)})
if text ==# s.text && has_key(s.item, 'command')
call copilot#Request('workspace/executeCommand', s.item.command)
else
let line_text = strpart(getline('.'), 0, col('.') - 1) . text
call copilot#Notify('textDocument/didPartiallyAcceptCompletion', {
\ 'item': s.item,
\ 'acceptedLength': copilot#util#UTF16Width(line_text) - s.item.range.start.character})
endif
call s:ClearPreview()
let s:suggestion_text = text
let recall = text =~# "\n" ? "\<C-R>\<C-O>=" : "\<C-R>\<C-R>="
return repeat("\<Left>\<Del>", s.outdentSize) . repeat("\<Del>", s.deleteSize) .
\ "\<C-R>\<C-O>=copilot#TextQueuedForInsertion()\<CR>" . (a:0 > 1 ? '' : "\<End>")
\ recall . "copilot#TextQueuedForInsertion()\<CR>" . (a:0 > 1 ? '' : "\<End>")
endif
let default = get(g:, 'copilot_tab_fallback', pumvisible() ? "\<C-N>" : "\t")
if !a:0
@ -525,21 +563,6 @@ function! copilot#Browser() abort
endif
endfunction
function! s:OpenURL(params) abort
echo a:params.target
let browser = copilot#Browser()
if empty(browser)
return v:false
endif
let status = {}
call copilot#job#Stream(browser + [a:params.target], v:null, v:null, function('s:BrowserCallback', [status]))
let time = reltime()
while empty(status) && reltimefloat(reltime(time)) < 1
sleep 10m
endwhile
return get(status, 'code') ? v:false : v:true
endfunction
let s:commands = {}
function! s:EnabledStatusMessage() abort
@ -550,8 +573,6 @@ function! s:EnabledStatusMessage() abort
else
return "Vim " . s:vim_minimum_version . " required to support ghost text"
endif
elseif !copilot#IsMapped()
return '<Tab> map has been disabled or is claimed by another plugin'
elseif !get(g:, 'copilot_enabled', 1)
return 'Disabled globally by :Copilot disable'
elseif buf_disabled is# 5
@ -572,7 +593,7 @@ function! s:EnabledStatusMessage() abort
endfunction
function! s:VerifySetup() abort
let error = copilot#Agent().StartupError()
let error = copilot#Client().StartupError()
if !empty(error)
echo 'Copilot: ' . error
return
@ -589,6 +610,12 @@ function! s:VerifySetup() abort
echo 'Copilot: Telemetry terms not accepted. Invoke :Copilot setup'
return
endif
if status.status ==# 'NotAuthorized'
echo "Copilot: You don't have access to GitHub Copilot. Sign up by visiting https://github.com/settings/copilot"
return
endif
return 1
endfunction
@ -597,31 +624,22 @@ function! s:commands.status(opts) abort
return
endif
if exists('s:client.status.status') && s:client.status.status =~# 'Warning\|Error'
echo 'Copilot: ' . s:client.status.status
if !empty(get(s:client.status, 'message', ''))
echon ': ' . s:client.status.message
endif
return
endif
let status = s:EnabledStatusMessage()
if !empty(status)
echo 'Copilot: ' . status
return
endif
let startup_error = copilot#Agent().StartupError()
if !empty(startup_error)
echo 'Copilot: ' . startup_error
return
endif
if exists('s:agent_error')
echo 'Copilot: ' . s:agent_error
return
endif
let status = copilot#Call('checkStatus', {})
if status.status ==# 'NotAuthorized'
echo 'Copilot: Not authorized'
return
endif
echo 'Copilot: Enabled and online'
call s:NodeVersionWarning()
echo 'Copilot: Ready'
call s:EditorVersionWarning()
endfunction
function! s:commands.signout(opts) abort
@ -635,7 +653,7 @@ function! s:commands.signout(opts) abort
endfunction
function! s:commands.setup(opts) abort
let startup_error = copilot#Agent().StartupError()
let startup_error = copilot#Client().StartupError()
if !empty(startup_error)
echo 'Copilot: ' . startup_error
return
@ -645,7 +663,7 @@ function! s:commands.setup(opts) abort
let status = copilot#Call('checkStatus', {})
if has_key(status, 'user')
let data = {}
let data = {'status': 'AlreadySignedIn', 'user': status.user}
else
let data = copilot#Call('signInInitiate', {})
endif
@ -653,23 +671,25 @@ function! s:commands.setup(opts) abort
if has_key(data, 'verificationUri')
let uri = data.verificationUri
if has('clipboard')
try
let @+ = data.userCode
catch
endtry
try
let @* = data.userCode
catch
endtry
endif
call s:Echo("First copy your one-time code: " . data.userCode)
let codemsg = "First copy your one-time code: " . data.userCode . "\n"
try
if len(&mouse)
let mouse = &mouse
set mouse=
endif
if get(a:opts, 'bang')
call s:Echo("In your browser, visit " . uri)
call s:Echo(codemsg . "In your browser, visit " . uri)
elseif len(browser)
call s:Echo("Press ENTER to open GitHub in your browser")
let c = getchar()
while c isnot# 13 && c isnot# 10 && c isnot# 0
let c = getchar()
endwhile
call input(codemsg . "Press ENTER to open GitHub in your browser\n")
let status = {}
call copilot#job#Stream(browser + [uri], v:null, v:null, function('s:BrowserCallback', [status]))
let time = reltime()
@ -682,9 +702,9 @@ function! s:commands.setup(opts) abort
call s:Echo("Opened " . uri)
endif
else
call s:Echo("Could not find browser. Visit " . uri)
call s:Echo(codemsg . "Could not find browser. Visit " . uri)
endif
call s:Echo("Waiting (could take up to 5 seconds)")
call s:Echo("Waiting (could take up to 10 seconds)")
let request = copilot#Request('signInConfirm', {'userCode': data.userCode}).Wait()
finally
if exists('mouse')
@ -696,6 +716,8 @@ function! s:commands.setup(opts) abort
else
let status = request.result
endif
elseif get(data, 'status', '') isnot# 'AlreadySignedIn'
return 'echoerr ' . string('Copilot: Something went wrong')
endif
let user = get(status, 'user', '<unknown>')
@ -704,22 +726,46 @@ function! s:commands.setup(opts) abort
endfunction
let s:commands.auth = s:commands.setup
let s:commands.signin = s:commands.setup
function! s:commands.help(opts) abort
return a:opts.mods . ' help ' . (len(a:opts.arg) ? ':Copilot_' . a:opts.arg : 'copilot')
endfunction
function! s:commands.version(opts) abort
let info = copilot#agent#EditorInfo()
echo 'copilot.vim ' .info.editorPluginInfo.version
echo info.editorInfo.name . ' ' . info.editorInfo.version
if exists('s:agent.node_version')
echo 'dist/agent.js ' . s:agent.Call('getVersion', {}).version
echo 'Node.js ' . s:agent.node_version
call s:NodeVersionWarning()
echo 'copilot.vim ' .copilot#client#EditorPluginInfo().version
let editorInfo = copilot#client#EditorInfo()
echo editorInfo.name . ' ' . editorInfo.version
if s:Running()
let versions = s:client.Request('getVersion', {})
if exists('s:client.serverInfo.version')
echo s:client.serverInfo.name . ' ' . s:client.serverInfo.version
else
echo 'dist/agent.js not running'
echo 'GitHub Copilot Language Server ' . versions.Await().version
endif
if exists('s:client.node_version')
echo 'Node.js ' . s:client.node_version
else
echo 'Node.js ' . substitute(get(versions.Await(), 'runtimeVersion', '?'), '^node/', '', 'g')
endif
else
echo 'Not running'
if exists('s:client.node_version')
echo 'Node.js ' . s:client.node_version
endif
endif
if has('win32')
echo 'Windows'
elseif has('macunix')
echo 'macOS'
elseif !has('unix')
echo 'Unknown OS'
elseif isdirectory('/sys/kernel')
echo 'Linux'
else
echo 'UNIX'
endif
call s:EditorVersionWarning()
endfunction
function! s:UpdateEditorConfiguration() abort
@ -743,11 +789,8 @@ endfunction
function! s:commands.restart(opts) abort
call s:Stop()
let err = copilot#Agent().StartupError()
if !empty(err)
return 'echoerr ' . string('Copilot: ' . err)
endif
echo 'Copilot: Restarting agent.'
echo 'Copilot: Restarting language server'
call s:Start()
endfunction
function! s:commands.disable(opts) abort
@ -766,6 +809,10 @@ function! s:commands.panel(opts) abort
endif
endfunction
function! s:commands.log(opts) abort
return a:opts.mods . ' split +$ copilot:///log'
endfunction
function! copilot#CommandComplete(arg, lead, pos) abort
let args = matchstr(strpart(a:lead, 0, a:pos), 'C\%[opilot][! ] *\zs.*')
if args !~# ' '
@ -779,33 +826,28 @@ endfunction
function! copilot#Command(line1, line2, range, bang, mods, arg) abort
let cmd = matchstr(a:arg, '^\%(\\.\|\S\)\+')
let arg = matchstr(a:arg, '\s\zs\S.*')
if cmd ==# 'log'
return a:mods . ' split +$ ' . fnameescape(copilot#logger#File())
endif
if !empty(cmd) && !has_key(s:commands, tr(cmd, '-', '_'))
return 'echoerr ' . string('Copilot: unknown command ' . string(cmd))
endif
try
let err = copilot#Agent().StartupError()
if !empty(err)
return 'echo ' . string('Copilot: ' . err)
endif
if empty(cmd)
if !s:Running()
let cmd = 'restart'
else
try
let opts = copilot#Call('checkStatus', {'options': {'localChecksOnly': v:true}})
catch
call copilot#logger#Exception()
let opts = {'status': 'VimException'}
endtry
if empty(cmd)
if opts.status ==# 'VimException'
return a:mods . ' split +$ ' . fnameescape(copilot#logger#File())
elseif opts.status !=# 'OK' && opts.status !=# 'MaybeOK'
if opts.status !=# 'OK' && opts.status !=# 'MaybeOK'
let cmd = 'setup'
else
let cmd = 'panel'
endif
catch
call copilot#logger#Exception()
let cmd = 'log'
endtry
endif
call extend(opts, {'line1': a:line1, 'line2': a:line2, 'range': a:range, 'bang': a:bang, 'mods': a:mods, 'arg': arg})
endif
let opts = {'line1': a:line1, 'line2': a:line2, 'range': a:range, 'bang': a:bang, 'mods': a:mods, 'arg': arg}
let retval = s:commands[tr(cmd, '-', '_')](opts)
if type(retval) == v:t_string
return retval

Some files were not shown because too many files have changed in this diff Show more