1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-14 05:07:59 +08:00

fix(layer): add :h SpaceVim-layers-lang-vue

Problem: failed to lint vue file.
Solution:
1. change eslint-plugin-html to eslint-plugin-vue
2. update vue layer page
3. add `:h SpaceVim-layers-lang-vue`

close https://github.com/SpaceVim/SpaceVim/issues/4488
This commit is contained in:
Shidong Wang 2021-10-01 23:23:09 +08:00
parent 879378000f
commit e33aeb1b00
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
5 changed files with 82 additions and 32 deletions

View File

@ -7,6 +7,22 @@
"============================================================================= "=============================================================================
""
" @section lang#vue, layers-lang-vue
" @parentsection layers
" This layer is for vue development, disabled by default, to enable this
" layer, add following snippet to your SpaceVim configuration file.
" >
" [[layers]]
" name = 'lang#vue'
" <
"
" The |checkers| layer provides syntax linter for vue. you need to install the
" `eslint` and `eslint-plugin-vue`:
" >
" npm install -g eslint eslint-plugin-vue
" <
function! SpaceVim#layers#lang#vue#plugins() abort function! SpaceVim#layers#lang#vue#plugins() abort
let plugins = [] let plugins = []
call add(plugins, ['posva/vim-vue', {'merged' : 0}]) call add(plugins, ['posva/vim-vue', {'merged' : 0}])

View File

@ -6,7 +6,7 @@ endfunction
function! neomake#makers#ft#vue#eslint() abort function! neomake#makers#ft#vue#eslint() abort
let maker = neomake#makers#ft#javascript#eslint() let maker = neomake#makers#ft#javascript#eslint()
call extend(get(maker, 'args', []), ['--plugin', 'html']) call extend(get(maker, 'args', []), ['--plugin', 'vue'])
return maker return maker
endfunction endfunction
@ -16,13 +16,13 @@ endfunction
function! neomake#makers#ft#vue#standard() abort function! neomake#makers#ft#vue#standard() abort
let maker = neomake#makers#ft#javascript#standard() let maker = neomake#makers#ft#javascript#standard()
call extend(get(maker, 'args', []), ['--plugin', 'html']) call extend(get(maker, 'args', []), ['--plugin', 'vue'])
return maker return maker
endfunction endfunction
function! neomake#makers#ft#vue#semistandard() abort function! neomake#makers#ft#vue#semistandard() abort
let maker = neomake#makers#ft#javascript#semistandard() let maker = neomake#makers#ft#javascript#semistandard()
call extend(get(maker, 'args', []), ['--plugin', 'html']) call extend(get(maker, 'args', []), ['--plugin', 'vue'])
return maker return maker
endfunction endfunction

View File

