5

我一直在使用 Syntastic,直到在终端 vim 中安装 YouCompleteMe。所以,问题是 YouCompleteMe 不允许 Syntastic 检查错误,但我需要两个插件。

YouCompleteMe 有一些错误检查器,但我没有找到一种方法来检查 Javascript 错误。

我该如何解决?

.vimrc 用于 Syntastic

let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 2
let g:syntastic_loc_list_height = 8
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_aggregate_errors = 1
let g:syntastic_id_checkers = 1
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_javascript_checkers = ['jslint', 'jsonlint', 'gjslint']
let g:syntastic_html_tidy_exec = 'tidy5'

YCM 的 .vimrc:

" YouCompleteMe and UltiSnips compatibility, with the helper of supertab
let g:ycm_key_list_select_completion   = ['<A-¶>', '<A-Space>', '<Down>']
let g:ycm_key_list_previous_completion = ['<A-§>', '<A-π>', '<Up>']

" You Complete Me Options
let g:ycm_show_diagnostics_ui = 0
let g:ycm_enable_diagnostic_highlighting = 0
let g:ycm_enable_diagnostic_signs = 0
let g:ycm_show_diagnostics_ui = 0
let g:ycm_open_loclist_on_ycm_diags = 0
let g:ycm_complete_in_comments = 0
let g:ycm_complete_in_strings = 0
let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:ycm_collect_identifiers_from_tags_files = 1

:SyntasticInfo 输出

> Syntastic version: 3.7.0-31 (Vim 704, Darwin) 
> Info for filetype: javascript
> Global mode: active 
> Filetype javascript is active 
> The current file will be checked automatically 
> Available checkers: -
> Currently enabled checkers: -

我不知道为什么可用和启用检查器已经消失了?他们在 YCM 安装之前就在那里工作!

4

1 回答 1

0

你可以做的是使用Neovim而不是 Vim 以及ALE插件和可选的LanguageClient-neovim插件。

要使后者工作,您还需要运行npm install -g javascript-typescript-langserver

这可以通过 JavaScript 语言服务器为您提供异步 linting (ALE) 和异步完成/linting 功能。

于 2017-12-10T11:58:01.040 回答