summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/cs/mcs.vim11
-rw-r--r--ale_linters/cs/mcsc.vim7
-rw-r--r--test/handler/test_mcs_handler.vader9
-rw-r--r--test/handler/test_mcsc_handler.vader9
4 files changed, 22 insertions, 14 deletions
diff --git a/ale_linters/cs/mcs.vim b/ale_linters/cs/mcs.vim
index 3d042f99..b5c4054a 100644
--- a/ale_linters/cs/mcs.vim
+++ b/ale_linters/cs/mcs.vim
@@ -8,15 +8,16 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
" Look for lines like the following.
"
" Tests.cs(12,29): error CSXXXX: ; expected
- let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
+ let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
- \ 'lnum': l:match[1] + 0,
- \ 'col': l:match[2] + 0,
- \ 'text': l:match[3] . ': ' . l:match[4],
- \ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
+ \ 'lnum': l:match[2] + 0,
+ \ 'col': l:match[3] + 0,
+ \ 'type': l:match[4] is# 'error' ? 'E' : 'W',
+ \ 'code': l:match[5],
+ \ 'text': l:match[6],
\})
endfor
diff --git a/ale_linters/cs/mcsc.vim b/ale_linters/cs/mcsc.vim
index 38a08556..6e51ef3a 100644
--- a/ale_linters/cs/mcsc.vim
+++ b/ale_linters/cs/mcsc.vim
@@ -60,7 +60,7 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
" NOTE: pattern also captures file name as linter compiles all
" files within the source tree rooted at the specified source
" path and not just the file loaded in the buffer
- let l:pattern = '^\(.\+\.cs\)(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
+ let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
let l:output = []
let l:source = ale#Var(a:buffer, 'cs_mcsc_source')
@@ -69,8 +69,9 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
\ 'filename': fnamemodify(l:source . '/' . l:match[1], ':p'),
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
- \ 'text': l:match[4] . ': ' . l:match[5],
- \ 'type': l:match[4] =~# '^error' ? 'E' : 'W',
+ \ 'type': l:match[4] is# 'error' ? 'E' : 'W',
+ \ 'code': l:match[5],
+ \ 'text': l:match[6],
\})
endfor
diff --git a/test/handler/test_mcs_handler.vader b/test/handler/test_mcs_handler.vader
index 75a764a3..3defc328 100644
--- a/test/handler/test_mcs_handler.vader
+++ b/test/handler/test_mcs_handler.vader
@@ -10,19 +10,22 @@ Execute(The mcs handler should handle cannot find symbol errors):
\ {
\ 'lnum': 12,
\ 'col' : 29,
- \ 'text': 'error CS1001: ; expected',
+ \ 'text': '; expected',
+ \ 'code': 'CS1001',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 101,
\ 'col': 0,
- \ 'text': 'error CS1028: Unexpected processor directive (no #if for this #endif)',
+ \ 'text': 'Unexpected processor directive (no #if for this #endif)',
+ \ 'code': 'CS1028',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 10,
\ 'col': 12,
- \ 'text': 'warning CS0123: some warning',
+ \ 'text': 'some warning',
+ \ 'code': 'CS0123',
\ 'type': 'W',
\ },
\ ],
diff --git a/test/handler/test_mcsc_handler.vader b/test/handler/test_mcsc_handler.vader
index 5f4c133c..a0007926 100644
--- a/test/handler/test_mcsc_handler.vader
+++ b/test/handler/test_mcsc_handler.vader
@@ -17,21 +17,24 @@ Execute(The mcs handler should handle cannot find symbol errors):
\ {
\ 'lnum': 12,
\ 'col' : 29,
- \ 'text': 'error CS1001: ; expected',
+ \ 'text': '; expected',
+ \ 'code': 'CS1001',
\ 'type': 'E',
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 101,
\ 'col': 0,
- \ 'text': 'error CS1028: Unexpected processor directive (no #if for this #endif)',
+ \ 'text': 'Unexpected processor directive (no #if for this #endif)',
+ \ 'code': 'CS1028',
\ 'type': 'E',
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 10,
\ 'col': 12,
- \ 'text': 'warning CS0123: some warning',
+ \ 'text': 'some warning',
+ \ 'code': 'CS0123',
\ 'type': 'W',
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },