A few months ago, a colleague recommended an autocomplete tool to me called TabNine. It was closed source, he said, but he wasn’t at all shy about using it despite being a proponent of open-source technology. I was impressed with Parcel, another recommendation of his, so I decided to finally take TabNine for a spin.
TabNine is an autocompleter for any programming language. It is built in Rust and driven by machine learning and language-specific semantic completion tools. You can use it with Visual Studio Code, Sublime Text, Atom, Emacs, and Vim.
Under the hood, TabNine uses several layers of completion engines and an index of the source code of your project. By using the code in your repository to help suggest completions, TabNine will take your coding style and common patterns into account. Additionally, TabNine identifies parameterizable patterns and makes suggestions based on those parameters. That’s a mouthful, so I’ll show some examples of what that really means below.
For a bit of background, I’ve been using Vim as my editor of choice for the last seven years and have it tuned to my liking. For autocompletion I’ve been using YouCompleteMe, which is an excellent tool despite being quite tricky to install. So this week I commented out a line in my .vimrc file and added the TabNine plug-in.
The TabNine plug-in is forked from YouCompleteMe, but the installation instructions include a sentence that was music to my ears: “If TabNine does not work as soon as you install it, this is a bug and you should file an issue.” Clearly, not only could I expect to plug-and-play, but the maintainer of this project is serious about user experience. The promise of an easy install was met and in less than a minute I was working with my new autocompleter.
The first thing I did was open the snippets dapp repository I have been working on for the last few weeks and started to import a new component. I was immediately presented with an option to improve the autocompletion engine: