Skip to content

Commit 91b65d9

Browse files
committed
Catch SwiftPM warnings with ale
1 parent 404df97 commit 91b65d9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ale_linters/swift/swiftpm.vim

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function! ale_linters#swift#swiftpm#Handle(buffer, lines)
2525
" Match and capture line number
2626
" Match and capture column number
2727
" Match and capture anything in the message
28-
let l:pattern = '^[^:]\+:\(\d\+\):\(\d\+\):\s*error:\s*\(.*\)$'
28+
let l:pattern = '^[^:]\+:\(\d\+\):\(\d\+\):\s*\(error\|warning\):\s*\(.*\)$'
2929
let l:output = []
3030

3131
for l:line in a:lines
@@ -37,15 +37,23 @@ function! ale_linters#swift#swiftpm#Handle(buffer, lines)
3737

3838
let l:line_number = l:match[1]
3939
let l:column = l:match[2]
40-
let l:text = l:match[3]
40+
let l:type = l:match[3]
41+
let l:text = l:match[4]
42+
let l:type_identifier = 'N'
43+
44+
if l:type == 'error'
45+
let l:type_identifier = 'E'
46+
elseif l:type == 'warning'
47+
let l:type_identifier = 'W'
48+
endif
4149

4250
call add(l:output, {
4351
\ 'bufnr': a:buffer,
4452
\ 'lnum': l:line_number,
4553
\ 'vcol': 0,
4654
\ 'col': l:column,
4755
\ 'text': l:text,
48-
\ 'type': 'E',
56+
\ 'type': l:type_identifier,
4957
\ })
5058
endfor
5159

0 commit comments

Comments
 (0)