Compare commits

..

19 Commits

Author SHA1 Message Date
w0rp
e1c8d665d6 #3600 Implement pull model with Neovim Client
Implement the diagnostics pull model with the LSP Neovim client. We
must handle messages a little different and tweak client capabilities
for pull diagnostics to work through the Neovim client.
2025-03-23 16:08:18 +00:00
w0rp
fe50a711cb Close #3600 - Implement pull diagnostics in VimL
Implement pull diagnostics in the VimL implementation so ALE is able
to track when servers are busy checking files. Only servers that
support this feature will return diagnostics these ways.
2025-03-23 16:07:46 +00:00
w0rp
19e1b5a9d3 Implement ale.queue for calling ale#Queue in Lua 2025-03-22 01:10:11 +00:00
w0rp
33a902f489 Implement ale.pad in Lua 2025-03-22 00:43:29 +00:00
w0rp
a1c57918ef Implement ale.get_filename_mappings in Lua 2025-03-22 00:35:53 +00:00
w0rp
1aae83497d Add ale.has to mirror ale#Has in Lua 2025-03-22 00:04:46 +00:00
w0rp
f4af0dc84b Add basic Lua ALE functions and test coverage
Ensure that basic ALE functions `ale.var`, `ale.escape`, and `ale.env`
are available in Lua. Cover all Lua code so far with busted tests,
fixing bugs where ALE variables can be set with Boolean values instead
of numbers. Document all functionality so far.
2025-03-21 23:37:35 +00:00
w0rp
7f43666fb3 Detect the Lua project root using .luarc.json 2025-03-21 12:07:10 +00:00
w0rp
bcd1a12949 Implement Lua ALE setup & overhaul documentation
1. Add ale.setup and ale.setup.buffer for pure Lua configuration.
2. Update many global settings to use Booleans instead of numbers to
   make types easiert to work with in Lua.
3. Radically reformat documentation and fix errors to make
   documentation more usable for Neovim users.
2025-03-20 21:52:13 +00:00
w0rp
53f036fe9f Support g:ale_shell with the Neovim LSP client 2025-03-20 21:45:19 +00:00
w0rp
3dfebe45c6 Add Neovim TCP connections to language servers
Support TCP connections to language servers through Neovim's built in
client. In all but what is currently the nightly builds of Neovim
connections via a hostname will fail, but connections via an IP address
should function. We will still enable the built in Neovim client by
default anyway, as LSP clients very rarely connect over TCP.
2025-03-20 21:45:19 +00:00
w0rp
964e0a2e39 Supply language_id values to Neovim LSP API
Change logic so ALE's LSP implementation and the Neovim LSP client
retrieve the language_id for language clients at roughly the same time
via the same means. This makes ALE inform the language server what the
language for the language is for clients.
2025-03-20 21:45:19 +00:00
w0rp
ee975196ff Fix tests for Neovim LSP integration 2025-03-20 21:45:19 +00:00
w0rp
3f7ea86ae1 Update documentation for Neovim LSP integration
Update documentation to advertise ALE's integration with Neovim's native
LSP client, and explain how functionality is integrated with ALE,
Neovim's native tools, and other plugins.
2025-03-20 21:45:18 +00:00
w0rp
dd8d7cb4b4 Clean up message handling for LSP integration
Now we ought to be able to handle any kind of response for any request
we send, clean up message handling so there are fewer changes to make
to LSP code to adjust for Neovim integration.
2025-03-20 21:45:18 +00:00
w0rp
8216ee4a65 Handle other LSP capabilities via ALE
Save capabilities from language servers ALE connects to via Neovim's LSP
client and handle responses to requests ALE sends to language servers.
This enables ALE to work with Neovim's language client for its commands
while also letting users directly use the connected clients for native
Neovim keybinds and so on.
2025-03-20 21:45:18 +00:00
w0rp
9a251b2865 Remove the log_level line from Lua code 2025-03-20 21:45:18 +00:00
w0rp
61a1fcc92f Handle Neovim LSP diagnostics via ALE's functions 2025-03-20 21:45:18 +00:00
w0rp
c9eb8f9d15 Start up language servers with Neovim's API
Get language servers starting and displaying diagnostics with Neovim's
API in Neovim 0.8 and up. With this set up, now ALE needs to take over
handling diagnostics returned by the language servers.
2025-03-20 21:45:18 +00:00
68 changed files with 191 additions and 1069 deletions

View File

@@ -1,7 +1,6 @@
---
name: Report a bug
labels: bug
type: Bug
about: Report a bug with ALE.
---

View File

@@ -1,7 +1,6 @@
---
name: Suggest a new linter or fixer
labels: new tool
type: Task
about: Suggest a new tool ALE can officially integrate with.
---

View File

@@ -1,7 +1,6 @@
---
name: Suggest an improvement
labels: enhancement
type: Feature
about: Suggest some way to improve ALE, or add a new feature.
---

View File

@@ -7,8 +7,7 @@
"test"
],
"workspace.library": [
"/usr/share/nvim/runtime/lua",
"/opt/homebrew/share/nvim/runtime/lua"
"/usr/share/nvim/runtime/lua"
],
"runtime.pathStrict": true,
"runtime.path": [

View File

@@ -1,43 +0,0 @@
" Description: named-checkzone for bindzone
call ale#Set('bindzone_checkzone_executable', 'named-checkzone')
call ale#Set('bindzone_checkzone_options', '-c IN')
function! ale_linters#bindzone#checkzone#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'bindzone_checkzone_options'))
\ . ' example.com %t'
endfunction
function! ale_linters#bindzone#checkzone#Handle(buffer, lines) abort
let l:warning_pattern = '\vzone example.com/IN: (.+)$'
let l:error_pattern = '\v:(\d+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:error_pattern)
let l:lnum = l:match[1]
let l:text = l:match[2]
call add(l:output, {'text': l:text, 'lnum': l:lnum + 0, 'type': 'E'})
endfor
for l:match in ale#util#GetMatches(a:lines, l:warning_pattern)
let l:text = l:match[1]
" Ignore information messages
let l:scrub_match = matchlist(l:text, '\v(loaded serial|not loaded due to) ')
if empty(l:scrub_match)
call add(l:output, {'text': l:text, 'lnum': 0, 'type': 'W'})
endif
endfor
return l:output
endfunction
call ale#linter#Define('bindzone', {
\ 'name': 'checkzone',
\ 'executable': {b -> ale#Var(b, 'bindzone_checkzone_executable')},
\ 'command': function('ale_linters#bindzone#checkzone#GetCommand'),
\ 'callback': 'ale_linters#bindzone#checkzone#Handle',
\ 'read_buffer': 0,
\})

View File

@@ -49,6 +49,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )'
let l:text = l:code . ': ' . l:detail
let l:detail = l:code . l:link . "\n\n" . l:detail
else
let l:type = 'E'

