我正在尝试为一种名为ALF的语言编写synastic_checker,该检查工具名为sweet。 我无法加载我的检查器。我做了以下事情:
我按照wiki上的示例(https://github.com/vim-syntastic/syntastic/wiki/Syntax-Checker-Guide)
:SyntasticInfo输出:
Syntastic version: 3.8.0-38 (Vim 704, Linux, GUI)
Info for filetype: alf
Global mode: active
Filetype alf is active
The current file will be checked automatically
Available checkers: -
Currently enabled checkers: -
Press ENTER or type command to continue
有人可以给我一些关于如何获得更多调试信息的提示吗? 我觉得我的剧本根本没有被运行......
P.S:我的检查文件的内容如下:
if exists('g:loaded_syntastic_alf_sweet_checker')
finish
endif
let g:loaded_syntastic_alf_sweet_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_alf_sweet_IsAvailable() dict
if !exists('g:syntastic_alf_compiler')
let g:syntastic_alf_compiler = executable(self.getExec())
endif
call self.log('g:syntastic_alf_compiler =', g:syntastic_alf_compiler)
return executable(expand(g:syntastic_alf_compiler, 1))
endfunction
" function! SyntaxCheckers_ruby_mri_GetHighlightRegex(item)
" if match(a:item['text'], 'assigned but unused variable') > -1
" let term = split(a:item['text'], ' - ')[1]
" return '\V\\<'.term.'\\>'
" endif
" return ''
" endfunction
function! SyntaxCheckers_alf_sweet_GetLocList() dict
" let makeprg = self.makeprgBuild({
" \ 'args_after': '-i=' })
" let errorformat = '%EAt %l.%c-%l.%c:'
return syntastic#c#GetLocList('alf', 'sweet', {
\ 'errorformat':
\ 'At %l.%c-%l.%c:',
\ 'main_flags': '-i=' . syntastic#util#DevNull() })
" return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'alf',
\ 'name': 'sweet' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:
答案 0 :(得分:0)
我似乎在这里犯了一个错误:
function! SyntaxCheckers_alf_sweet_IsAvailable() dict
if !exists('g:syntastic_alf_compiler')
let g:syntastic_alf_compiler = executable(self.getExec())
endif
call self.log('g:syntastic_alf_compiler =', g:syntastic_alf_compiler)
return executable(expand(g:syntastic_alf_compiler, 1))
endfunction
哪里
let g:syntastic_alf_compiler = executable(self.getExec())
必须
let g:syntastic_alf_compiler = self.getExec()
我不知道为什么。我是vimscript的新手。也许这可以帮助将来的某个人。