mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-05 22:54:24 +08:00
Add naga linter for WGSL support (#4047)
* Add WGSL support using `naga` command * Add documents for wgsl * Add test for `naga` linter * Separate naga handler callback to hanlder/naga.vim
This commit is contained in:
30
autoload/ale/handlers/naga.vim
Normal file
30
autoload/ale/handlers/naga.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" Author: rhysd <https://github.com/rhysd>
|
||||
" Description: Handle errors for naga-cli.
|
||||
|
||||
function! ale#handlers#naga#Handle(buffer, lines) abort
|
||||
let l:errors = []
|
||||
let l:current_error = v:null
|
||||
|
||||
for l:line in a:lines
|
||||
if l:line =~# '^error: '
|
||||
let l:text = l:line[7:]
|
||||
let l:current_error = { 'text': l:text, 'type': 'E' }
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:current_error isnot v:null
|
||||
let l:matches = matchlist(l:line, '\v:(\d+):(\d+)$')
|
||||
|
||||
if !empty(l:matches)
|
||||
let l:current_error.lnum = str2nr(l:matches[1])
|
||||
let l:current_error.col = str2nr(l:matches[2])
|
||||
call add(l:errors, l:current_error)
|
||||
let l:current_error = v:null
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:errors
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user