]> git.madduck.net Git - etc/vim.git/blob - ale_linters/racket/raco.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / racket / raco.vim
1 " Author: aqui18 <https://github.com/aqui18>
2 " Description: This file adds support for checking Racket code with raco.
3 "              This is the same form of syntax-checking used by DrRacket as well. The
4 "              downside is that it will only catch the first error, but none of the
5 "              subsequent ones. This is due to how evaluation in Racket works.
6
7 function! ale_linters#racket#raco#Handle(buffer, lines) abort
8     " Matches patterns
9     " <file>:<line>:<column> <message>
10     " eg:
11     " info.rkt:4:0: infotab-module: not a well-formed definition
12     let l:pattern = '^\(\s\)\@!\(.\+\):\(\d\+\):\(\d\+\): \(.\+\)$'
13     let l:output = []
14
15     for l:match in ale#util#GetMatches(a:lines, l:pattern)
16         call add(l:output, {
17         \   'filename': l:match[2],
18         \   'lnum': l:match[3] + 0,
19         \   'col': l:match[4] + 0,
20         \   'type': 'E',
21         \   'text': l:match[5],
22         \})
23     endfor
24
25     return l:output
26 endfunction
27
28 call ale#linter#Define('racket', {
29 \   'name': 'raco',
30 \   'executable': 'raco',
31 \   'output_stream': 'stderr',
32 \   'command': 'raco expand %s',
33 \   'callback': 'ale_linters#racket#raco#Handle',
34 \})