View File

@@ -5,38 +5,26 @@ call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1)
function! ale_linters#go#golangci_lint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
return l:executable
endfunction
function! ale_linters#go#golangci_lint#GetCommand(buffer, version) abort
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
let l:filename = expand('#' . a:buffer . ':t')
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
if ale#semver#GTE(a:version, [2, 0, 0])
let l:options = l:options
\ . ' --output.json.path stdout'
\ . ' --output.text.path stderr'
\ . ' --show-stats=0'
else
let l:options = l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif
if l:lint_package
return ale#go#EnvString(a:buffer)
\ . '%e run '
\ . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif
return ale#go#EnvString(a:buffer)
\ . '%e run '
\ . ale#Escape(l:filename)
\ . ' ' . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endfunction
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
@@ -70,14 +58,9 @@ endfunction
call ale#linter#Define('go', {
\ 'name': 'golangci-lint',
\ 'executable': function('ale_linters#go#golangci_lint#GetExecutable'),
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
\ 'cwd': '%s:h',
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#go#golangci_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#go#golangci_lint#GetCommand'),
\ )},
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
\ 'lint_file': 1,
\})

View File

@@ -1,28 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Lean 4.
function! ale_linters#lean#lake#GetProjectRoot(buffer) abort
let l:lakefile_toml = ale#path#FindNearestFile(a:buffer, 'lakefile.toml')
let l:lakefile_lean = ale#path#FindNearestFile(a:buffer, 'lakefile.lean')
if !empty(l:lakefile_toml)
return fnamemodify(l:lakefile_toml, ':p:h')
elseif !empty(l:lakefile_lean)
return fnamemodify(l:lakefile_lean, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('lean_lake_executable', 'lake')
call ale#Set('lean_lake_config', {})
call ale#linter#Define('lean', {
\ 'name': 'lake',
\ 'lsp': 'stdio',
\ 'language': 'lean',
\ 'lsp_config': {b -> ale#Var(b, 'lean_lake_config')},
\ 'executable': {b -> ale#Var(b, 'lean_lake_executable')},
\ 'command': '%e serve',
\ 'project_root': function('ale_linters#lean#lake#GetProjectRoot'),
\})

View File

@@ -29,7 +29,7 @@ function! ale_linters#nix#nix#Handle(buffer, lines) abort
\ 'type': 'E',
\ 'lnum': l:result.line,
\ 'col': l:result.column,
\ 'text': substitute(l:result.raw_msg, '\e\[[0-9;]*m', '', 'g'),
\ 'text': l:result.raw_msg
\})
endif
endif

View File

@@ -36,7 +36,7 @@ function! ale_linters#python#pylsp#GetCwd(buffer) abort
\ 'name': 'pylsp',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#linter#GetRoot(a:buffer, l:fake_linter)
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction

View File

@@ -1,57 +0,0 @@
" Author: oliverralbertini <oliver.albertini@gmail.com>
" Description: A performant type-checker supporting LSP for Python 3 created by Facebook
call ale#Set('python_pyrefly_executable', 'pyrefly')
call ale#Set('python_pyrefly_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyrefly_auto_pipenv', 0)
call ale#Set('python_pyrefly_auto_poetry', 0)
call ale#Set('python_pyrefly_auto_uv', 0)
function! ale_linters#python#pyrefly#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyrefly_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyrefly_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyrefly_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyrefly', ['pyrefly'])
endfunction
function! ale_linters#python#pyrefly#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyrefly#GetExecutable(a:buffer)
let l:exec_args = [
\ ale#Escape(l:executable)
\ ]
\ + (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ['run', 'pyrefly'] : [])
\ + [
\ 'lsp',
\ ]
return join(l:exec_args, ' ')
endfunction
function! ale_linters#python#pyrefly#GetCwd(buffer) abort
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endfunction
call ale#linter#Define('python', {
\ 'name': 'pyrefly',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#pyrefly#GetExecutable'),
\ 'command': function('ale_linters#python#pyrefly#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ 'cwd': function('ale_linters#python#pyrefly#GetCwd'),
\})

View File

@@ -13,7 +13,7 @@ function! ale_linters#python#pyright#GetCwd(buffer) abort
\ 'name': 'pyright',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#linter#GetRoot(a:buffer, l:fake_linter)
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction

View File

@@ -72,31 +72,20 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
try
let l:item = json_decode(l:line)
catch
" If we can't decode a line, skip it.
continue
let l:item = v:null
endtry
if (l:item.code is# 'W291' || l:item.code is# 'W293')
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
if !empty(l:item)
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endif
if l:item.code is# 'W391'
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
" Skip warnings for trailing blank lines if the option is off
continue
endif
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endfor
return l:output

View File

@@ -1,25 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Roc.
function! ale_linters#roc#roc_language_server#GetProjectRoot(buffer) abort
let l:roc_main_file = ale#path#FindNearestFile(a:buffer, 'main.roc')
if !empty(l:roc_main_file)
return fnamemodify(l:roc_main_file, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('roc_roc_language_server_executable', 'roc_language_server')
call ale#Set('roc_roc_language_server_config', {})
call ale#linter#Define('roc', {
\ 'name': 'roc_language_server',
\ 'lsp': 'stdio',
\ 'language': 'roc',
\ 'lsp_config': {b -> ale#Var(b, 'roc_roc_language_server_config')},
\ 'executable': {b -> ale#Var(b, 'roc_roc_language_server_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#roc#roc_language_server#GetProjectRoot'),
\})

View File

@@ -25,7 +25,6 @@ endfunction
call ale#linter#Define('sh', {
\ 'name': 'language_server',
\ 'aliases': ['bash-language-server'],
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#sh#language_server#GetExecutable'),
\ 'command': function('ale_linters#sh#language_server#GetCommand'),

View File

@@ -216,7 +216,7 @@ endfunction
function! ale#assert#LSPProject(expected_root) abort
let l:buffer = bufnr('')
let l:linter = s:GetLinter()
let l:root = ale#linter#GetRoot(l:buffer, l:linter)
let l:root = ale#lsp_linter#FindProjectRoot(l:buffer, l:linter)
AssertEqual a:expected_root, l:root
endfunction

View File

@@ -78,7 +78,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
if !l:data.ignore_file_changed_errors
" no-custom-checks
echom 'The file was changed before fixing finished'
echoerr 'The file was changed before fixing finished'
endif
return

View File

@@ -722,16 +722,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['typst'],
\ 'description': 'A formatter for Typst files',
\ },
\ 'roc_format': {
\ 'function': 'ale#fixers#roc_format#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Formats Roc files.',
\ },
\ 'roc_annotate': {
\ 'function': 'ale#fixers#roc_annotate#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Annotates all top-level definitions in Roc files.',
\ },
\}
" Reset the function registry to the default entries.

View File

@@ -1,7 +1,7 @@
function! ale#fixers#biome#Fix(buffer) abort
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'biome_options')
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--write --unsafe' : '--write'
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--apply-unsafe' : '--apply'
return {
\ 'read_temporary_file': 1,

View File

@@ -22,7 +22,7 @@ function! ale#fixers#clangformat#Fix(buffer) abort
let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file')
if l:style_option isnot# ''
let l:style_option = '-style=' . ale#Escape(l:style_option)
let l:style_option = '-style=' . "'" . l:style_option . "'"
endif
if l:use_local_file

View File

@@ -17,11 +17,10 @@ let s:variables = {
\}
function! ale#fixers#erlang_mode#Fix(buffer) abort
let l:emacs_executable =
let emacs_executable =
\ ale#Var(a:buffer, 'erlang_erlang_mode_emacs_executable')
let l:exprs = [
\ '(setq enable-local-variables :safe)',
\ s:SetqDefault(a:buffer, s:variables),
\ '(erlang-mode)',
\ '(font-lock-fontify-region (point-min) (point-max))',

View File

@@ -1,48 +1,32 @@
" Author: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
" Description: Run golangci-lint with the --fix flag to autofix some issues
call ale#Set('go_golangci_formatter_options', '')
call ale#Set('go_golangci_formatter_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1)
function! ale#fixers#golangci_lint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_formatter_executable')
return l:executable
endfunction
function! ale#fixers#golangci_lint#GetCommand(buffer, version) abort
function! ale#fixers#golangci_lint#GetCommand(buffer) abort
let l:filename = expand('#' . a:buffer . ':t')
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'go_golangci_formatter_options')
let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') . ' --fix'
let l:package_mode = ale#Var(a:buffer, 'go_golangci_lint_package')
let l:env = ale#go#EnvString(a:buffer)
if ale#semver#GTE(a:version, [2, 0, 0])
return l:env . ale#Escape(l:executable)
\ . ' fmt --stdin '
\ . l:options
else
return l:env . ale#Escape(l:executable)
\ . ' run --fix '
\ . l:options
\ . ' '
\ . ale#Escape(l:filename)
endif
endfunction
function! ale#fixers#golangci_lint#GetCommandForVersion(buffer, version) abort
return {
\ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer, a:version)
\}
if l:package_mode
return l:env . ale#Escape(l:executable)
\ . ' run '
\ . l:options
endif
return l:env . ale#Escape(l:executable)
\ . ' run '
\ . l:options
\ . ' ' . ale#Escape(l:filename)
endfunction
function! ale#fixers#golangci_lint#Fix(buffer) abort
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer)
let l:command = ale#fixers#golangci_lint#GetExecutable(a:buffer) . ale#Pad('--version')
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#golangci_lint#GetCommandForVersion'),
\)
return {
\ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer),
\}
endfunction

View File

@@ -1,21 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official type annotation tool for Roc.
call ale#Set('roc_roc_annotate_executable', 'roc')
call ale#Set('roc_roc_annotate_options', '')
function! ale#fixers#roc_annotate#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_annotate_executable')
let l:command = l:executable . ' format annotate'
let l:options = ale#Var(a:buffer, 'roc_roc_annotate_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -1,20 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official formatter for Roc.
call ale#Set('roc_roc_format_executable', 'roc')
call ale#Set('roc_roc_format_options', '')
function! ale#fixers#roc_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_format_executable')
let l:command = l:executable . ' format'
let l:options = ale#Var(a:buffer, 'roc_roc_format_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -11,7 +11,6 @@ let s:linters = {}
" NOTE: Update the g:ale_linter_aliases documentation when modifying this.
let s:default_ale_linter_aliases = {
\ 'Dockerfile': 'dockerfile',
\ 'bash': 'sh',
\ 'csh': 'sh',
\ 'javascriptreact': ['javascript', 'jsx'],
\ 'plaintex': 'tex',
@@ -447,32 +446,3 @@ function! ale#linter#GetAddress(buffer, linter) abort
return type(l:Address) is v:t_func ? l:Address(a:buffer) : l:Address
endfunction
" Get the project root for a linter.
" If |b:ale_root| or |g:ale_root| is set to either a String or a Dict mapping
" linter names to roots or callbacks, return that value immediately. When no
" value is available, fall back to the linter-specific configuration.
function! ale#linter#GetRoot(buffer, linter) abort
let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {})
if type(l:buffer_ale_root) is v:t_string
return l:buffer_ale_root
endif
if has_key(l:buffer_ale_root, a:linter.name)
let l:Root = l:buffer_ale_root[a:linter.name]
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
if has_key(g:ale_root, a:linter.name)
let l:Root = g:ale_root[a:linter.name]
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
if has_key(a:linter, 'project_root')
let l:Root = a:linter.project_root
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
return ''
endfunction

View File

@@ -706,7 +706,7 @@ function! ale#lsp#Send(conn_id, message) abort
throw 'LSP server not initialized yet!'
endif
if g:ale_use_neovim_lsp_api && !l:conn.is_tsserver
if g:ale_use_neovim_lsp_api
return luaeval('require("ale.lsp").send_message(_A)', {
\ 'client_id': l:conn.client_id,
\ 'is_notification': a:message[0] == 1 ? v:true : v:false,

View File

@@ -296,6 +296,44 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort
return {}
endfunction
function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort
let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {})
if type(l:buffer_ale_root) is v:t_string
return l:buffer_ale_root
endif
" Try to get a buffer-local setting for the root
if has_key(l:buffer_ale_root, a:linter.name)
let l:Root = l:buffer_ale_root[a:linter.name]
if type(l:Root) is v:t_func
return l:Root(a:buffer)
else
return l:Root
endif
endif
" Try to get a global setting for the root
if has_key(g:ale_root, a:linter.name)
let l:Root = g:ale_root[a:linter.name]
if type(l:Root) is v:t_func
return l:Root(a:buffer)
else
return l:Root
endif
endif
" Fall back to the linter-specific configuration
if has_key(a:linter, 'project_root')
let l:Root = a:linter.project_root
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
return ale#util#GetFunction(a:linter.project_root_callback)(a:buffer)
endfunction
" This function is accessible so tests can call it.
function! ale#lsp_linter#OnInit(linter, details, Callback) abort
@@ -466,7 +504,7 @@ endfunction
function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
let l:command = ''
let l:address = ''
let l:root = ale#linter#GetRoot(a:buffer, a:linter)
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, a:linter)
if empty(l:root) && a:linter.lsp isnot# 'tsserver'
" If there's no project root, then we can't check files with LSP,

View File

@@ -115,24 +115,20 @@ endfunction
" Return 1 if a path is an absolute path.
function! ale#path#IsAbsolute(filename) abort
if has('win32')
return a:filename[:0] =~# '[\\/]' || a:filename[0:2] =~? '[A-Z]:[/\\]'
else
return a:filename[:0] is# '/'
if has('win32') && a:filename[:0] is# '\'
return 1
endif
" Check for /foo and C:\foo, etc.
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
endfunction
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
let s:resolved_temp_dir = resolve(s:temp_dir)
" Given a filename, return 1 if the file represents some temporary file
" created by Vim. If the temporary location is symlinked (e.g. macOS), some
" linters may report the resolved version of the path, so both are checked.
" created by Vim.
function! ale#path#IsTempName(filename) abort
let l:filename = ale#path#Simplify(a:filename)
return l:filename[:len(s:temp_dir) - 1] is# s:temp_dir
\|| l:filename[:len(s:resolved_temp_dir) - 1] is# s:resolved_temp_dir
return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir
endfunction
" Given a base directory, which must not have a trailing slash, and a

View File

@@ -26,6 +26,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
" If you change this, update ale-python-root documentation.
if filereadable(l:path . '/MANIFEST.in')
\|| filereadable(l:path . '/setup.cfg')
\|| filereadable(l:path . '/pytest.ini')
\|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini')
@@ -54,19 +55,12 @@ endfunction
" Given a buffer number, find the project root directory for Python.
" The root directory is defined as the first directory found while searching
" upwards through paths, including the current directory, until a path
" containing an configuration file is found. (See list above)
"
" If it is not possible to find the project root directory via configuration
" file, then it will be defined as the first directory found searching upwards
" through paths, including the current directory, until no __init__.py files
" is found.
" containing an init file (one from MANIFEST.in, setup.cfg, pytest.ini,
" tox.ini) is found. If it is not possible to find the project root directory
" via init file, then it will be defined as the first directory found
" searching upwards through paths, including the current directory, until no
" __init__.py files is found.
function! ale#python#FindProjectRoot(buffer) abort
let l:root = ale#linter#GetRoot(a:buffer, {'name': 'python'})
if !empty(l:root)
return l:root
endif
let l:ini_root = ale#python#FindProjectRootIni(a:buffer)
if !empty(l:ini_root)

View File

@@ -1,32 +0,0 @@
===============================================================================
ALE BINDZone Integration *ale-bindzone-options*
===============================================================================
checkzone *ale-bindzone-checkzone*
*ale-options.bindzone_checkzone_executable*
*g:ale_bindzone_checkzone_executable*
*b:ale_bindzone_checkzone_executable*
bindzone_checkzone_executable
g:ale_bindzone_checkzone_executable
Type: |String|
Default: `named-checkzone`
This variable can be changed to set the path to named-checkzone executable.
*ale-options.bindzone_checkzone_options*
*g:ale_bindzone_checkzone_options*
*b:ale_bindzone_checkzone_options*
bindzone_checkzone_options
g:ale_bindzone_checkzone_options
Type: |String|
Default: `-c IN`
This variable can be changed to add additional command-line arguments.
All available options can be found at:
https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone-zone-file-validation-tool
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -144,7 +144,7 @@ g:ale_go_golangci_lint_options
Default: `''`
This variable can be changed to alter the command-line arguments to the
golangci-lint run invocation.
golangci-lint invocation.
*ale-options.go_golangci_lint_package*
*g:ale_go_golangci_lint_package*
@@ -157,30 +157,6 @@ g:ale_go_golangci_lint_package
When set to `1`, the whole Go package will be checked instead of only the
current file.
golangci_lint can also be user as a fixer to format go source files. In this
case the following configuration variables can be used to configure the
formatters:
*ale-options.go_golangci_formatter_executable*
*g:ale_go_golangci_formatter_executable*
*b:ale_go_golangci_formatter_executable*
go_golangci_formatter_executable
g:ale_go_golangci_formatter_executable
Type: |String|
Default: `'golangci-lint'`
The executable that will be run for golangci-lint.
*ale-options.go_golangci_formatter_options*
*g:ale_go_golangci_formatter_options*
*b:ale_go_golangci_formatter_options*
go_golangci_formatter_options
g:ale_go_golangci_formatter_options
Type: |String|
Default: `''`
This variable can be changed to alter the command-line arguments to the
golangci-lint fmt invocation.
===============================================================================
golangserver *ale-go-golangserver*

View File

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

View File

@@ -55,9 +55,6 @@ For some linters, ALE will search for a Python project root by looking at the
files in directories on or above where a file being checked is. ALE applies
the following methods, in order:
If |g:ale_root| or |b:ale_root| provides a value, that value is used as the
project root instead and the searching described below is skipped.
1. Find the first directory containing a common Python configuration file.
2. If no configuration file can be found, use the first directory which does
not contain a readable file named `__init__.py`.
@@ -66,6 +63,7 @@ ALE will look for configuration files with the following filenames. >
MANIFEST.in
setup.cfg
pytest.ini
tox.ini
.pyre_configuration.local
mypy.ini
@@ -83,7 +81,6 @@ ALE will look for configuration files with the following filenames. >
poetry.lock
pyproject.toml
.tool-versions
uv.lock
<
The first directory containing any of the files named above will be used.
@@ -1619,69 +1616,6 @@ g:ale_python_pyre_auto_uv
executable.
===============================================================================
pyrefly *ale-python-pyrefly*
`pyrefly` will be run from a detected project root, per |ale-python-root|.
*ale-options.python_pyrefly_executable*
*g:ale_python_pyrefly_executable*
*b:ale_python_pyrefly_executable*
python_pyrefly_executable
g:ale_python_pyrefly_executable
Type: |String|
Default: `'pyrefly'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `pyrefly'`.
Set this to `'poetry'` to invoke `'poetry` `run` `pyrefly'`.
Set this to `'uv'` to invoke `'uv` `run` `pyrefly'`.
*ale-options.python_pyrefly_use_global*
*g:ale_python_pyrefly_use_global*
*b:ale_python_pyrefly_use_global*
python_pyrefly_use_global
g:ale_python_pyrefly_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
*ale-options.python_pyrefly_auto_pipenv*
*g:ale_python_pyrefly_auto_pipenv*
*b:ale_python_pyrefly_auto_pipenv*
python_pyrefly_auto_pipenv
g:ale_python_pyrefly_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.
*ale-options.python_pyrefly_auto_poetry*
*g:ale_python_pyrefly_auto_poetry*
*b:ale_python_pyrefly_auto_poetry*
python_pyrefly_auto_poetry
g:ale_python_pyrefly_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.
*ale-options.python_pyrefly_auto_uv*
*g:ale_python_pyrefly_auto_uv*
*b:ale_python_pyrefly_auto_uv*
python_pyrefly_auto_uv
g:ale_python_pyrefly_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*

View File

