]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/cs/mcs.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / cs / mcs.vim
1 let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
2
3 function! ale_linters#cs#mcs#GetCommand(buffer) abort
4     let l:options = ale#Var(a:buffer, 'cs_mcs_options')
5
6     return 'mcs -unsafe --parse'
7     \   . (!empty(l:options) ? ' ' . l:options : '')
8     \   . ' %t'
9 endfunction
10
11 function! ale_linters#cs#mcs#Handle(buffer, lines) abort
12     " Look for lines like the following.
13     "
14     " Tests.cs(12,29): error CSXXXX: ; expected
15     let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
16     let l:output = []
17
18     for l:match in ale#util#GetMatches(a:lines, l:pattern)
19         call add(l:output, {
20         \   'lnum': l:match[2] + 0,
21         \   'col': l:match[3] + 0,
22         \   'type': l:match[4] is# 'error' ? 'E' : 'W',
23         \   'code': l:match[5],
24         \   'text': l:match[6],
25         \})
26     endfor
27
28     return l:output
29 endfunction
30
31 call ale#linter#Define('cs',{
32 \   'name': 'mcs',
33 \   'output_stream': 'stderr',
34 \   'executable': 'mcs',
35 \   'command': function('ale_linters#cs#mcs#GetCommand'),
36 \   'callback': 'ale_linters#cs#mcs#Handle',
37 \})