无法在vim的syntastic插件中使用Google Closure

3
我已在我的vimrc文件中添加以下行以运行syntastic插件。[已关闭]
let g:syntastic_mode_map = { 'mode': 'active',
                           \ 'active_filetypes': [],
                           \ 'passive_filetypes': ['html'] }

" To enable this plugin, edit the .vimrc like this:
let g:syntastic_javascript_checker = "closurecompiler" 
" and set the path to the Google Closure Compiler:
   let g:syntastic_javascript_closure_compiler_path = '~/.vim/closure-compier/compiler.jar'

 let g:syntastic_enable_signs=1
 let g:syntastic_auto_loc_list=1

但似乎没有起作用,我尝试调试closurecompiler.vim脚本。在它的函数SyntaxCheckers_javascript_GetLocList()中有一个makeprg变量,当我echo这个变量时,它打印出以下行:
 java -jar ~/.vim/closure/closure.jar --js 'workspace/abc.js'

但是没有显示任何错误,然而如果我在控制台中输入相同的行,我会得到所有的错误。我在我的设置中做错了什么? 您可以在GitHub上查看我的设置。

1
你在终端中输入的内容与你在vimrc文件中的内容不同。修复一下看看是否能更好地工作。另外,我认为它应该是“closure-compiler”,而不是“closure-compier”。 - romainl
1
我认为我的 closurecompiler 参数是正确的,而不是 closure-compiler,因为你可以从图片中看出,现在它甚至无法找到正确的语法检查器。 此外,如果将 vim 打印的行直接放在终端上,我会得到输出:java -jar ~/.vim/closure-compiler/compiler.jar --js 'Desktop/syntx.js' Desktop/syntx.js:1: ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option. var obj = { ar : 'sadada', ^ 1 error(s), 0 warning(s) - deven98602
vim设置 这是一个设置,它可以使用。它有什么问题吗? - deven98602
1个回答

1

我想我找到了你的错误。我刚刚通过github下载了你的安装程序,发现你的.vimrc文件中有一个错别字:

let g:syntastic_javascript_closure_compiler_path = '~/.vim/closure-compier/compiler.jar'

当我将这一行改为这样:

let g:syntastic_javascript_closure_compiler_path = '~/.vim/closure-compiler/compiler.jar'

当我启动gvim abc.js时,我得到了这个:

   ss of vim w/ abc.js and closure

看起来现在正常了。


我太蠢了!Romainl指出了这个错误,但是我太笨了不理解,不过还是感谢你花时间回答。 - deven98602
没问题。现在我知道如何使用Syntastic和Google的Closure Lint检查器了,所以这很值得。感谢你的知识!如果您不介意,请接受这个答案。 - slm
好的,但是对于颁发悬赏,stackoverflow有规定我只能在24小时后颁发。 - deven98602
你的意思是必须等待24小时,还是悬赏必须持续24小时,然后有人回答问题? - slm
2
@deven98602,我早就告诉过你了;-) - romainl
是的,我必须等待24小时才能选择您的答案。 - deven98602

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接