4.4 KiB
4.4 KiB
coc-tsserver
Tsserver language server extension for coc.nvim.
Most code from typescript-language-features
extension which bundled with VSCode.
Install
In your vim/neovim, run command:
:CocInstall coc-tsserver
Features
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.
Tsserver module is resolved from local workspace, if not found, bundled tsserver module would be used.
Configuration options
tsserver.enable
set tofalse
to disable tsserver language server.tsserver.trace.server
trace LSP traffic in output channel.tsserver.orgnizeImportOnSave
orgnize import on file save, defaultfalse
.tsserver.formatOnType
run format on special character inserted.tsserver.implicitProjectConfig.experimentalDecorators
enable experimentalDecorators for implicit project.typescript.updateImportsOnFileMove.enable
enable update imports on file move, requires watchman installed, defaulttrue
.typescript.implementationsCodeLens.enable
enable codeLens for implementations, defaulttrue
typescript.referencesCodeLens.enable
enable codeLens for references, defaulttrue
typescript.preferences.noSemicolons
remove semicolons on format for typescript.typescript.preferences.quoteStyle
quote style of typescript, could besingle
ordouble
, default"double"
typescript.suggestionActions.enabled
enable suggestion actions for typescript, defaulttrue
typescript.validate.enable
enable typescript validation, defaulttrue
typescript.suggest.enabled
enable typescript completion, defaulttrue
typescript.suggest.paths
enable suggest paths in import statement and require calls, defaulttrue
typescript.suggest.autoImports
enable suggest for auto import, defaulttrue
typescript.suggest.completeFunctionCalls
enable using snippet for method suggestion.javascript.updateImportsOnFileMove.enable
enable update imports on file move, requires watchman installed, defaulttrue
.javascript.implementationsCodeLens.enable
enable codeLens for implementations, defaulttrue
javascript.referencesCodeLens.enable
enable codeLens for references, defaulttrue
javascript.preferences.noSemicolons
remove semicolons on format for javascript.javascript.preferences.quoteStyle
quote style of javascript, could besingle
ordouble
, default"double"
javascript.suggestionActions.enabled
enable suggestion actions for javascript, defaulttrue
javascript.validate.enable
enable javascript validation, defaulttrue
javascript.suggest.enabled
enable javascript completion, defaulttrue
javascript.suggest.paths
enable suggest paths in import statement and require calls, defaulttrue
javascript.suggest.autoImports
enable suggest for auto import, defaulttrue
javascript.suggest.completeFunctionCalls
enable using snippet for method suggestion.
And more, which are same as VSCode, trigger completion with tsserver
, typescript
or javascript
in your coc-settings.json
to get full list.
Trouble shooting
- Add
"tsserver.log": "verbose"
to yourcoc-settings.json
(opened by command:CocConfig
) - To trace LSP communication, add
"tsserver.trace.server": "verbose"
to yourcoc-settings.json
- Restart coc server by command
:CocRestart
- Make the issue happen.
- Open tsserver log file by command
CocCommand tsserver.openTsServerLog
- Open tsserver output channel by command
CocCommand workspace.showOutput tsserver
License
MIT