Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 2d2e420

Browse files
author
Tom Morton
committed
Sorbet syntax checker for ruby
1 parent 9041bc7 commit 2d2e420

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

syntax_checkers/ruby/sorbet.vim

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"============================================================================
2+
"File: sorbet.vim
3+
"Description: Syntax checking plugin for syntastic
4+
"Maintainer: Tom Morton <[email protected]>
5+
"License: This program is free software. It comes without any warranty,
6+
" to the extent permitted by applicable law. You can redistribute
7+
" it and/or modify it under the terms of the Do What The Fuck You
8+
" Want To Public License, Version 2, as published by Sam Hocevar.
9+
" See http://sam.zoy.org/wtfpl/COPYING for more details.
10+
"
11+
"============================================================================
12+
13+
if exists('g:loaded_syntastic_ruby_sorbet_checker')
14+
finish
15+
endif
16+
let g:loaded_syntastic_ruby_sorbet_checker = 1
17+
18+
let s:save_cpo = &cpo
19+
set cpo&vim
20+
21+
function! SyntaxCheckers_ruby_sorbet_IsAvailable() dict
22+
if !executable(self.getExec())
23+
return 0
24+
endif
25+
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1, 0])
26+
endfunction
27+
28+
function! SyntaxCheckers_ruby_sorbet_GetLocList() dict
29+
let makeprg = self.makeprgBuild({'args_before': 'tc'})
30+
31+
let errorformat = '%f:%l: %m'
32+
33+
let loclist = SyntasticMake({
34+
\ 'makeprg': makeprg,
35+
\ 'errorformat': errorformat,
36+
\ 'subtype': 'Style'})
37+
38+
" sorbet only emits errors
39+
for e in loclist
40+
let e['type'] = 'E'
41+
endfor
42+
43+
return loclist
44+
endfunction
45+
46+
call g:SyntasticRegistry.CreateAndRegisterChecker({
47+
\ 'filetype': 'ruby',
48+
\ 'name': 'sorbet',
49+
\ 'exec': 'srb' })
50+
51+
let &cpo = s:save_cpo
52+
unlet s:save_cpo
53+
54+
" vim: set sw=4 sts=4 et fdm=marker:

0 commit comments

Comments
 (0)