首页 文章

使用非标准HTML标记的Vim和Syntastic

提问于
浏览
1

我'm using Vim with Ionic framework and facing some troubles. Ionic has custom HTML tags and attributes for them. One of plugins I used in Vim - syntastic. So when I save my .html page with Ionic tags I'得到有关这些标签的错误和警告 . 另外,Ionic有自定义选择器的组件,所以我有一些像 <user-list></user-list> 的标签 .

有没有办法不沉默或忽略这些警告,但是使用Ionic HTML和自定义标签进行工作语法检查?我喜欢使用syntastic,它为我提供了有用的信息 .

我找到了关于禁用Ionic的合成和/或沉默错误和警告的答案 . 这不是我想要的 . 我有什么选择吗?在这一刻,我想我不准备为Vim制作自己的插件,也许将来也是如此 .

1 回答

  • 0

    首先尝试为typescript设置vim,看看syntastic是否仍然显示错误 . 使用https://github.com/leafgarland/typescript-vim获取语法,使用https://github.com/Quramy/tsuquyomi获取typescript服务器 . 这个article对我有所帮助 .

    另一种方法是通过合成来忽略离子标签 . 里面my vimrc

    " Set up the arrays to ignore for later
    if !exists('g:syntastic_html_tidy_ignore_errors')
        let g:syntastic_html_tidy_ignore_errors = []
    endif
    " Ignore ionic tags in HTML syntax checking
    " See http://stackoverflow.com/questions/30366621
    " ignore errors about Ionic tags
    let g:syntastic_html_tidy_ignore_errors += [
          \ "<ion-",
          \ "discarding unexpected </ion-",
          \ "plain text isn''t allowed in <head> elements"
    ]
    

相关问题