Closed twilco closed 5 years ago
Happy you liked :)
It's possible yes, but it does require some changes on the backed side first to support LSP (planned but not yet started at the moment). Async checks is something I'd be keen on adding anyway, let's see how it goes
vim-hdl uses HDL Code Checker and since ALE implements LSP, you can just use HDL Code Checker instead.
pip install hdlcc
Add the following to your .vimrc
" Gets the path to the nearest g:vimhdl_conf_file
function! s:GetProjectRoot(buffer) abort
let l:config_file = get(b:, 'vimhdl_conf_file', get(g:, 'vimhdl_conf_file', 'vimhdl.prj'))
let l:project_root = ale#path#FindNearestFile(a:buffer, l:config_file)
let l:project_root = !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
return l:project_root
endfunction
" Setup ALE to use HDL Code Checker
function! s:hdlccLspSetup() abort
for l:filetype in ['vhdl', 'verilog', 'systemverilog']
try
call ale#linter#Define(l:filetype, {
\ 'name': 'vimhdl',
\ 'lsp': 'stdio',
\ 'language': l:filetype,
\ 'executable': 'hdlcc',
\ 'command': 'hdlcc --lsp',
\ 'project_root': function('s:GetProjectRoot'),
\ })
if exists('g:ale_linters')
let l:existing = get(g:ale_linters, l:filetype, [])
let g:ale_linters[l:filetype] = l:existing + ['vimhdl', ]
else
let g:ale_linters = { l:filetype : ['vimhdl', ] }
endif
catch /^Vim\%((\a\+)\)\=:E117/
" If setting up ALE didn't work, just bail
return
endtry
endfor
endfunction
On a VHDL/Verilog/SystemVerilog file, you can then use ALEInfo
to check which linters are available
:ALEInfo
Current Filetype: verilog
Available Linters: ['vimhdl', 'iverilog', 'verilator', 'vlog', 'xvlog']
Enabled Linters: ['vimhdl']
...
Command History:
(executable check - success) hdlcc
(started) ['/bin/bash', '-c', 'hdlcc --lsp']
Let me know if you have any issues
Hi there! Thanks for making this awesome tool. I see integration with Syntastic is possible, but what about ale? Is this currently possible?