@ -181,20 +181,21 @@ CONTENTS *SpaceVim-contents*
95. lang#typescript....................|SpaceVim-layers-lang-typescript| 95. lang#typescript....................|SpaceVim-layers-lang-typescript|
96. lang#v......................................|SpaceVim-layers-lang-v| 96. lang#v......................................|SpaceVim-layers-lang-v|
97. lang#vbnet..............................|SpaceVim-layers-lang-vbnet| 97. lang#vbnet..............................|SpaceVim-layers-lang-vbnet|
98. lang#wolfram..........................|SpaceVim-layers-lang-wolfram| 98. lang#vue..................................|SpaceVim-layers-lang-vue|
99. lang#xml..................................|SpaceVim-layers-lang-xml| 99. lang#wolfram..........................|SpaceVim-layers-lang-wolfram|
100. lang#xquery...........................|SpaceVim-layers-lang-xquery| 100. lang#xml.................................|SpaceVim-layers-lang-xml|
101. lang#zig.................................|SpaceVim-layers-lang-zig| 101. lang#xquery...........................|SpaceVim-layers-lang-xquery|
102. language server protocol......................|SpaceVim-layers-lsp| 102. lang#zig.................................|SpaceVim-layers-lang-zig|
103. leaderf...................................|SpaceVim-layers-leaderf| 103. language server protocol......................|SpaceVim-layers-lsp|
104. operator.................................|SpaceVim-layers-operator| 104. leaderf...................................|SpaceVim-layers-leaderf|
105. shell.......................................|SpaceVim-layers-shell| 105. operator.................................|SpaceVim-layers-operator|
106. test.........................................|SpaceVim-layers-test| 106. shell.......................................|SpaceVim-layers-shell|
107. tmux.........................................|SpaceVim-layers-tmux| 107. test.........................................|SpaceVim-layers-test|
108. tools#dash.............................|SpaceVim-layers-tools-dash| 108. tmux.........................................|SpaceVim-layers-tmux|
109. tools#zeal.............................|SpaceVim-layers-tools-zeal| 109. tools#dash.............................|SpaceVim-layers-tools-dash|
110. ui.............................................|SpaceVim-layers-ui| 110. tools#zeal.............................|SpaceVim-layers-tools-zeal|
111. unite.......................................|SpaceVim-layers-unite| 111. ui.............................................|SpaceVim-layers-ui|
112. unite.......................................|SpaceVim-layers-unite|
7. Usage....................................................|SpaceVim-usage| 7. Usage....................................................|SpaceVim-usage|
1. buffers-and-files..................|SpaceVim-usage-buffers-and-files| 1. buffers-and-files..................|SpaceVim-usage-buffers-and-files|
2. custom_plugins........................|SpaceVim-usage-custom_plugins| 2. custom_plugins........................|SpaceVim-usage-custom_plugins|
@ -4192,6 +4193,22 @@ KEY BINDINGS
< <
==============================================================================
LANG#VUE *SpaceVim-layers-lang-vue*
This layer is for vue development, disabled by default, to enable this layer,
add following snippet to your SpaceVim configuration file.
>
[[layers]]
name = 'lang#vue'
<
The |checkers| layer provides syntax linter for vue. you need to install the
`eslint` and `eslint-plugin-vue`:
>
npm install -g eslint eslint-plugin-vue
<
============================================================================== ==============================================================================
LANG#WOLFRAM *SpaceVim-layers-lang-wolfram* LANG#WOLFRAM *SpaceVim-layers-lang-wolfram*

View File

@ -9,8 +9,9 @@ lang: zh
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介) - [模块简介](#模块简介)
- [功能特性](#功能特性) - [依赖安装及启用模块](#依赖安装及启用模块)
- [启用模块](#启用模块) - [启用模块](#启用模块)
- [语言工具](#语言工具)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->
@ -18,12 +19,9 @@ lang: zh
这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。该模块包含了插件 [vim-vue](https://github.com/posva/vim-vue)。 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。该模块包含了插件 [vim-vue](https://github.com/posva/vim-vue)。
## 功能特性 ## 依赖安装及启用模块
- 语法高亮 ### 启用模块
- LSP 支持(需要 [lsp](../../language-server-protocol/) 模块)
## 启用模块
可通过在配置文件内加入如下配置来启用该模块: 可通过在配置文件内加入如下配置来启用该模块:
@ -31,3 +29,13 @@ lang: zh
[[layers]] [[layers]]
name = "lang#vue" name = "lang#vue"
``` ```
### 语言工具
- **语法检查:**
`checkers` 模块提供了代码检查功能, 此外需要安装 `eslint``eslint-plugin-vue` 包:
```sh
npm install -g eslint eslint-plugin-vue
```

View File

@ -8,8 +8,9 @@ description: "This layer adds Vue language support to SpaceVim"
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [Description](#description) - [Description](#description)
- [Features](#features) - [Installation](#installation)
- [Install](#install) - [Enable language layer](#enable-language-layer)
- [Language tools](#language-tools)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->
@ -17,16 +18,24 @@ description: "This layer adds Vue language support to SpaceVim"
This layer adds Vue language support to SpaceVim. This layer includes plugin [vim-vue](https://github.com/posva/vim-vue). This layer adds Vue language support to SpaceVim. This layer includes plugin [vim-vue](https://github.com/posva/vim-vue).
## Features ## Installation
- syntax highlighting ### Enable language layer
- lsp support (requires [lsp](https://spacevim.org/layers/language-server-protocol/) layer)
## Install The `lang#vue` layer is not loaded by default, to use this layer,
you need to add following snippet into your spacevim configuration file.
To use this configuration layer, update your custom configuration file with:
```toml ```toml
[[layers]] [[layers]]
name = "lang#vue" name = "lang#vue"
``` ```
### Language tools
- **syntax checking:**
`checker` layer provides syntax checking feature, and for vue it uses the `eslint` and `eslint-plugin-vue` package:
```sh
npm install -g eslint eslint-plugin-vue
```