Mastodon hachyterm.io

Nvim-TypeScript adds TypeScript support for NeoVim.

Why Nvim-TypeScript instead of Tsuquomi?

The author answers the question on github:

  1. tsuquyomi requires vimproc currently, which can be slow for larger projects. Sine this plugin uses neovims remote plugin, I can write the tsserver in a python process instead, which is much faster.
  2. Almost no viml. Since this is an remote plugin, almost all of the entire setup can be done using python instead.
  3. TS-specific. While YouCompleteMe does have more language support, it is a large plugin that also requires C compilation. Not ideal. This only needs python, the neovim python client, and typescript installed. No compilation needed.

Plus, all of this, is async, so it will not block your editor. AT ALL.
I’ve used both plugins before, and in fact tsuquyomi is a big inspiration for this project. Better is subjective term, as each one something different. My goal for this was to make a typescript plugin for neovim since it is my main editor.

Node: Install NeoVim and TypeScript

yarn global add neovim

After that, open Neovim and run :UpdateRemotePlugins.

yarn global add typescript

Plugins

I use minpac as my package manager.

Install these packages. If you use another package manager, adjust the commands accordingly.

call minpac#add('HerringtonDarkholme/yats.vim')
call minpac#add('mhartington/nvim-typescript', {'do': './install.sh'})

We need a TypeScript language syntax file. Nvim-Typescript’s author recommends YATS but there are others available, if you are not happy with YATS.

Errors

A common error with this plugin is E117: Unknown function: TSOnBufEnter as soon as you open a TypeScript file.

First, open NeoVim and run the command :checkhealth nvim_typescript.

Then, go to the folder where nvim-typescript is installed. This depends on your NeoVim package manager. Find the folder and run ./install.sh manually.
Then restart NeoVim, and run :UpdateRemotePlugins again.

Reference: E117: Unknown function: TSOnBufEnter

Further Reading