From 46d79132d105c1d48385bde509ed0a5969e1a66e Mon Sep 17 00:00:00 2001 From: chemzqm Date: Sun, 21 Oct 2018 13:21:25 +0800 Subject: [PATCH] doc --- Readme.md | 67 +++++++++++++++++++++++++++++----------------------- src/index.ts | 3 ++- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Readme.md b/Readme.md index a078496..0407517 100644 --- a/Readme.md +++ b/Readme.md @@ -16,45 +16,54 @@ In your vim/neovim, run command: Almost same as VSCode. -* Support javascript & typescript and jsx/tsx. -* Install typings automatically. -* Commands to work with tsserver, including: - * `tsserver.reloadProjects` - * `tsserver.openTsServerLog` - * `tsserver.goToProjectConfig` - * `tsserver.restart` - * `tsserver.format` - * `tsserver.organizeImports` - * `tsserver.watchBuild` -* Code completion support. -* Go to definition. -* Code validation. -* Document highlight. -* Document symbols of current buffer. -* Folding and folding range of current buffer. -* Format current buffer, range format and format on type. -* Hover for documentation. -* Implementations codeLens and references codeLens. -* Organize imports command. -* Quickfix using code actions. -* Code refactor using code actions. -* Find references. -* Signature help. -* Rename symbols support. -* Rename imports on file rename. -* Search for workspace symbols. +- Support javascript & typescript and jsx/tsx. +- Install typings automatically. +- Commands to work with tsserver, including: + - `tsserver.reloadProjects` + - `tsserver.openTsServerLog` + - `tsserver.goToProjectConfig` + - `tsserver.restart` + - `tsserver.format` + - `tsserver.organizeImports` + - `tsserver.watchBuild` +- Code completion support. +- Go to definition. +- Code validation. +- Document highlight. +- Document symbols of current buffer. +- Folding and folding range of current buffer. +- Format current buffer, range format and format on type. +- Hover for documentation. +- Implementations codeLens and references codeLens. +- Organize imports command. +- Quickfix using code actions. +- Code refactor using code actions. +- Find references. +- Signature help. +- Rename symbols support. +- Rename imports on file rename. +- Search for workspace symbols. Tsserver module is resolved from local workspace, if not found, bundled tsserver module would be used. ## Configuration options -* `tsserver.enable` set to `false` to disable tsserver language server. -* `tsserver.trace.server` trace LSP traffic in output channel. +- `tsserver.enable` set to `false` to disable tsserver language server. +- `tsserver.trace.server` trace LSP traffic in output channel. And many more, which are same as VSCode, trigger completion in your `coc-settings.json` to get full list. +## Trouble shooting + +To get the log of tsserver: + +- Add `"tsserver.log": "verbose"` to your `coc-settings.json` (opened by command + `:CocConfig`) +- Make the issue happens. +- Open the log file by command `:call CocAction('runCommand', 'tsserver.openTsServerLog')` + ## License MIT diff --git a/src/index.ts b/src/index.ts index 9a984b4..0bb2bee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import { Command, OpenTsServerLogCommand, ReloadProjectsCommand, TypeScriptGoToP export async function activate(context: ExtensionContext): Promise { let { subscriptions } = context - const config = workspace.getConfiguration().get('tsserver', {}) as any + const config = workspace.getConfiguration().get('tsserver', {}) if (!config.enable) return const service = new TsserverService() @@ -27,6 +27,7 @@ export async function activate(context: ExtensionContext): Promise { registCommand(commands.register({ id: 'tsserver.restart', execute: (): void => { + // tslint:disable-next-line:no-floating-promises service.stop().then(() => { setTimeout(() => { service.restart()