Home

Awesome

coc-tsserver

Tsserver language server extension for coc.nvim.

Tsserver is part of TypeScript which provide rich language features for javascript and typescript.

This extension is a fork of typescript-language-features extension which is bundled with VSCode. File type detect and syntax highlight are not supported by this extension, use other vim plugin instead.

Important note: from v2.0.0, tsserver module resolved first from global configuration tsserver.tsdk and use bundled module when not found, if tsserver.useLocalTsdk is enabled, workspace folder configured tsserver.tsdk or typescript module inside current workspace folder would be used when exists.

Install

In your vim/neovim, run command:

:CocInstall coc-tsserver

For yarn2 ( >= v2.0.0-rc.36) user want to use local typescript module:

Features

Almost the same as VSCode.

Tsserver module first resolved from your local workspace. If it's not found, use tsserver from tsserver.tsdk configuration or use bundled tsserver with this extension.

Commands

Commands contributed to :CocList commands

Configuration options

Checkout :h coc-configuration for guide of coc.nvim's configuration.

Most Configurations are the same as with VSCode. Install coc-json and try completion with tsserver, typescript or javascript in your coc-settings.json.

Differences between VSCode

Added configurations by coc-tsserver:

Removed configurations:

Renamed configurations to use tsserver as prefix:

Related extensions

Troubleshooting

If you find any issues, please create an issue.

Q & A

Q: Automatic type acquisition not work.

A: configure tsserver.npm to your global npm path or configure "tsserver.disableAutomaticTypeAcquisition": false to disable automatic typings installation.

Q: The extension needs some time to work.

A: The initialize of tsserver requires some time, you can add g:coc_status to your status line, see :h coc-status. If your tsserver get slow, try exclude unnecessary files in your jsconfig.json/tsconfig.json, make sure typescript version > 4.9 and disable logging (disabled by default).

Q: Update import on file rename not work.

A: Make sure install watchman in your $PATH. Use command :CocCommand workspace.showOutput watchman to check watchman output.

Q: Not work with buffer just created.

A: Tsserver treat buffer without a disk file belongs to implicit project, VSCode could work because VSCode create empty file first for buffer, save the buffer to disk to make tsserver work.

Q: Not work with my javascript project.

A: Configure jsconfig.json to make tsserver understand your code. Some features may still not work well, it's recommended to use typescript.

Q: Not work on WSL.

A: Copy you project files from mounted dirs to linux home otherwise tsserver may not work properly.

Sponsoring

If you like coc-tsserver, consider supporting me on Patreon or PayPal:

<a href="https://www.patreon.com/chemzqm"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /> </a> <a href="https://www.paypal.com/paypalme/chezqm"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /> </a>

License

MIT