mirror of
https://github.com/dense-analysis/ale.git
synced 2026-11-07 04:35:57 +08:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
822d9a1bf3 | ||
|
|
92dd497e6c | ||
|
|
6d7bc15d9a | ||
|
|
29f1ff2579 | ||
|
|
7df94447c1 | ||
|
|
c74b917648 |
No files matched your search
@@ -2,11 +2,44 @@
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||
call ale#Set('ansible_ansible_lint_auto_pipenv', 0)
|
||||
call ale#Set('ansible_ansible_lint_auto_poetry', 0)
|
||||
call ale#Set('ansible_ansible_lint_auto_uv', 0)
|
||||
call ale#Set('ansible_ansible_lint_change_directory', 1)
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv')
|
||||
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry')
|
||||
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv')
|
||||
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'ansible_ansible_lint_change_directory')
|
||||
" 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'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
@@ -103,28 +136,50 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run ansible-lint'
|
||||
\ : ''
|
||||
|
||||
let l:opts_map = {
|
||||
\ '>=6.0.0': ' --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': ' --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': ' --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
|
||||
\ l:commands['<5.0.0']
|
||||
|
||||
let l:cmd_opts = ale#semver#GTE(a:version, [6, 0]) ? l:opts_map['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:opts_map['>=5.0.0'] :
|
||||
\ l:opts_map['<5.0.0']
|
||||
|
||||
let l:command = ale#Escape(l:executable) . l:exec_args . l:cmd_opts
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run ansible-lint'
|
||||
\ : ''
|
||||
|
||||
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
|
||||
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible_lint',
|
||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\ )},
|
||||
\ 'cwd': function('ale_linters#ansible#ansible_lint#GetCwd'),
|
||||
\ 'command': function('ale_linters#ansible#ansible_lint#RunWithVersionCheck'),
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
" Author: gomfol12
|
||||
" Desciption: A linter for fortran using fortitude.
|
||||
|
||||
call ale#Set('fortran_fortitude_executable', 'fortitude')
|
||||
call ale#Set('fortran_fortitude_options', '')
|
||||
|
||||
let s:severity_map = {
|
||||
\ 'E': 'E',
|
||||
\ 'C': 'W',
|
||||
\ 'OB': 'I',
|
||||
\ 'MOD': 'I',
|
||||
\ 'S': 'I',
|
||||
\ 'PORT': 'I',
|
||||
\ 'FORT': 'I',
|
||||
\}
|
||||
|
||||
function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
let l:prefix = matchstr(l:error['code'], '^\a\+')
|
||||
let l:type = get(s:severity_map, l:prefix, 'I')
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['row'],
|
||||
\ 'end_lnum': l:error['end_location']['row'],
|
||||
\ 'col': l:error['location']['column'],
|
||||
\ 'end_col': l:error['end_location']['column'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:error['code'],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('fortran', {
|
||||
\ 'name': 'fortitude',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'fortran_fortitude_executable')},
|
||||
\ 'command': {b ->
|
||||
\ '%e' . ' check --output-format json' . ale#Pad(ale#Var(b, 'fortran_fortitude_options')) . ' %s'
|
||||
\ },
|
||||
\ 'callback': 'ale_linters#fortran#fortitude#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -0,0 +1,43 @@
|
||||
" Authors: ophirr33 <coghlan.ty@gmail.com>, rymdbar <https://rymdbar.x20.se/>
|
||||
" Description: Perl::LanguageServer for perl, from cpan.org
|
||||
|
||||
" This should have the same value as in perl.vim
|
||||
call ale#Set('perl_perl_executable', 'perl')
|
||||
" Please note that perl_perl_options does not exist here.
|
||||
|
||||
function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
|
||||
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
|
||||
" Build.PL, https://metacpan.org/pod/Module::Build
|
||||
" dist.ini, https://metacpan.org/pod/Dist::Zilla
|
||||
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini', '.git' ]
|
||||
|
||||
for l:root in l:potential_roots
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root . '/', ':p:h:h')
|
||||
endif
|
||||
endfor
|
||||
|
||||
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#Set('perl_languageserver_config', {})
|
||||
|
||||
function! s:get_lsp_config(buffer) abort
|
||||
" This tool doesn't kick in unless workspace/didChangeConfiguration is
|
||||
" called, thus this function returning a fallback dict when there is no
|
||||
" config.
|
||||
let l:lsp_config = ale#Var(a:buffer, 'perl_languageserver_config')
|
||||
|
||||
return empty(l:lsp_config) ? { 'perl': { 'enable': 1 } } : l:lsp_config
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('perl', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
|
||||
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
|
||||
\ 'lsp_config': {b -> s:get_lsp_config(b)},
|
||||
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
|
||||
\ })
|
||||
@@ -13,6 +13,7 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
|
||||
|
||||
let l:potential_roots = [
|
||||
\ 'build.sc',
|
||||
\ 'build.mill',
|
||||
\ 'build.sbt',
|
||||
\ '.bloop',
|
||||
\ '.metals',
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
" Author: Nicolas Derumigny <https://github.com/nicolasderumigny>
|
||||
" Description: Verible LSP for verilog
|
||||
|
||||
call ale#Set('verilog_verible_ls_options', '--rules_config_search')
|
||||
call ale#Set('verilog_verible_ls_rules', '')
|
||||
call ale#Set('verilog_verible_ls_executable', 'verible-verilog-ls')
|
||||
call ale#Set('verilog_verible_ls_config', {})
|
||||
|
||||
function! ale_linters#verilog#verible_ls#GetProjectRoot(buffer) abort
|
||||
let l:git_dir = ale#path#FindNearestFile(a:buffer, 'verible.filelist')
|
||||
|
||||
if !empty(l:git_dir)
|
||||
return fnamemodify(l:git_dir, ':p:h')
|
||||
else
|
||||
return fnamemodify('', ':h')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#verilog#verible_ls#GetCommand(buffer) abort
|
||||
let l:command = ale#Escape(ale#Var(a:buffer, 'verilog_verible_ls_executable'))
|
||||
let l:options = ale#Var(a:buffer, 'verilog_verible_ls_options')
|
||||
let l:rules = ale#Var(a:buffer, 'verilog_verible_ls_rules')
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
if l:rules isnot# ''
|
||||
let l:command .= ' --rules=' . l:rules
|
||||
endif
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('verilog', {
|
||||
\ 'name': 'verible_ls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'verilog_verible_ls_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'verilog_verible_ls_executable')},
|
||||
\ 'command': function('ale_linters#verilog#verible_ls#GetCommand') ,
|
||||
\ 'project_root': function('ale_linters#verilog#verible_ls#GetProjectRoot'),
|
||||
\})
|
||||
@@ -742,6 +742,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['toml'],
|
||||
\ 'description': 'Lints TOML files',
|
||||
\ },
|
||||
\ 'verible_format': {
|
||||
\ 'function': 'ale#fixers#verible_format#Fix',
|
||||
\ 'suggested_filetypes': ['verilog'],
|
||||
\ 'description': 'Formats verilog files using verible.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
" Author: Nicolas Derumigny <https://github.com/nicolasderumigny>
|
||||
" Description: verible formatter for verilog.
|
||||
|
||||
call ale#Set('verilog_verible_format_executable', 'verible-verilog-format')
|
||||
call ale#Set('verilog_verible_format_options', '')
|
||||
|
||||
function! ale#fixers#verible_format#Fix(buffer) abort
|
||||
let l:executable = ale#Escape(ale#Var(a:buffer, 'verilog_verible_format_executable'))
|
||||
let l:command = l:executable
|
||||
let l:options = ale#Var(a:buffer, 'verilog_verible_format_options')
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return {'command': l:command . ' -'}
|
||||
endfunction
|
||||
@@ -1,4 +1,5 @@
|
||||
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
|
||||
let g:ale_references_show_contents = get(g:, 'ale_references_show_contents', 1)
|
||||
|
||||
let s:references_map = {}
|
||||
|
||||
@@ -67,17 +68,33 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort
|
||||
endfunction
|
||||
|
||||
function! ale#references#FormatLSPResponseItem(response_item, options) abort
|
||||
let l:line_text = ''
|
||||
|
||||
let l:line= a:response_item.range.start.line
|
||||
let l:col = a:response_item.range.start.character
|
||||
let l:filename = ale#util#ToResource(a:response_item.uri)
|
||||
|
||||
if get(a:options, 'show_contents') == 1
|
||||
try
|
||||
let l:line_text = substitute(readfile(l:filename)[l:line], '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
catch
|
||||
" This happens in tests
|
||||
endtry
|
||||
endif
|
||||
|
||||
if get(a:options, 'open_in') is# 'quickfix'
|
||||
return {
|
||||
\ 'filename': ale#util#ToResource(a:response_item.uri),
|
||||
\ 'filename': l:filename,
|
||||
\ 'lnum': a:response_item.range.start.line + 1,
|
||||
\ 'col': a:response_item.range.start.character + 1,
|
||||
\ 'text': l:line_text,
|
||||
\}
|
||||
else
|
||||
return {
|
||||
\ 'filename': ale#util#ToResource(a:response_item.uri),
|
||||
\ 'line': a:response_item.range.start.line + 1,
|
||||
\ 'column': a:response_item.range.start.character + 1,
|
||||
\ 'filename': l:filename,
|
||||
\ 'line': l:line + 1,
|
||||
\ 'column': l:col + 1,
|
||||
\ 'match': l:line_text,
|
||||
\}
|
||||
endif
|
||||
endfunction
|
||||
@@ -147,6 +164,7 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
|
||||
let s:references_map[l:request_id] = {
|
||||
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0,
|
||||
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
|
||||
\ 'show_contents': a:options.show_contents,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -165,6 +183,8 @@ function! ale#references#Find(...) abort
|
||||
let l:options.open_in = 'vsplit'
|
||||
elseif l:option is? '-quickfix'
|
||||
let l:options.open_in = 'quickfix'
|
||||
elseif l:option is? '-contents'
|
||||
let l:options.show_contents = 1
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
@@ -177,6 +197,10 @@ function! ale#references#Find(...) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
if !has_key(l:options, 'show_contents')
|
||||
let l:options.show_contents = ale#Var(bufnr(''), 'references_show_contents')
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
let [l:line, l:column] = getpos('.')[1:2]
|
||||
let l:column = min([l:column, len(getline(l:line))])
|
||||
|
||||
@@ -44,5 +44,39 @@ g:ale_ansible_ansible_lint_executable
|
||||
This variable can be changed to modify the executable used for ansible-lint.
|
||||
|
||||
|
||||
*ale-options.ansible_ansible_lint_auto_pipenv*
|
||||
*g:ale_ansible_ansible_lint_auto_pipenv*
|
||||
*b:ale_ansible_ansible_lint_auto_pipenv*
|
||||
ansible_ansible_lint_auto_pipenv
|
||||
g:ale_ansible_ansible_lint_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.ansible_ansible_lint_auto_poetry*
|
||||
*g:ale_ansible_ansible_lint_auto_poetry*
|
||||
*b:ale_ansible_ansible_lint_auto_poetry*
|
||||
ansible_ansible_lint_auto_poetry
|
||||
g:ale_ansible_ansible_lint_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.ansible_ansible_lint_auto_uv*
|
||||
*g:ale_ansible_ansible_lint_auto_uv*
|
||||
*b:ale_ansible_ansible_lint_auto_uv*
|
||||
ansible_ansible_lint_auto_uv
|
||||
g:ale_ansible_ansible_lint_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:
|
||||
+23
-1
@@ -2,6 +2,29 @@
|
||||
ALE Fortran Integration *ale-fortran-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
fortitude *ale-fortran-fortitude*
|
||||
|
||||
*ale-options.fortran_fortitude_executable*
|
||||
*g:fortran_fortitude_executable*
|
||||
*b:fortran_fortitude_executable*
|
||||
fortran_fortitude_executable
|
||||
g:fortran_fortitude_executable
|
||||
Type: |String|
|
||||
Default: 'fortitude'
|
||||
|
||||
This variable can be changed to modify the executable used for fortitude.
|
||||
|
||||
*ale-options.fortran_fortitude_options*
|
||||
*g:fortran_fortitude_options*
|
||||
*b:fortran_fortitude_options*
|
||||
fortran_fortitude_options
|
||||
g:fortran_fortitude_options
|
||||
Type: |String|
|
||||
Default: ''
|
||||
|
||||
This variable can be changed to modify options given to fortitude check.
|
||||
|
||||
===============================================================================
|
||||
gcc *ale-fortran-gcc*
|
||||
|
||||
@@ -63,6 +86,5 @@ g:ale_fortran_language_server_use_global
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
@@ -35,6 +35,42 @@ g:ale_perl_perl_options
|
||||
invocation.
|
||||
|
||||
|
||||
===============================================================================
|
||||
perl language server *ale-perl-languageserver*
|
||||
|
||||
perl_perl_executable
|
||||
g:ale_perl_perl_executable
|
||||
Type: |String|
|
||||
Default: `'perl'`
|
||||
|
||||
The language server will use the same variable as |ale-perl-perl| to launch
|
||||
the perl executable with the Perl::LanguageServer module.
|
||||
|
||||
*ale-options.perl_languageserver_config*
|
||||
*g:ale_perl_languageserver_config*
|
||||
*b:ale_perl_languageserver_config*
|
||||
perl_languageserver_config
|
||||
g:ale_perl_languageserver_config
|
||||
Type: |Dictionary|
|
||||
Default: `'{}'`
|
||||
|
||||
This variable can be changed to customize the lsp_config (sent as a
|
||||
workspace/didChangeConfiguration command).
|
||||
For example: >
|
||||
|
||||
let g:ale_perl_languageserver_config = {
|
||||
\ 'perl': {
|
||||
\ 'fileFilter': [''],
|
||||
\ 'logLevel': 2,
|
||||
\ 'logFile': '/tmp/plls-log.txt',
|
||||
\ 'perlInc': ['/usr/share/perl5/', '/usr/local/share/perl5/' ],
|
||||
\ },
|
||||
\}
|
||||
<
|
||||
For all available options and explanations, visit
|
||||
https://metacpan.org/pod/Perl::LanguageServer#Extension-Settings
|
||||
|
||||
|
||||
===============================================================================
|
||||
perlcritic *ale-perl-perlcritic*
|
||||
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ g:ale_scala_metals_project_root
|
||||
Default: `''`
|
||||
|
||||
By default the project root is found by searching upwards for `build.sbt`,
|
||||
`build.sc`, `.bloop` or `.metals`. If the project root is elsewhere, you
|
||||
can override the project root directory.
|
||||
`build.sc`, `build.mill`, `.bloop` or `.metals`. If the project root is elsewhere,
|
||||
you can override the project root directory.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
||||
@@ -205,6 +205,7 @@ Notes:
|
||||
* `fish` (-n flag)
|
||||
* `fish_indent`
|
||||
* Fortran
|
||||
* `fortitude`
|
||||
* `gcc`
|
||||
* `language_server`
|
||||
* Fountain
|
||||
@@ -471,6 +472,7 @@ Notes:
|
||||
* Pawn
|
||||
* `uncrustify`
|
||||
* Perl
|
||||
* `languageserver`
|
||||
* `perl -c`
|
||||
* `perl-critic`
|
||||
* `perltidy`
|
||||
@@ -723,6 +725,7 @@ Notes:
|
||||
* `hdl-checker`
|
||||
* `iverilog`
|
||||
* slang
|
||||
* `verible`
|
||||
* `verilator`
|
||||
* `vlog`
|
||||
* `xvlog`
|
||||
|
||||
+76
-1
@@ -3,7 +3,7 @@ ALE Verilog/SystemVerilog Integration *ale-verilog-options*
|
||||
|
||||
|
||||
===============================================================================
|
||||
ALE can use seven different linters for Verilog HDL:
|
||||
ALE can use eight different linters for Verilog HDL:
|
||||
|
||||
HDL Checker
|
||||
Using `hdl_checker --lsp`
|
||||
@@ -14,6 +14,9 @@ ALE can use seven different linters for Verilog HDL:
|
||||
slang:
|
||||
Using `slang -Weverything`
|
||||
|
||||
verible_ls
|
||||
Using `verible-verilog-ls`
|
||||
|
||||
verilator
|
||||
Using `verilator --lint-only -Wall`
|
||||
|
||||
@@ -35,6 +38,12 @@ defining 'g:ale_linters' variable: >
|
||||
\ let g:ale_linters = {'systemverilog' : ['verilator'],}
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
ALE can use one fixer for Verilog HDL:
|
||||
|
||||
|
||||
verible_fomat
|
||||
Using `verible-verilog-format`
|
||||
===============================================================================
|
||||
General notes
|
||||
|
||||
@@ -80,8 +89,74 @@ g:ale_verilog_slang_option
|
||||
|
||||
This variable can be changed to modify 'slang' command arguments.
|
||||
|
||||
===============================================================================
|
||||
verible_ls *ale-verilog-verible-ls*
|
||||
|
||||
*ale-config.verilog_verible_ls_executable*
|
||||
*g:ale_verilog_verible_ls_executable*
|
||||
*b:ale_verilog_verible_ls_executable*
|
||||
verilog_verible_ls_executable
|
||||
g:ale_verilog_verible_ls_executable
|
||||
Type: |String|
|
||||
Default: `'verible-verilog-ls'`
|
||||
|
||||
This variable can be modifies to change the executable path for `verible_ls`
|
||||
|
||||
*ale-config.verilog_verible_ls_config*
|
||||
*g:ale_verilog_verible_ls_config*
|
||||
*b:ale_verilog_verible_ls_config*
|
||||
verilog_verible_ls_config
|
||||
g:ale_verilog_verible_ls_config
|
||||
Type: |Dictionary|
|
||||
Default: `{}`
|
||||
|
||||
Dictionary with configuration settings for `verible_ls`
|
||||
|
||||
*ale-config.verilog_verible_ls_options*
|
||||
*g:ale_verilog_verible_ls_options*
|
||||
*b:ale_verilog_verible_ls_options*
|
||||
verilog_verible_ls_options
|
||||
g:ale_verilog_verible_ls_options
|
||||
Type: |String|
|
||||
Default: `'--rules_config_search'`
|
||||
|
||||
Additional flags for `verible_ls`
|
||||
|
||||
*ale-config.verilog_verible_ls_rules*
|
||||
*g:ale_verilog_verible_ls_rules*
|
||||
*b:ale_verilog_verible_ls_rules*
|
||||
verilog_verible_ls_rules
|
||||
g:ale_verilog_verible_ls_rules
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
Additional rules applied by `verible_ls`
|
||||
|
||||
===============================================================================
|
||||
verible_format *ale-verilog-verible-format*
|
||||
|
||||
*ale-config.verilog_verible_format_executable*
|
||||
*g:ale_verilog_verible_format_executable*
|
||||
*b:ale_verilog_verible_format_executable*
|
||||
verilog_verible_format_executable
|
||||
g:ale_verilog_verible_format_executable
|
||||
Type: |String|
|
||||
Default: `'verible-verilog-format'`
|
||||
|
||||
This variable can be modifies to change the executable path for
|
||||
`verible_format`
|
||||
|
||||
*ale-config.verilog_verible_format_options*
|
||||
*g:ale_verilog_verible_format_options*
|
||||
*b:ale_verilog_verible_format_options*
|
||||
verilog_verible_format_options
|
||||
g:ale_verilog_verible_format_options
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
Additional flags for `verible_format`
|
||||
===============================================================================
|
||||
|
||||
verilator *ale-verilog-verilator*
|
||||
|
||||
*ale-options.verilog_verilator_options*
|
||||
|
||||
+18
@@ -2270,6 +2270,16 @@ g:ale_popup_menu_enabled
|
||||
This setting must be set to `true` or `1` before ALE is loaded for this
|
||||
behavior to be enabled. See |ale-lint-settings-on-startup|.
|
||||
|
||||
*ale-options.references_show_contents*
|
||||
*g:ale_references_show_contents*
|
||||
references_show_contents
|
||||
g:ale_references_show_contents
|
||||
Type: |Boolean| or |Number|
|
||||
Default: true
|
||||
|
||||
If set to `true` or `1`, matches found by `:ALEFindReferences` will be
|
||||
shown with a preview of the matching line.
|
||||
|
||||
*ale-options.rename_tsserver_find_in_comments*
|
||||
*g:ale_rename_tsserver_find_in_comments*
|
||||
rename_tsserver_find_in_comments
|
||||
@@ -3499,6 +3509,7 @@ documented in additional help files.
|
||||
fish....................................|ale-fish-options|
|
||||
fish_indent...........................|ale-fish-fish_indent|
|
||||
fortran.................................|ale-fortran-options|
|
||||
fortitude.............................|ale-fortran-fortitude|
|
||||
gcc...................................|ale-fortran-gcc|
|
||||
language_server.......................|ale-fortran-language-server|
|
||||
fountain................................|ale-fountain-options|
|
||||
@@ -3739,6 +3750,7 @@ documented in additional help files.
|
||||
uncrustify............................|ale-pawn-uncrustify|
|
||||
perl....................................|ale-perl-options|
|
||||
perl..................................|ale-perl-perl|
|
||||
perl language server..................|ale-perl-languageserver|
|
||||
perlcritic............................|ale-perl-perlcritic|
|
||||
perltidy..............................|ale-perl-perltidy|
|
||||
perl6...................................|ale-perl6-options|
|
||||
@@ -3973,6 +3985,8 @@ documented in additional help files.
|
||||
hdl-checker...........................|ale-verilog-hdl-checker|
|
||||
iverilog..............................|ale-verilog-iverilog|
|
||||
slang.................................|ale-verilog-slang|
|
||||
verible_ls............................|ale-verilog-verible-ls|
|
||||
verible_format........................|ale-verilog-verible-format|
|
||||
verilator.............................|ale-verilog-verilator|
|
||||
vlog..................................|ale-verilog-vlog|
|
||||
xvlog.................................|ale-verilog-xvlog|
|
||||
@@ -4065,10 +4079,14 @@ documented in additional help files.
|
||||
`:ALEFindReferences -split` - Open the location in a horizontal split.
|
||||
`:ALEFindReferences -vsplit` - Open the location in a vertical split.
|
||||
`:ALEFindReferences -quickfix` - Put the locations into quickfix list.
|
||||
`:ALEFindReferences -contents` - Show line contents for matches.
|
||||
|
||||
The default method used for navigating to a new location can be changed
|
||||
by modifying |g:ale_default_navigation|.
|
||||
|
||||
The default behaviour on whether to show line content for matches can
|
||||
be changed by modifying |g:ale_references_show_contents|.
|
||||
|
||||
You can add `-relative` to the command to view results with relatives paths,
|
||||
instead of absolute paths. This option has no effect if `-quickfix` is used.
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@ formatting.
|
||||
* fish [-n flag](https://linux.die.net/man/1/fish)
|
||||
* [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html)
|
||||
* Fortran
|
||||
* [fortitude](https://github.com/PlasmaFAIR/fortitude)
|
||||
* [gcc](https://gcc.gnu.org/)
|
||||
* [language_server](https://github.com/hansec/fortran-language-server) :speech_balloon:
|
||||
* Fountain
|
||||
@@ -481,6 +482,7 @@ formatting.
|
||||
* Pawn
|
||||
* [uncrustify](https://github.com/uncrustify/uncrustify)
|
||||
* Perl
|
||||
* [languageserver](https://metacpan.org/pod/Perl::LanguageServer)
|
||||
* [perl -c](https://perl.org/) :warning:
|
||||
* [perl-critic](https://metacpan.org/pod/Perl::Critic)
|
||||
* [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy)
|
||||
@@ -733,6 +735,7 @@ formatting.
|
||||
* [hdl-checker](https://pypi.org/project/hdl-checker)
|
||||
* [iverilog](https://github.com/steveicarus/iverilog)
|
||||
* [slang](https://github.com/MikePopoloski/slang)
|
||||
* [verible](https://github.com/chipsalliance/verible/tree/master)
|
||||
* [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) :speech_balloon:
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('verilog', 'verible_format')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The verible format callback should return the correct default values):
|
||||
AssertFixer {'command': ale#Escape('verible-verilog-format') .' -'}
|
||||
|
||||
Execute(The verible format callback should allow a custom executable):
|
||||
let g:ale_verilog_verible_format_executable = 'foo/bar'
|
||||
AssertFixer {'command': ale#Escape('foo/bar') . ' -'}
|
||||
|
||||
Execute(The verible format callback should allow custom options):
|
||||
let g:ale_verilog_verible_format_options = '--foo --bar'
|
||||
AssertFixer {'command': ale#Escape('verible-verilog-format') .' --foo --bar -'}
|
||||
@@ -0,0 +1,59 @@
|
||||
Before:
|
||||
runtime ale_linters/fortran/fortitude.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Simple fortitude handler run):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'end_lnum': 3,
|
||||
\ 'col': 5,
|
||||
\ 'end_col': 18,
|
||||
\ 'text': '''implicit none'' missing ''external''',
|
||||
\ 'type': 'W',
|
||||
\ 'code': 'C003',
|
||||
\ },
|
||||
\ {
|
||||
\ 'col': 13,
|
||||
\ 'end_col': 14,
|
||||
\ 'end_lnum': 7,
|
||||
\ 'lnum': 7,
|
||||
\ 'text': 'Syntax error',
|
||||
\ 'type': 'E',
|
||||
\ 'code': 'E001',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#fortitude#Handle(bufnr(''), [
|
||||
\ '[',
|
||||
\ json_encode({
|
||||
\ 'code': 'C003',
|
||||
\ 'end_location': {'column': 18, 'row': 3},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': {
|
||||
\ 'applicability': 'unsafe',
|
||||
\ 'edits': [
|
||||
\ {
|
||||
\ 'content': ' (type, external)',
|
||||
\ 'end_location': {'column': 18, 'row': 3},
|
||||
\ 'location': {'column': 18, 'row': 3},
|
||||
\ },
|
||||
\ ],
|
||||
\ 'message': 'Add `(external)` to ''implicit none''',
|
||||
\ },
|
||||
\ 'location': {'column': 5, 'row': 3},
|
||||
\ 'message': '''implicit none'' missing ''external'''
|
||||
\ }),
|
||||
\ ',',
|
||||
\ json_encode({
|
||||
\ 'code': 'E001',
|
||||
\ 'end_location': {'column': 14, 'row': 7},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': v:null,
|
||||
\ 'location': {'column': 13, 'row': 7},
|
||||
\ 'message': 'Syntax error',
|
||||
\ }),
|
||||
\ ']',
|
||||
\ ])
|
||||
@@ -24,3 +24,28 @@ Execute(The ansible_lint executable should be configurable):
|
||||
GivenCommandOutput ['v4.1.2']
|
||||
AssertLinter '~/.local/bin/ansible-lint',
|
||||
\ ale#Escape('~/.local/bin/ansible-lint') . ' --nocolor -p %t'
|
||||
|
||||
Execute(pipenv is detected when ansible_ansible_lint_auto_pipenv is set):
|
||||
let g:ale_ansible_ansible_lint_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/ansible/pipenv/script.yml')
|
||||
|
||||
GivenCommandOutput ['v25.6.1']
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'pipenv', ale#Escape('pipenv') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
||||
|
||||
Execute(poetry is detected when ansible_ansible_lint_auto_poetry is set):
|
||||
let g:ale_ansible_ansible_lint_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/ansible/poetry/script.yml')
|
||||
|
||||
GivenCommandOutput ['v25.6.1']
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
||||
|
||||
Execute(uv is detected when ansible_ansible_lint_auto_uv is set):
|
||||
let g:ale_ansible_ansible_lint_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/ansible/uv/script.yml')
|
||||
|
||||
GivenCommandOutput ['v25.6.1']
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('fortran', 'fortitude')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default fortitude command should be correct):
|
||||
AssertLinter 'fortitude', ale#Escape('fortitude')
|
||||
\ . ' check --output-format json %s'
|
||||
|
||||
Execute(fortitude should be configurable):
|
||||
let b:ale_fortran_fortitude_executable = 'custom-exe'
|
||||
let b:ale_fortran_fortitude_options = '--foobar'
|
||||
|
||||
AssertLinter 'custom-exe', ale#Escape('custom-exe')
|
||||
\ . ' check --output-format json --foobar %s'
|
||||
@@ -12,3 +12,5 @@ Execute(Overriding the executable and command should work):
|
||||
let b:ale_perl_perl_options = '-w'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -w %t'
|
||||
unlet b:ale_perl_perl_executable
|
||||
unlet b:ale_perl_perl_options
|
||||
@@ -0,0 +1,82 @@
|
||||
" Author: rymdbar <https://rymdbar.x20.se/>
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('perl', 'languageserver')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default Perl command callback should be correct):
|
||||
AssertLinter 'perl',
|
||||
\ ale#Escape('perl') . ' -MPerl::LanguageServer -ePerl::LanguageServer::run'
|
||||
|
||||
Execute(Overriding the executable should work):
|
||||
let b:ale_perl_perl_executable = 'plls'
|
||||
|
||||
AssertLinter 'plls', ale#Escape('plls') .
|
||||
\ ' -MPerl::LanguageServer -ePerl::LanguageServer::run'
|
||||
unlet b:ale_perl_perl_executable
|
||||
|
||||
Execute(The project root should be detected correctly in from build files):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/' . mod . '/subdir/empty.pl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl/' . mod)
|
||||
endfor
|
||||
|
||||
Execute(The project root should be globally configurable):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
|
||||
" Configuring g:ale_root using a Dictionary works.
|
||||
let g:ale_root.languageserver =
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet g:ale_root.languageserver
|
||||
" As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there
|
||||
" is a bug with g:ale_root.
|
||||
" While attempting to configure g:ale_root using a String might be a quite
|
||||
" limiting setup, it would be handy for debugging. However the test case is
|
||||
" missing here. It would unfortunately just fail.
|
||||
endfor
|
||||
|
||||
Execute(The project root should be per buffer configurable):
|
||||
for mod in ['extutils-makemaker', 'module-build', 'dist-zilla']
|
||||
call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl')
|
||||
" Configuring b:ale_root using a String works.
|
||||
let b:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet b:ale_root
|
||||
|
||||
" Configuring b:ale_root using a Dictionary works.
|
||||
let b:ale_root = {
|
||||
\ 'languageserver': ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
\ }
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl')
|
||||
unlet b:ale_root.languageserver
|
||||
endfor
|
||||
|
||||
Execute(The LSP values should be set correctly):
|
||||
|
||||
AssertLSPLanguage 'perl'
|
||||
|
||||
AssertLSPOptions {}
|
||||
|
||||
AssertLSPConfig {'perl': {'enable': 1}}
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
let b:ale_perl_languageserver_config = {
|
||||
\ 'perl': {
|
||||
\ 'perlInc': ['/usr/share/perl5/', '/usr/local/share/perl5/' ],
|
||||
\ 'fileFilter': [''],
|
||||
\ },
|
||||
\ }
|
||||
|
||||
AssertLSPConfig {
|
||||
\ 'perl': {
|
||||
\ 'perlInc': ['/usr/share/perl5/', '/usr/local/share/perl5/' ],
|
||||
\ 'fileFilter': [''],
|
||||
\ },
|
||||
\ }
|
||||
@@ -0,0 +1,33 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('verilog', 'verible_ls')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path and arguments should be correct):
|
||||
AssertLinter 'verible-verilog-ls', ale#Escape('verible-verilog-ls') . ' --rules_config_search'
|
||||
|
||||
Execute(The project root should be detected correctly in empty directory):
|
||||
AssertLSPProject '.'
|
||||
|
||||
Execute(The project root should be detected correctly with verible.filelist):
|
||||
call ale#test#SetFilename('../test-files/verilog/verible/module.sv')
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/verilog/verible')
|
||||
|
||||
Execute(The LSP values should be set correctly):
|
||||
call ale#test#SetFilename('../test-files/verilog/verible/module.sv')
|
||||
|
||||
AssertLSPLanguage 'verilog'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/verilog/verible')
|
||||
|
||||
|
||||
Execute(The verible LSP callback should allow custom options):
|
||||
let g:ale_verilog_verible_ls_options = '--foo --bar'
|
||||
AssertLinter 'verible-verilog-ls', ale#Escape('verible-verilog-ls') . ' --foo --bar'
|
||||
|
||||
|
||||
Execute(The verible LSP callback should allow custom rules):
|
||||
let g:ale_verilog_verible_ls_rules = '+foo,-bar'
|
||||
AssertLinter 'verible-verilog-ls', ale#Escape('verible-verilog-ls') . ' --rules_config_search --rules=+foo,-bar'
|
||||
Whitespace-only changes.
Whitespace-only changes.
Generated
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
# https://metacpan.org/pod/Dist::Zilla
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
# https://perldoc.perl.org/ExtUtils::MakeMaker
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
# https://metacpan.org/pod/Module::Build
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
./module.sv
|
||||
@@ -119,7 +119,7 @@ Execute(The defaults for the zsh filetype should be correct):
|
||||
Execute(The defaults for the verilog filetype should be correct):
|
||||
" This filetype isn't configured with default, so we can test loading all
|
||||
" available linters with this.
|
||||
AssertEqual ['hdl_checker', 'iverilog', 'slang', 'verilator', 'vlog', 'xvlog', 'yosys'], GetLinterNames('verilog')
|
||||
AssertEqual ['hdl_checker', 'iverilog', 'slang', 'verible_ls', 'verilator', 'vlog', 'xvlog', 'yosys'], GetLinterNames('verilog')
|
||||
|
||||
let g:ale_linters_explicit = 1
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Before:
|
||||
call ale#test#SetFilename('dummy.txt')
|
||||
|
||||
Save g:ale_default_navigation
|
||||
Save g:ale_references_show_contents
|
||||
|
||||
let g:old_filename = expand('%:p')
|
||||
let g:Callback = ''
|
||||
@@ -15,6 +16,7 @@ Before:
|
||||
let g:conn_id = v:null
|
||||
let g:InitCallback = v:null
|
||||
let g:ale_default_navigation = 'buffer'
|
||||
let g:ale_references_show_contents = 1
|
||||
|
||||
runtime autoload/ale/lsp_linter.vim
|
||||
runtime autoload/ale/lsp.vim
|
||||
@@ -281,7 +283,7 @@ Execute(tsserver reference requests should be sent):
|
||||
\ [0, 'ts@references', {'file': expand('%:p'), 'line': 2, 'offset': 5}]
|
||||
\ ],
|
||||
\ g:message_list
|
||||
AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServerResponse):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -291,7 +293,7 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServe
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
|
||||
|
||||
Execute(`-tab` should display results in tabs):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -301,7 +303,7 @@ Execute(`-tab` should display results in tabs):
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute(The default navigation type should be used):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -312,7 +314,7 @@ Execute(The default navigation type should be used):
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute(`-split` should display results in splits):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -322,7 +324,7 @@ Execute(`-split` should display results in splits):
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'split', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'split', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute(`-vsplit` should display results in vsplits):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -332,7 +334,7 @@ Execute(`-vsplit` should display results in vsplits):
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'vsplit', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'vsplit', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute(`-quickfix` should display results in quickfix):
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
@@ -342,7 +344,7 @@ Execute(`-quickfix` should display results in quickfix):
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'quickfix', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'quickfix', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Given python(Some Python file):
|
||||
foo
|
||||
@@ -378,11 +380,13 @@ Execute(LSP reference responses should be handled):
|
||||
\ 'filename': ale#path#Simplify(g:dir . '/completion_dummy_file'),
|
||||
\ 'line': 3,
|
||||
\ 'column': 8,
|
||||
\ 'match': '',
|
||||
\ },
|
||||
\ {
|
||||
\ 'filename': ale#path#Simplify(g:dir . '/other_file'),
|
||||
\ 'line': 8,
|
||||
\ 'column': 16,
|
||||
\ 'match': '',
|
||||
\ },
|
||||
\ ],
|
||||
\ g:item_list
|
||||
@@ -415,6 +419,163 @@ Execute(LSP reference responses should be put to quickfix):
|
||||
\ 2,
|
||||
\ len(getqflist())
|
||||
|
||||
Execute(LSP reference responses should contain line contents):
|
||||
let tempfile = tempname()
|
||||
let contents = ['line1 sometext', 'line2 othertext', 'line3 moretext']
|
||||
call writefile(contents, tempfile)
|
||||
|
||||
call ale#references#SetMap({3: { 'show_contents': 1 }})
|
||||
|
||||
call ale#references#HandleLSPResponse(
|
||||
\ 1,
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 0, 'character': 6},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 1},
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\)
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(g:item_list)
|
||||
|
||||
AssertEqual contents[0], g:item_list[0]['match']
|
||||
AssertEqual contents[2], g:item_list[1]['match']
|
||||
|
||||
call ale#references#SetMap({3: { 'show_contents': 1, 'open_in': 'quickfix' }})
|
||||
|
||||
call ale#references#HandleLSPResponse(
|
||||
\ 1,
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 0, 'character': 6},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 1},
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\)
|
||||
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(getqflist())
|
||||
|
||||
AssertEqual contents[0], getqflist()[0]['text']
|
||||
AssertEqual contents[2], getqflist()[1]['text']
|
||||
|
||||
Execute(LSP reference responses should not contain line contents when disabled):
|
||||
call ale#references#SetMap({3: { 'show_contents': 0 }})
|
||||
|
||||
call ale#references#HandleLSPResponse(
|
||||
\ 1,
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI('dummy'),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 0, 'character': 6},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI('dummy'),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 1},
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\)
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(g:item_list)
|
||||
|
||||
AssertEqual '', g:item_list[0]['match']
|
||||
AssertEqual '', g:item_list[1]['match']
|
||||
call ale#references#SetMap({3: { 'show_contents': 0, 'open_in': 'quickfix' }} )
|
||||
|
||||
call ale#references#HandleLSPResponse(
|
||||
\ 1,
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI('dummy'),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 0, 'character': 6},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI('dummy'),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 1},
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\)
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(getqflist())
|
||||
|
||||
AssertEqual '', getqflist()[0]['text']
|
||||
AssertEqual '', getqflist()[1]['text']
|
||||
|
||||
Execute(LSP reference responses should respect the global configuration):
|
||||
let g:ale_references_show_contents = 0
|
||||
call ale#references#SetMap({3: {}})
|
||||
|
||||
let tempfile = tempname()
|
||||
let contents = ['line1 sometext', 'line2 othertext', 'line3 moretext']
|
||||
call writefile(contents, tempfile)
|
||||
|
||||
call ale#references#HandleLSPResponse(
|
||||
\ 1,
|
||||
\ {
|
||||
\ 'id': 3,
|
||||
\ 'result': [
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 0, 'character': 6},
|
||||
\ },
|
||||
\ },
|
||||
\ {
|
||||
\ 'uri': ale#path#ToFileURI(tempfile),
|
||||
\ 'range': {
|
||||
\ 'start': {'line': 2, 'character': 1},
|
||||
\ },
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\)
|
||||
AssertEqual
|
||||
\ 2,
|
||||
\ len(g:item_list)
|
||||
|
||||
AssertEqual '', g:item_list[0]['match']
|
||||
AssertEqual '', g:item_list[1]['match']
|
||||
|
||||
Execute(Preview windows should not be opened for empty LSP reference responses):
|
||||
call ale#references#SetMap({3: {}})
|
||||
call ale#references#HandleLSPResponse(1, {'id': 3, 'result': []})
|
||||
@@ -466,7 +627,7 @@ Execute(LSP reference requests should be sent):
|
||||
\ ],
|
||||
\ g:message_list
|
||||
|
||||
AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
|
||||
|
||||
Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResponse):
|
||||
runtime ale_linters/python/pylsp.vim
|
||||
@@ -477,4 +638,4 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResp
|
||||
|
||||
call g:InitCallback()
|
||||
|
||||
AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
|
||||
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
|
||||
Reference in new issue
Block a user