@@ -1,79 +0,0 @@
===============================================================================
ALE Roc Integration *ale-roc-options*
*ale-integration-roc*
===============================================================================
roc_language_server *ale-roc-roc-language-server*
*ale-options.roc_roc_language_server_executable*
*g:ale_roc_roc_language_server_executable*
*b:ale_roc_roc_language_server_executable*
roc_roc_language_server_executable
g:ale_roc_roc_language_server_executable
Type: |String|
Default: `'roc_language_server'`
This variable can be modified to change the executable path for
`roc_language_server`.
*ale-options.roc_roc_language_server_config*
*g:ale_roc_roc_language_server_config*
*b:ale_roc_roc_language_server_config*
roc_roc_language_server_config
g:ale_roc_roc_language_server_config
Type: |Dictionary|
Default: `{}`
Dictionary with configuration settings for roc_language_server.
===============================================================================
roc_format *ale-roc-roc-format*
*ale-options.roc_roc_format_executable*
*g:ale_roc_roc_format_executable*
*b:ale_roc_roc_format_executable*
roc_roc_format_executable
g:ale_roc_roc_format_executable
Type: |String|
Default: `'roc'`
This variable can be modified to change the executable path for `roc`.
*ale-options.roc_roc_format_options*
*g:ale_roc_roc_format_options*
*b:ale_roc_roc_format_options*
roc_roc_format_options
g:ale_roc_roc_format_options
Type: String
Default: `''`
Additional flags for `roc format`.
===============================================================================
roc_annotate *ale-roc-roc-annotate*
*ale-options.roc_roc_annotate_executable*
*g:ale_roc_roc_annotate_executable*
*b:ale_roc_roc_annotate_executable*
roc_roc_annotate_executable
g:ale_roc_roc_annotate_executable
Type: |String|
Default: `'roc'`
This variable can be modified to change the executable path for `roc`.
*ale-options.roc_roc_annotate_options*
*g:ale_roc_roc_annotate_options*
*b:ale_roc_roc_annotate_options*
roc_roc_annotate_options
g:ale_roc_roc_annotate_options
Type: String
Default: `''`
Additional flags for `roc format annotate`.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -60,8 +60,6 @@ Notes:
* `bibclean`
* Bicep
* `bicep`
* Bindzone
* `checkzone` (named-checkzone)
* BitBake
* `oelint-adv`
* Bourne Shell
@@ -372,8 +370,6 @@ Notes:
* `textlint`
* `vale`
* `write-good`
* Lean 4
* `lake`
* Less
* `lessc`
* `prettier`
@@ -545,7 +541,6 @@ Notes:
* `pylint`!!
* `pylsp`
* `pyre`
* `pyrefly`
* `pyright`
* `refurb`
* `reorder-python-imports`
@@ -589,10 +584,6 @@ Notes:
* `write-good`
* Robot
* `rflint`
* Roc
* roc_annotate
* roc_format
* roc_language_server
* RPM spec
* `rpmlint`
* Ruby

View File

