From 17f37b6f4b4df9a1d454417cbaa358cbd6009388 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 16 Dec 2020 23:09:40 +0800 Subject: [PATCH] Improve typescript support (#3948) --- autoload/SpaceVim/layers/lang/typescript.vim | 1 + .../2020-04-12-use-vim-as-a-typescript-ide.md | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/typescript.vim b/autoload/SpaceVim/layers/lang/typescript.vim index fab32b09c..964024726 100644 --- a/autoload/SpaceVim/layers/lang/typescript.vim +++ b/autoload/SpaceVim/layers/lang/typescript.vim @@ -56,6 +56,7 @@ function! SpaceVim#layers#lang#typescript#config() abort \ 'usestdin' : 1, \ 'opt': [], \ }) + let g:neomake_typescript_enabled_makers = ['eslint'] endfunction function! SpaceVim#layers#lang#typescript#set_variable(var) abort diff --git a/docs/_posts/2020-04-12-use-vim-as-a-typescript-ide.md b/docs/_posts/2020-04-12-use-vim-as-a-typescript-ide.md index 46f3090e5..a3aa155f9 100644 --- a/docs/_posts/2020-04-12-use-vim-as-a-typescript-ide.md +++ b/docs/_posts/2020-04-12-use-vim-as-a-typescript-ide.md @@ -17,7 +17,7 @@ Each of the following sections will be covered: - [Enable language layer](#enable-language-layer) - [Code completion](#code-completion) -- [Syntax linting](#syntax-linting) +- [Code linting](#code-linting) - [Jump to test file](#jump-to-test-file) - [running code](#running-code) - [Code formatting](#code-formatting) @@ -25,9 +25,15 @@ Each of the following sections will be covered: + +This tutorial is not intended to teach you TypeScript itself. + +If you have any problems, feel free to join the [SpaceVim gitter chatting room](https://gitter.im/SpaceVim/SpaceVim) for general discussion. + ### Enable language layer -By default `lang#typescript` layer is not loaded. To add TypeScript language support in SpaceVim, +TypeScript language support in SpaceVim is provided by `lang#typescript` layer. +This layer is not loaded by default. To add TypeScript language support in SpaceVim, you need to enable the `lang#typescript` layer. Press `SPC f v d` to open SpaceVim configuration file, and add following configuration: @@ -45,15 +51,16 @@ The completion menu will be opened as you type. ![ts](https://user-images.githubusercontent.com/13142418/79134364-2bd8db80-7de0-11ea-848e-71d3f07cb79d.png) -### Syntax linting +### Code linting -The checkers layer is enabled by default. This layer provides asynchronous syntax linting via [neomake](https://github.com/neomake/neomake). -It will run [tslint](https://www.npmjs.com/package/tslint) asynchronously. +Code linting is provided by `checkers` layer which is loaded by default. +The default lint engine is [neomake](https://github.com/neomake/neomake). +It will run [eslint](https://eslint.org/) asynchronously. To install eslint, just run following command in terminal. -```sh -npm install -g tslint +``` +npm install eslint --save-dev ``` ### Jump to test file