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.
1 call ale#Set('cs_mcsc_options', '')
2 call ale#Set('cs_mcsc_source', '')
3 call ale#Set('cs_mcsc_assembly_path', [])
4 call ale#Set('cs_mcsc_assemblies', [])
6 function! ale_linters#cs#mcsc#GetCwd(buffer) abort
7 let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source')
9 return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
12 function! ale_linters#cs#mcsc#GetCommand(buffer) abort
13 " Pass assembly paths via the -lib: parameter.
14 let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
16 let l:lib_option = !empty(l:path_list)
17 \ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
20 " Pass paths to DLL files via the -r: parameter.
21 let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
23 let l:r_option = !empty(l:assembly_list)
24 \ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
27 " register temporary module target file with ale
28 " register temporary module target file with ALE.
29 let l:out = ale#command#CreateFile(a:buffer)
31 " The code is compiled as a module and the output is redirected to a
34 \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
35 \ . ale#Pad(l:lib_option)
36 \ . ale#Pad(l:r_option)
39 \ . ' -recurse:' . ale#Escape('*.cs')
42 function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
43 " Look for lines like the following.
45 " Tests.cs(12,29): error CSXXXX: ; expected
47 " NOTE: pattern also captures file name as linter compiles all
48 " files within the source tree rooted at the specified source
49 " path and not just the file loaded in the buffer
51 \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
52 \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
56 let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer)
58 for l:match in ale#util#GetMatches(a:lines, l:patterns)
59 if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
61 \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
62 \ 'lnum': l:match[2] + 0,
63 \ 'col': l:match[3] + 0,
64 \ 'type': l:match[4] is# 'error' ? 'E' : 'W',
66 \ 'text': l:match[6] ,
68 elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
73 \ 'type': l:match[1] is# 'error' ? 'E' : 'W',
83 call ale#linter#Define('cs',{
85 \ 'output_stream': 'stderr',
86 \ 'executable': 'mcs',
87 \ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
88 \ 'command': function('ale_linters#cs#mcsc#GetCommand'),
89 \ 'callback': 'ale_linters#cs#mcsc#Handle',