From e33aeb1b0099bf5d27b821688a6c4210442b57d0 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Fri, 1 Oct 2021 23:23:09 +0800 Subject: [PATCH] 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 --- autoload/SpaceVim/layers/lang/vue.vim | 16 +++++++ .../autoload/neomake/makers/ft/vue.vim | 6 +-- doc/SpaceVim.txt | 45 +++++++++++++------ docs/cn/layers/lang/vue.md | 22 ++++++--- docs/layers/lang/vue.md | 25 +++++++---- 5 files changed, 82 insertions(+), 32 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/vue.vim b/autoload/SpaceVim/layers/lang/vue.vim index 15dbc6419..43e119166 100644 --- a/autoload/SpaceVim/layers/lang/vue.vim +++ b/autoload/SpaceVim/layers/lang/vue.vim @@ -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 let plugins = [] call add(plugins, ['posva/vim-vue', {'merged' : 0}]) diff --git a/bundle/neomake/autoload/neomake/makers/ft/vue.vim b/bundle/neomake/autoload/neomake/makers/ft/vue.vim index d9f530312..0378bc780 100644 --- a/bundle/neomake/autoload/neomake/makers/ft/vue.vim +++ b/bundle/neomake/autoload/neomake/makers/ft/vue.vim @@ -6,7 +6,7 @@ endfunction function! neomake#makers#ft#vue#eslint() abort let maker = neomake#makers#ft#javascript#eslint() - call extend(get(maker, 'args', []), ['--plugin', 'html']) + call extend(get(maker, 'args', []), ['--plugin', 'vue']) return maker endfunction @@ -16,13 +16,13 @@ endfunction function! neomake#makers#ft#vue#standard() abort let maker = neomake#makers#ft#javascript#standard() - call extend(get(maker, 'args', []), ['--plugin', 'html']) + call extend(get(maker, 'args', []), ['--plugin', 'vue']) return maker endfunction function! neomake#makers#ft#vue#semistandard() abort let maker = neomake#makers#ft#javascript#semistandard() - call extend(get(maker, 'args', []), ['--plugin', 'html']) + call extend(get(maker, 'args', []), ['--plugin', 'vue']) return maker endfunction diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 5ba75b782..7c0178e49 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -181,20 +181,21 @@ CONTENTS *SpaceVim-contents* 95. lang#typescript....................|SpaceVim-layers-lang-typescript| 96. lang#v......................................|SpaceVim-layers-lang-v| 97. lang#vbnet..............................|SpaceVim-layers-lang-vbnet| - 98. lang#wolfram..........................|SpaceVim-layers-lang-wolfram| - 99. lang#xml..................................|SpaceVim-layers-lang-xml| - 100. lang#xquery...........................|SpaceVim-layers-lang-xquery| - 101. lang#zig.................................|SpaceVim-layers-lang-zig| - 102. language server protocol......................|SpaceVim-layers-lsp| - 103. leaderf...................................|SpaceVim-layers-leaderf| - 104. operator.................................|SpaceVim-layers-operator| - 105. shell.......................................|SpaceVim-layers-shell| - 106. test.........................................|SpaceVim-layers-test| - 107. tmux.........................................|SpaceVim-layers-tmux| - 108. tools#dash.............................|SpaceVim-layers-tools-dash| - 109. tools#zeal.............................|SpaceVim-layers-tools-zeal| - 110. ui.............................................|SpaceVim-layers-ui| - 111. unite.......................................|SpaceVim-layers-unite| + 98. lang#vue..................................|SpaceVim-layers-lang-vue| + 99. lang#wolfram..........................|SpaceVim-layers-lang-wolfram| + 100. lang#xml.................................|SpaceVim-layers-lang-xml| + 101. lang#xquery...........................|SpaceVim-layers-lang-xquery| + 102. lang#zig.................................|SpaceVim-layers-lang-zig| + 103. language server protocol......................|SpaceVim-layers-lsp| + 104. leaderf...................................|SpaceVim-layers-leaderf| + 105. operator.................................|SpaceVim-layers-operator| + 106. shell.......................................|SpaceVim-layers-shell| + 107. test.........................................|SpaceVim-layers-test| + 108. tmux.........................................|SpaceVim-layers-tmux| + 109. tools#dash.............................|SpaceVim-layers-tools-dash| + 110. tools#zeal.............................|SpaceVim-layers-tools-zeal| + 111. ui.............................................|SpaceVim-layers-ui| + 112. unite.......................................|SpaceVim-layers-unite| 7. Usage....................................................|SpaceVim-usage| 1. buffers-and-files..................|SpaceVim-usage-buffers-and-files| 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* diff --git a/docs/cn/layers/lang/vue.md b/docs/cn/layers/lang/vue.md index 32bf9a9e9..ba1f2b6de 100644 --- a/docs/cn/layers/lang/vue.md +++ b/docs/cn/layers/lang/vue.md @@ -9,8 +9,9 @@ lang: zh - [模块简介](#模块简介) -- [功能特性](#功能特性) -- [启用模块](#启用模块) +- [依赖安装及启用模块](#依赖安装及启用模块) + - [启用模块](#启用模块) + - [语言工具](#语言工具) @@ -18,12 +19,9 @@ lang: zh 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。该模块包含了插件 [vim-vue](https://github.com/posva/vim-vue)。 -## 功能特性 +## 依赖安装及启用模块 -- 语法高亮 -- LSP 支持(需要 [lsp](../../language-server-protocol/) 模块) - -## 启用模块 +### 启用模块 可通过在配置文件内加入如下配置来启用该模块: @@ -31,3 +29,13 @@ lang: zh [[layers]] name = "lang#vue" ``` + +### 语言工具 + +- **语法检查:** + + `checkers` 模块提供了代码检查功能, 此外需要安装 `eslint` 和 `eslint-plugin-vue` 包: + + ```sh + npm install -g eslint eslint-plugin-vue + ``` diff --git a/docs/layers/lang/vue.md b/docs/layers/lang/vue.md index 50499a210..7f6a99222 100644 --- a/docs/layers/lang/vue.md +++ b/docs/layers/lang/vue.md @@ -8,8 +8,9 @@ description: "This layer adds Vue language support to SpaceVim" - [Description](#description) -- [Features](#features) -- [Install](#install) +- [Installation](#installation) + - [Enable language layer](#enable-language-layer) + - [Language tools](#language-tools) @@ -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). -## Features +## Installation -- syntax highlighting -- lsp support (requires [lsp](https://spacevim.org/layers/language-server-protocol/) layer) +### Enable language layer -## Install - -To use this configuration layer, update your custom configuration file with: +The `lang#vue` layer is not loaded by default, to use this layer, +you need to add following snippet into your spacevim configuration file. ```toml [[layers]] 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 + ```