TabNine is a fantastic code completion plugin for VS Code, Sublime, Atom, Vim, and other code editors. It uses the GPT-2 technology for analyzing the code and generate suggestions on the fly. You just have to install it and then it starts working out of the box. It works great on Python and React code, however, in the free plan there are some limitations Unlike Kite, you don’t have to be run on a local server on your machine and thus you can save a lot of memory. It works like record completion presence of its kind but here it is here to generate those and it’s pretty simple actually. However, the free plan only allows you to suggest code completion of projects or scripts having 400 KB of size.
GPT-2 is a machine learning transformer based language model with over 1.5 billion parameters. It’s quite powerful for generating coherent text from minimal prompts. One of the applications of text generation is in code completion and that is why the developers of TabNine have created the plugin. With this language modelling tool, it can perfectly generate correct and precise suggestions for different type of programming language as you type the code in any text editor that is supports. For now, it supports all the popular code editors out there. It supports VS Code, Emacs, Jupyter Notebook, Sublime Text, Vim, IntelliJ IDEA, PyCharm, and others. You just install the plugin by downloading it from the official website. In the free version, you don’t have to register.
GPT Based Code Completion Plugin for VS Code, Sublime, Atom, Vim: Tabnine
For the sake of this post I will be using TabNine in Visual Code Studio. And you can download the TabNine plugin from the Marketplace. Just search for it there and then install it in a single click. And after you install it then you may have to restart IDE in order to make it work.
Now, just jump in and start writing some code and see it generate suggestions for you. It understands what kind of code you are writing and then generate the corresponding suggestions inspired you. For example, in the following screenshot, you can see suggestions that it generates for React code. It can very well identify that React being worked upon and it loads the suggestions automatically. And it also understands what you have already written.
Another thing that you can do is see it in action while writing Python code. Just write some Python code and then you will see that it generates the code completion suggestions automatically. Try it while writing functions and format strings.
That is it. In this way, you can use this simple and powerful plugin to generate code completions using GPT-2. It works amazingly and I think this is a future of code completion. I really like the suggestions and the way it generated auto completes in my case. And I hope it improves further for other programming languages in the coming updates. However, the only downside of the plugin is that the free plan is kind of Limited. Since 400 KB project size is allowed, it will be great for constructing simple scripts and small personal projects.
Closing thoughts:
After Kite and IntelliSense I think this is one of the best code completion plugin that I have ever used. The fact that it uses GPT to model makes it very different and unique and in its own kinds. I liked the way it suggests name for function, written types, and arguments.are very precise. It reads the format strings of Python perfectly and generate the format variables for the function automatically. And there are many other features that you will like. So, just give it a try and let me know what you think.