From 41a4fbbf5f4ca485bbf90453d0203782ce17a76c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 11 Sep 2017 22:08:33 +0800 Subject: [PATCH] Fix vim support --- autoload/SpaceVim/layers/lang/typescript.vim | 14 +++++++ docs/layers/lang/typescript.md | 39 ++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 docs/layers/lang/typescript.md diff --git a/autoload/SpaceVim/layers/lang/typescript.vim b/autoload/SpaceVim/layers/lang/typescript.vim index 4a690e2d2..c1da4c282 100644 --- a/autoload/SpaceVim/layers/lang/typescript.vim +++ b/autoload/SpaceVim/layers/lang/typescript.vim @@ -24,3 +24,17 @@ function! SpaceVim#layers#lang#typescript#config() abort autocmd FileType typescript setlocal omnifunc=tsuquyomi#complete endif endfunction + +function! SpaceVim#layers#typescript#set_variable(var) abort + if has('nvim') + let g:nvim_typescript#server_path = + \ get(a:var, 'typescript_server_path', + \ './node_modules/.bin/tsserver') + else + let tsserver_path = get(a:var, 'typescript_server_path', '') + if !empty(tsserver_path) + let g:tsuquyomi_use_dev_node_module = 2 + let g:tsuquyomi_tsserver_path = tsserver_path + endif + endif +endfunction diff --git a/docs/layers/lang/typescript.md b/docs/layers/lang/typescript.md new file mode 100644 index 000000000..c5b11958e --- /dev/null +++ b/docs/layers/lang/typescript.md @@ -0,0 +1,39 @@ +--- +title: "SpaceVim lang#typescript layer" +--- + +# [SpaceVim Layers:](https://spacevim.org/layers) lang#typescript + + + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Features](#features) +- [Layer configuration](#layer-configuration) + + + +## Description + +This layer is for TypeScript development. + +## Layer Installation + +To use this configuration layer, add `call SpaceVim#layers#load('lang#typescript')` to your custom configuration file. BTW, you need to install TypeScript via: + +```sh +npm install -g typescript +``` + +## Features + +- auto-completion +- syntax checking +- viewing documentation +- type-signature +- goto definition +- refernce finder + +## Layer configuration + +`typescript_server_path`: set the path of the tsserver.