@@ -1192,13 +1192,13 @@ g:ale_detail_to_floating_preview
*b:ale_disable_lsp*
disable_lsp
g:ale_disable_lsp
Type: |Boolean| OR |Number| OR |String|
Type: |Number| OR |String|
Default: `'auto'`
When this option is set to `'auto'`, ALE will automatically disable linters
that it detects as having already been configured with the `nvim-lspconfig`
plugin. When this option is set to `true` or `1`, ALE ignores all linters
powered by LSP, and also `tsserver`.
plugin. When this option is set to `1`, ALE ignores all linters powered by
LSP, and also `tsserver`.
Any linters that are disabled will also not be usable for LSP functionality
other than just linting.
@@ -1735,7 +1735,6 @@ g:ale_linter_aliases
{
\ 'Dockerfile': 'dockerfile',
\ 'bash': 'sh',
\ 'csh': 'sh',
\ 'javascriptreact': ['javascript', 'jsx'],
\ 'plaintex': 'tex',
@@ -2297,18 +2296,17 @@ g:ale_root
Type: |Dictionary| or |String|
Default: `{}`
This option is used to determine the project root for a linter. When set to a
|String| it will be used for all linters. When set to a |Dictionary|, the
keys are linter names and the values are either |Strings| containing project
roots or |Funcref|s which are passed the buffer number.
This option is used to determine the project root for a linter. If the value
is a |Dictionary|, it maps a linter to either a |String| containing the
project root or a |Funcref| to call to look up the root. The |Funcref| is
provided the buffer number as its argument.
The buffer-specific variable may additionally be a |String| containing the
The buffer-specific variable may additionally be a string containing the
project root itself.
If a value can be found from either variable, ALE uses it directly and skips
searching for a project root. If no value is found, a linter-specific
function is invoked to detect a project root. If this, too, yields no result
and the linter is an LSP linter, it will not run.
If neither variable yields a result, a linter-specific function is invoked to
detect a project root. If this, too, yields no result, and the linter is an
LSP linter, it will not run.
*ale-options.save_hidden*
*g:ale_save_hidden*
@@ -3362,8 +3360,6 @@ documented in additional help files.
bicep...................................|ale-bicep-options|
bicep.................................|ale-bicep-bicep|
az_bicep..............................|ale-bicep-az_bicep|
bindzone................................|ale-bindzone-options|
checkzone.............................|ale-bindzone-checkzone|
bitbake.................................|ale-bitbake-options|
oelint-adv............................|ale-bitbake-oelint_adv|
c.......................................|ale-c-options|
@@ -3635,8 +3631,6 @@ documented in additional help files.
cspell................................|ale-latex-cspell|
write-good............................|ale-latex-write-good|
textlint..............................|ale-latex-textlint|
lean....................................|ale-lean-options|
lake..................................|ale-lean-lake|
less....................................|ale-less-options|
lessc.................................|ale-less-lessc|
prettier..............................|ale-less-prettier|
@@ -3789,7 +3783,6 @@ documented in additional help files.
pylint................................|ale-python-pylint|
pylsp.................................|ale-python-pylsp|
pyre..................................|ale-python-pyre|
pyrefly...............................|ale-python-pyrefly|
pyright...............................|ale-python-pyright|
refurb................................|ale-python-refurb|
reorder-python-imports................|ale-python-reorder_python_imports|
@@ -3824,10 +3817,6 @@ documented in additional help files.
write-good............................|ale-restructuredtext-write-good|
robot...................................|ale-robot-options|
rflint................................|ale-robot-rflint|
roc.....................................|ale-roc-options|
roc_language_server...................|ale-roc-roc-language-server|
roc_format............................|ale-roc-roc-format|
roc_annotate..........................|ale-roc-roc-annotate|
ruby....................................|ale-ruby-options|
brakeman..............................|ale-ruby-brakeman|
cspell................................|ale-ruby-cspell|

View File

@@ -67,7 +67,7 @@ module.send = function(buffer, loclist)
local local_cfg = { priority = sign_priority }
local global_cfg = vim.diagnostic.config().signs
if global_cfg == false or global_cfg == true or global_cfg == nil then
if type(global_cfg) == "boolean" then
signs = local_cfg
elseif type(global_cfg) == "table" then
signs = vim.tbl_extend("force", global_cfg, local_cfg)

View File

@@ -150,14 +150,12 @@ module.send_message = function(args)
success, request_id = client.request(
args.method,
args.params,
---@diagnostic disable-next-line: param-type-mismatch
function(_, result, _, _)
vim.fn["ale#lsp#HandleResponse"](client.name, {
id = request_id,
result = result,
})
end,
---@diagnostic disable-next-line: param-type-mismatch
-1
)

View File

@@ -69,8 +69,6 @@ formatting.
* [bibclean](http://ftp.math.utah.edu/pub/bibclean/)
* Bicep
* [bicep](https://github.com/Azure/bicep) :floppy_disk:
* Bindzone
* [checkzone](https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone-zone-file-validation-tool)
* BitBake
* [oelint-adv](https://github.com/priv-kweihmann/oelint-adv)
* Bourne Shell
@@ -381,8 +379,6 @@ formatting.
* [textlint](https://textlint.github.io/)
* [vale](https://github.com/ValeLint/vale)
* [write-good](https://github.com/btford/write-good)
* Lean 4
* [lake](https://github.com/leanprover/lean4)
* Less
* [lessc](https://www.npmjs.com/package/less)
* [prettier](https://github.com/prettier/prettier)
@@ -554,7 +550,6 @@ formatting.
* [pylint](https://www.pylint.org/) :floppy_disk:
* [pylsp](https://github.com/python-lsp/python-lsp-server) :warning:
* [pyre](https://github.com/facebook/pyre-check) :warning:
* [pyrefly](https://github.com/facebook/pyrefly) :warning:
* [pyright](https://github.com/microsoft/pyright)
* [refurb](https://github.com/dosisod/refurb) :floppy_disk:
* [reorder-python-imports](https://github.com/asottile/reorder_python_imports)
@@ -598,10 +593,6 @@ formatting.
* [write-good](https://github.com/btford/write-good)
* Robot
* [rflint](https://github.com/boakley/robotframework-lint)
* Roc
* [roc_annotate](https://github.com/roc-lang/roc)
* [roc_format](https://github.com/roc-lang/roc)
* [roc_language_server](https://github.com/roc-lang/roc)
* RPM spec
* [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`)
* Ruby

View File

@@ -14,7 +14,7 @@ Before:
let g:ale_completion_enabled = 0
let g:ale_completion_autoimport = 0
let g:ale_completion_max_suggestions = 50
let g:ale_linters = {'typescript': ['tsserver'], 'python': ['pyrefly']}
let g:ale_linters = {'typescript': ['tsserver'], 'python': ['pyre']}
unlet! b:ale_linters
let g:server_started_value = 1

View File

@@ -17,7 +17,7 @@ Execute(The default biome command should be correct):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('biome')
\ . ' check --write %t'
\ . ' check --apply %t'
\ }
Execute(Unsafe fixes can be applied via an option):
@@ -28,7 +28,7 @@ Execute(Unsafe fixes can be applied via an option):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('biome')
\ . ' check --write --unsafe %t'
\ . ' check --apply-unsafe %t'
\ }
Execute(The fixer should accept options):
@@ -39,5 +39,5 @@ Execute(The fixer should accept options):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('biome')
\ . ' check --write --foobar %t',
\ . ' check --apply --foobar %t',
\ }

View File

@@ -45,8 +45,7 @@ Execute(The clangformat callback should include style options as well):
\ {
\ 'command': ale#Escape(g:ale_c_clangformat_executable)
\ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
\ . ' --some-option'
\ . ' -style=' . ale#Escape(g:ale_c_clangformat_style_option)
\ . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'",
\ },
\ ale#fixers#clangformat#Fix(bufnr(''))

View File

@@ -33,9 +33,6 @@ Execute(Emacs executable should be configurable):
let b:ale_erlang_erlang_mode_emacs_executable = '/path/to/emacs'
AssertEqual 0, stridx(Fixer('command'), ale#Escape('/path/to/emacs'))
Execute(enable-local-variables should be :safe):
Assert Fixer('command') =~# '\m\<enable-local-variables :safe\>'
Execute(erlang-indent-level should be 4 by default):
Assert Fixer('command') =~# '\m\<erlang-indent-level 4\>'

View File

@@ -1,80 +1,48 @@
Before:
call ale#assert#SetUpFixerTest('go', 'golangci_lint')
Save g:ale_go_go111module
Save g:ale_go_golangci_formatter_executable
Save g:ale_go_golangci_formatter_options
Save g:ale_go_golangci_lint_executable
Save g:ale_go_golangci_lint_options
Save g:ale_go_golangci_lint_package
" Use an invalid global executable, so we don't match it.
let g:ale_go_golangci_lint_executable = 'xxxinvalid'
let g:ale_go_golangci_lint_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
call ale#test#SetFilename('../test-files/go/testfile.go')
After:
call ale#test#RestoreDirectory()
call ale#assert#TearDownFixerTest()
Restore
unlet! b:ale_go_go111module
Execute(The golangci-lint callback should return the correct default values with v1):
call ale#test#RestoreDirectory()
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
Execute(The golangci-lint callback should return the correct default values):
AssertFixer
AssertEqual
\ {
\ 'command': ale#Escape('golangci-lint') . ' run --fix ' . ale#Escape('testfile.go'),
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v1):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' run --fix ' . g:ale_go_golangci_formatter_options . ' ' . ale#Escape('testfile.go'),
\ 'command': ale#Escape('xxxinvalid') . ' run --fix',
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))
Execute(The golangci-lint callback should override executable with v1):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
Execute(The golangci-lint callback should include custom golangci-lint options):
let g:ale_go_golangci_lint_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' run --fix '
\ . g:ale_go_golangci_formatter_options
\ . ' ' . ale#Escape('testfile.go'),
\ . ' run ' . g:ale_go_golangci_lint_options . ' --fix',
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))
Execute(The golangci-lint callback should return the correct default values with v2):
Execute(The golangci-lint callback should support per-file mode):
let g:ale_go_golangci_lint_package = 0
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint') . ' fmt --stdin ',
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v2):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' fmt --stdin ' . g:ale_go_golangci_formatter_options,
\ },
Execute(The golangci-lint callback should override executable with v2):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' fmt --stdin '
\ . g:ale_go_golangci_formatter_options
\ . ' run '
\ . g:ale_go_golangci_lint_options
\ . ' --fix ' . ale#Escape('testfile.go'),
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))

View File

@@ -1,20 +0,0 @@
Before:
call ale#assert#SetUpFixerTest('roc', 'roc_annotate')
After:
call ale#assert#TearDownFixerTest()
Execute(The roc annotate callback should return the correct default values):
AssertFixer {
\ 'command': 'roc format annotate %t',
\ 'read_temporary_file': 1,
\}
Execute(The roc annotate callback should allow a custom executable):
let g:ale_roc_roc_annotate_executable = 'foo/bar'
AssertFixer {
\ 'command': 'foo/bar format annotate %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -1,20 +0,0 @@
Before:
call ale#assert#SetUpFixerTest('roc', 'roc_format')
After:
call ale#assert#TearDownFixerTest()
Execute(The roc format callback should return the correct default values):
AssertFixer {
\ 'command': 'roc format %t',
\ 'read_temporary_file': 1,
\}
Execute(The roc format callback should allow a custom executable):
let g:ale_roc_roc_format_executable = 'foo/bar'
AssertFixer {
\ 'command': 'foo/bar format %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -1,26 +0,0 @@
Before:
runtime ale_linters/bindzone/checkzone.vim
After:
call ale#linter#Reset()
Execute(The checkzone handler should handle basic warnings):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'type': 'E',
\ 'text': 'unknown RR type ''fasd''',
\ },
\ {
\ 'lnum': 0,
\ 'type': 'W',
\ 'text': '_some_srv._tcp.example.com/SRV ''some.example.com'' (out of zone) has no addresses records (A or AAAA)',
\ },
\ ],
\ ale_linters#bindzone#checkzone#Handle(1, [
\ 'zone example.com/IN: _some_srv._tcp.example.com/SRV ''some.example.com'' (out of zone) has no addresses records (A or AAAA)',
\ 'zone example.com/IN: loaded serial 2025050400',
\ 'zone example.com/IN: not loaded due to errors',
\ '/tmp/vb3wXsu/2/example.com:2: unknown RR type ''fasd''',
\ ])

View File

@@ -17,7 +17,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'DL3006',
\ 'text': 'Always tag the version of an image explicitly',
\ 'text': "DL3006: Always tag the version of an image explicitly",
\ 'detail': "DL3006 ( https://github.com/hadolint/hadolint/wiki/DL3006 )\n\nAlways tag the version of an image explicitly",
\ },
\ {
@@ -25,7 +25,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'DL3033',
\ 'text': 'Specify version with `yum install -y <package>-<version>`.',
\ 'text': "DL3033: Specify version with `yum install -y <package>-<version>`.",
\ 'detail': "DL3033 ( https://github.com/hadolint/hadolint/wiki/DL3033 )\n\nSpecify version with `yum install -y <package>-<version>`.",
\ },
\ {
@@ -33,7 +33,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'SC2039',
\ 'text': 'In POSIX sh, brace expansion is undefined.',
\ 'text': "SC2039: In POSIX sh, brace expansion is undefined.",
\ 'detail': "SC2039 ( https://github.com/koalaman/shellcheck/wiki/SC2039 )\n\nIn POSIX sh, brace expansion is undefined.",
\ },
\ ],

View File

@@ -107,7 +107,7 @@ Execute(The mypy handler should handle Windows names with spaces):
\ {
\ 'lnum': 4,
\ 'col': 0,
\ 'filename': ale#path#GetAbsPath(getcwd(), 'C:\something\with spaces.py'),
\ 'filename': ale#path#Simplify('C:\something\with spaces.py'),
\ 'type': 'E',
\ 'text': 'No library stub file for module ''django.db''',
\ },

View File

@@ -27,22 +27,6 @@ Execute(The nix handler should parse nix-instantiate error messages correctly):
\ "@nix {\"unrelated\":\"message\"}"
\ ])
Execute(The nix handler should parse nix-instantiate error messages with ANSI color codes correctly):
AssertEqual
\ [
\ {
\ 'lnum': 3,
\ 'col': 5,
\ 'type': 'E',
\ 'text': "undefined variable 'foo'",
\ },
\
\ ],
\ ale_linters#nix#nix#Handle(bufnr(''), [
\ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable '\\u001b[35;1mfoo\\u001b[0m'\"}",
\ "@nix {\"unrelated\":\"message\"}"
\ ])
Execute(The nix handler should parse message from old nix-instantiate correctly):
AssertEqual
\ [

View File

@@ -1,18 +1,7 @@
Before:
Save g:ale_warn_about_trailing_blank_lines
Save g:ale_warn_about_trailing_whitespace
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
runtime ale_linters/python/ruff.vim
After:
Restore
unlet! b:ale_warn_about_trailing_blank_lines
unlet! b:ale_warn_about_trailing_whitespace
call ale#linter#Reset()
Execute(We should handle basic output of ruff correctly):
@@ -52,66 +41,3 @@ Execute(We should handle mixed error lines and JSON output from ruff):
\ 'ERROR: oh noes!',
\ '{"cell":null,"code":"F821","end_location":{"column":8,"row":2},"filename":"/home/eduardo/Code/Python/test.py","fix":null,"location":{"column":1,"row":2},"message":"Undefined name example","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}',
\ ])
Execute(Warnings about trailing whitespace should be reported by default):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W291',
\ 'type': 'W',
\ 'text': 'who cares',
\ },
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W293',
\ 'type': 'W',
\ 'text': 'who cares',
\ },
\ ],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W291","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ '{"cell":null,"code":"W293","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ ])
Execute(Disabling trailing whitespace warnings should work):
let b:ale_warn_about_trailing_whitespace = 0
AssertEqual
\ [],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W291","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ '{"cell":null,"code":"W293","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ ])
Execute(Warnings about trailing blank lines should be reported by default):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W391',
\ 'type': 'W',
\ 'text': 'blank line at end of file',
\ },
\ ],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W391","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"blank line at end of file","noqa_row":2,"url":""}',
\ ])
Execute(Disabling trailing blank line warnings should work):
let b:ale_warn_about_trailing_blank_lines = 0
AssertEqual
\ [],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W391","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"blank line at end of file","noqa_row":2,"url":""}',
\ ])

View File

@@ -1,19 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('bindzone', 'checkzone')
After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'named-checkzone',
\ ale#Escape('named-checkzone') . ' -c IN example.com %t'
Execute(The default command should be overridden):
let b:ale_bindzone_checkzone_executable = '/bin/bind9-checkzone'
AssertLinter '/bin/bind9-checkzone',
\ ale#Escape('/bin/bind9-checkzone') . ' -c IN example.com %t'
Execute(The default options should be overridden):
let b:ale_bindzone_checkzone_options = '-c IN -d'
AssertLinter 'named-checkzone',
\ ale#Escape('named-checkzone') . ' -c IN -d example.com %t'

View File

@@ -125,35 +125,35 @@ Execute(The flake8 callbacks should detect virtualenv directories):
\ . ' --stdin-display-name %s -',
\]
Execute(FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(FindProjectRoot should detect the project root directory for namespace package via setup.cf):
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(FindProjectRoot should ignore the location of pytest.ini):
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest/namespace'),
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(FindProjectRoot should detect the project root directory for namespace package via tox.ini):
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(FindProjectRoot should detect the project root directory for non-namespace package):
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual

View File

@@ -111,6 +111,41 @@ Execute(The flakehell callbacks should detect virtualenv directories):
\ . ' --stdin-display-name %s -',
\]
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
\ ale#python#FindProjectRoot(bufnr(''))
" Some users currently run flakehell this way, so we should support it.
Execute(Using `python -m flakehell` should be supported for running flakehell):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')

View File

@@ -4,9 +4,6 @@ Before:
call ale#assert#SetUpLinterTest('go', 'golangci_lint')
call ale#test#SetFilename('test.go')
" Test with version 1.64.8 by default
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
After:
Restore
@@ -19,18 +16,6 @@ Execute(The golangci-lint defaults should be correct):
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint defaults should be correct with no version info):
GivenCommandOutput []
AssertLinterCwd '%s:h',
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint defaults should be correct with version 2):
GivenCommandOutput ['golangci-lint has version 2.0.2 built with go1.24.0']
AssertLinterCwd '%s:h',
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --output.json.path stdout --output.text.path stderr --show-stats=0'
Execute(The golangci-lint callback should use a configured executable):
let b:ale_go_golangci_lint_executable = 'something else'
@@ -38,14 +23,6 @@ Execute(The golangci-lint callback should use a configured executable):
\ ale#Escape('something else')
\ . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint callback should use a configured version 2 executable):
GivenCommandOutput ['golangci-lint has version 2.0.0 built with go1.22.0']
let b:ale_go_golangci_lint_executable = 'something else'
AssertLinter 'something else',
\ ale#Escape('something else')
\ . ' run --output.json.path stdout --output.text.path stderr --show-stats=0'
Execute(The golangci-lint callback should use configured options):
let b:ale_go_golangci_lint_options = '--foobar'

View File

@@ -1,27 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('lean', 'lake')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'lake', ale#Escape('lake') . ' serve'
Execute(The project root should be detected correctly without a lakefile):
AssertLSPProject '.'
Execute(The project root should be detected correctly from .toml):
call ale#test#SetFilename('../test-files/lean/lakefile_toml/lakefile.toml')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_toml')
Execute(The project root should be detected correctly from .lean):
call ale#test#SetFilename('../test-files/lean/lakefile_lean/lakefile.lean')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_lean')
Execute(The LSP values should be set correctly):
call ale#test#SetFilename('../test-files/lean/lakefile_lean/Main.lean')
AssertLSPLanguage 'lean'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_lean')

View File

@@ -1,69 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('python', 'pyrefly')
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
unlet! b:bin_dir
unlet! b:executable
call ale#assert#TearDownLinterTest()
Execute(The pyrefly command callback should return default string):
call ale#test#SetFilename('./foo.py')
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
Execute(The pyrefly executable should be configurable):
let g:ale_python_pyrefly_executable = '~/.local/bin/pyrefly'
AssertLinter '~/.local/bin/pyrefly',
\ ale#Escape('~/.local/bin/pyrefly') . ' lsp'
Execute(The pyrefly executable should be run from the virtualenv path):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
let b:executable = ale#path#Simplify(
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyrefly'
\)
AssertLinter b:executable, ale#Escape(b:executable) . ' lsp'
Execute(You should be able to override the pyrefly virtualenv lookup):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
let g:ale_python_pyrefly_use_global = 1
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
Execute(Setting executable to 'pipenv' appends 'run pyrefly'):
let g:ale_python_pyrefly_executable = 'path/to/pipenv'
call ale#test#SetFilename('../test-files/dummy')
AssertLinter 'path/to/pipenv',
\ ale#Escape('path/to/pipenv') . ' run pyrefly lsp'
Execute(Pipenv is detected when python_pyrefly_auto_pipenv is set):
let g:ale_python_pyrefly_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertLinter 'pipenv',
\ ale#Escape('pipenv') . ' run pyrefly lsp'
Execute(Setting executable to 'poetry' appends 'run pyrefly lsp'):
let g:ale_python_pyrefly_executable = 'path/to/poetry'
AssertLinter 'path/to/poetry',
\ ale#Escape('path/to/poetry') . ' run pyrefly lsp'
Execute(Poetry is detected when python_pyrefly_auto_poetry is set):
let g:ale_python_pyrefly_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyrefly lsp'
Execute(uv is detected when python_pyrefly_auto_uv is set):
let g:ale_python_pyrefly_auto_uv = 1
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
AssertLinter 'uv',
\ ale#Escape('uv') . ' run pyrefly lsp'

View File

@@ -1,23 +0,0 @@
Before:
call ale#assert#SetUpLinterTest('roc', 'roc_language_server')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'roc_language_server', ale#Escape('roc_language_server')
Execute(The project root should be detected correctly in empty directory):
AssertLSPProject '.'
Execute(The project root should be detected correctly with main.roc):
call ale#test#SetFilename('../test-files/roc/main.roc')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/roc')
Execute(The LSP values should be set correctly):
call ale#test#SetFilename('../test-files/roc/main.roc')
AssertLSPLanguage 'roc'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/roc')

View File

@@ -13,15 +13,6 @@ Execute(Relative paths should be resolved correctly):
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '../whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '..\whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '../whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '..\whatever.txt')
endif
Execute(Absolute paths should be resolved correctly):
@@ -35,12 +26,4 @@ Execute(Absolute paths should be resolved correctly):
if has('win32')
AssertEqual '\ding', ale#path#GetAbsPath('/foo/bar/xyz', '\\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:\ding')
endif

View File

@@ -407,7 +407,7 @@ Execute(PreProcess should allow the `project_root` to be set as a String):
\ 'project_root': '/foo/bar',
\})
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
Execute(PreProcess should `project_root` be set as a Function):
let g:linter = ale#linter#PreProcess('testft', {
@@ -418,7 +418,7 @@ Execute(PreProcess should `project_root` be set as a Function):
\ 'project_root': {-> '/foo/bar'},
\})
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
Execute(PreProcess should complain when `project_root` is invalid):
AssertThrows call ale#linter#PreProcess('testft', {

View File

@@ -1,27 +0,0 @@
Before:
Save g:ale_root
Save b:ale_root
call ale#test#SetDirectory('/testplugin/test')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The global setting is used as the project root):
let g:ale_root = '/foo/python'
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual '/foo/python', ale#python#FindProjectRoot(bufnr(''))
Execute(The buffer setting overrides the global setting):
let g:ale_root = '/foo/python'
let b:ale_root = '/bar/python'
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual '/bar/python', ale#python#FindProjectRoot(bufnr(''))
Execute(Fallback to searching when no setting is used):
unlet! g:ale_root
unlet! b:ale_root
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual \
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
\ ale#python#FindProjectRoot(bufnr(''))