diff options
author | w0rp <devw0rp@gmail.com> | 2017-02-11 19:40:57 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-02-11 19:40:57 +0000 |
commit | ecbb27680563a50d4dd981f968d659ef20bfbe30 (patch) | |
tree | 3e60f1ad7840dce1351819cd191a4c7ca0a7330e /ale_linters/verilog | |
parent | c33602534e205aa677521ce49a8054588d88bdc2 (diff) | |
download | ale-ecbb27680563a50d4dd981f968d659ef20bfbe30.zip |
Replace every stdin-wrapper script with the new %t formatting support
Diffstat (limited to 'ale_linters/verilog')
-rw-r--r-- | ale_linters/verilog/iverilog.vim | 2 | ||||
-rw-r--r-- | ale_linters/verilog/verilator.vim | 33 |
2 files changed, 23 insertions, 12 deletions
diff --git a/ale_linters/verilog/iverilog.vim b/ale_linters/verilog/iverilog.vim index d10661d7..cf1b0fa8 100644 --- a/ale_linters/verilog/iverilog.vim +++ b/ale_linters/verilog/iverilog.vim @@ -40,6 +40,6 @@ call ale#linter#Define('verilog', { \ 'name': 'iverilog', \ 'output_stream': 'stderr', \ 'executable': 'iverilog', -\ 'command': g:ale#util#stdin_wrapper . ' .v iverilog -t null -Wall', +\ 'command': 'iverilog -t null -Wall %t', \ 'callback': 'ale_linters#verilog#iverilog#Handle', \}) diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim index 534e1ae2..4ff2093a 100644 --- a/ale_linters/verilog/verilator.vim +++ b/ale_linters/verilog/verilator.vim @@ -1,6 +1,16 @@ " Author: Masahiro H https://github.com/mshr-h " Description: verilator for verilog files +function! ale_linters#verilog#verilator#GetCommand(buffer) abort + let l:filename = tempname() . '_verilator_linted.v' + + " Create a special filename, so we can detect it in the handler. + call ale#engine#ManageFile(a:buffer, l:filename) + call writefile(getbufline(a:buffer, 1, '$'), l:filename) + + return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' . fnameescape(l:filename) +endfunction + function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " Look for lines like the following. " @@ -25,16 +35,16 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort let l:text = l:match[4] let l:file = l:match[2] - if(l:file =~# '_verilator_linted.v') - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:line, - \ 'vcol': 0, - \ 'col': 1, - \ 'text': l:text, - \ 'type': l:type, - \ 'nr': -1, - \}) + if l:file =~# '_verilator_linted.v' + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:line, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': l:text, + \ 'type': l:type, + \ 'nr': -1, + \}) endif endfor @@ -45,6 +55,7 @@ call ale#linter#Define('verilog', { \ 'name': 'verilator', \ 'output_stream': 'stderr', \ 'executable': 'verilator', -\ 'command': g:ale#util#stdin_wrapper . ' _verilator_linted.v verilator --lint-only -Wall -Wno-DECLFILENAME', +\ 'command_callback': 'ale_linters#verilog#verilator#GetCommand', \ 'callback': 'ale_linters#verilog#verilator#Handle', +\ 'read_buffer': 0, \}) |