mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:30:05 +08:00
parent
ee07874b8b
commit
f286e5a83c
@ -63,6 +63,9 @@ function! SpaceVim#layers#lang#typescript#config() abort
|
||||
\ 'opt': [],
|
||||
\ })
|
||||
let g:neomake_typescript_enabled_makers = ['eslint']
|
||||
if index(g:spacevim_project_rooter_patterns, 'tsconfig.json') == -1
|
||||
call add(g:spacevim_project_rooter_patterns, 'tsconfig.json')
|
||||
endif
|
||||
" does eslint support tsx?
|
||||
let g:neoformat_typescriptreact_prettier = {
|
||||
\ 'exe': 'prettier',
|
||||
|
@ -6,7 +6,7 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
if $SPACEVIM_LUA
|
||||
if $SPACEVIM_LUA && has('nvim')
|
||||
function! SpaceVim#logger#info(msg) abort
|
||||
lua require("spacevim.logger").info(
|
||||
\ require("spacevim").eval("a:msg")
|
||||
|
@ -11,7 +11,7 @@ set cpo&vim
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
if $SPACEVIM_LUA
|
||||
if $SPACEVIM_LUA && has('nvim')
|
||||
function! SpaceVim#plugins#a#alt(request_parse, ...) abort
|
||||
lua require("spacevim.plugin.a").alt(
|
||||
\ require("spacevim").eval("a:request_parse"),
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
|
||||
if $SPACEVIM_LUA
|
||||
if $SPACEVIM_LUA && has('nvim')
|
||||
function! SpaceVim#plugins#projectmanager#complete_project(ArgLead, CmdLine, CursorPos) abort
|
||||
return luaeval('require("spacevim.plugin.projectmanager").complete('
|
||||
\ .'require("spacevim").eval("a:ArgLead"),'
|
||||
|
@ -41,7 +41,6 @@ function! neomake#makers#ft#javascript#eslint() abort
|
||||
\ 'args': ['--format=compact'],
|
||||
\ 'errorformat': '%E%f: line %l\, col %c\, Error - %m,' .
|
||||
\ '%W%f: line %l\, col %c\, Warning - %m,%-G,%-G%*\d problems%#',
|
||||
\ 'cwd': '%:p:h',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ }
|
||||
|
||||
|
@ -52,23 +52,23 @@ SpaceVim 初次安装时默认并未启用 TypeScript 相关语言模块。首
|
||||
### 语法检查
|
||||
|
||||
`checkers` 模块为 SpaceVim 提供了语法检查的功能,该模块默认已经载入。该模块默认使用 [neomake](https://github.com/neomake/neomake)
|
||||
这一异步语法检查工具。对于 TypeScript 的支持是通过异步调用 [tslint](https://www.npmjs.com/package/tslint) 命令来完成的。
|
||||
这一异步语法检查工具。对于 TypeScript 的支持是通过异步调用 [eslint](https://eslint.org/) 命令来完成的。
|
||||
|
||||
可通过以下命令安装:
|
||||
|
||||
```sh
|
||||
npm install -g tslint
|
||||
```
|
||||
npm install -g eslint
|
||||
```
|
||||
|
||||
### 工程文件跳转
|
||||
|
||||
SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转alternate文件。
|
||||
SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转 alternate 文件。
|
||||
可以在工程根目录添加 `.project_alt.json` 文件,并加入以下内容:
|
||||
|
||||
```json
|
||||
{
|
||||
"src/*.ts": {"alternate": "test/{}.ts"},
|
||||
"test/*.ts": {"alternate": "src/{}.ts"}
|
||||
"src/*.ts": { "alternate": "test/{}.ts" },
|
||||
"test/*.ts": { "alternate": "src/{}.ts" }
|
||||
}
|
||||
```
|
||||
|
||||
@ -101,5 +101,4 @@ npm install -g typescript-formatter
|
||||
|
||||
在编辑 TypeScript 文件时,可通过快捷键 `SPC l s i` 启动 `ts-node -i` 交互窗口,之后使用快捷键将代码发送至解释器。默认快捷键都以 `SPC l s` 为前缀。
|
||||
|
||||
目前 TypeScript 交互式编程还未完全实现,主要是因为 `ts-node -i` 执行是并不刷新buffer,可查看[ts-node #1013](https://github.com/TypeStrong/ts-node/issues/1013)。
|
||||
|
||||
目前 TypeScript 交互式编程还未完全实现,主要是因为 `ts-node -i` 执行是并不刷新 buffer,可查看[ts-node #1013](https://github.com/TypeStrong/ts-node/issues/1013)。
|
||||
|
@ -60,7 +60,7 @@ It will run [eslint](https://eslint.org/) asynchronously.
|
||||
To install eslint, just run following command in terminal.
|
||||
|
||||
```
|
||||
npm install eslint --save-dev
|
||||
npm install -g eslint
|
||||
```
|
||||
|
||||
### Jump to test file
|
||||
|
@ -31,10 +31,16 @@ lang: zh
|
||||
|
||||
同时,需要通过以下命令安装 TypeScript:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm install -g typescript
|
||||
```
|
||||
|
||||
语法检查需要安装`eslint`命令:
|
||||
|
||||
```
|
||||
npm install -g eslint
|
||||
```
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 代码补全
|
||||
|
@ -28,10 +28,13 @@ To use this configuration layer, update your custom configuration file with:
|
||||
[[layers]]
|
||||
name = "lang#typescript"
|
||||
```
|
||||
and also use npm to install neovim using:
|
||||
|
||||
If you are using neovim instead of vim, please use `npm` to install `neovim` lib:
|
||||
|
||||
```bash
|
||||
npm install -g neovim
|
||||
```
|
||||
|
||||
then in SpaceVim run `:UpdateRemotePlugin`
|
||||
|
||||
To generate doc of typescript file, you need to install [lehre](https://www.npmjs.com/package/lehre)
|
||||
@ -40,6 +43,11 @@ To generate doc of typescript file, you need to install [lehre](https://www.npmj
|
||||
yarn add -D lehre
|
||||
```
|
||||
|
||||
Install `eslint` for syntax checking:
|
||||
|
||||
```
|
||||
npm install -g eslint
|
||||
```
|
||||
|
||||
## Layer options
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user