1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:30:04 +08:00

Improve typescript support (#3948)

This commit is contained in:
Wang Shidong 2020-12-16 23:09:40 +08:00 committed by GitHub
parent 7400e6008d
commit 17f37b6f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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:
<!-- vim-markdown-toc -->
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