AI code completion in Positron
Positron doesn't have GitHub Copilot, but Codeium and others are good alternatives.
TL;DR: Codeium offers a free Copilot-like experience in Positron. You can install it from the Open VSX registry directly within the extensions pane in Positron. It provides code completion suggestions, explanations, assists with refactoring, documentation, tests, etc.
I wrote a post back in July about R package development in Positron:
At the end of the post I called out a few missing features that would prevent me from using Positron full time in place of RStudio+VSCode. One of those was remote development (still super important). The other was GitHub Copilot.
GitHub Copilot has been available in RStudio since 2023, but it’s unclear if or when Copilot will ever be available in Positron, because Microsoft's Copilot extension is currently only licensed for use in VSCode. However, this discussion on the Positron repo pointed to a few alternatives available in the Open VSX Registry.
I was doing a little work on a hobby project over the weekend that involved writing Python, R, Bash scripts, and a Dockerfile, and I took the opportunity to explore a few of these options. I initially looked at Continue, then Tabnine, and ultimately settled on Codeium.1
Here’s a <1 minute screencast of me using Codeium within Positron to (1) autocomplete Python code based on a comment, (2) explain the code in a sidebar panel, (3) write a docstring for my new function, (4) write inline comments for what each line of code is doing, and (5) write some code to demonstrate this function.
This was all fairly easy to set up. Codeium is free (and always will be, so they say), and they don’t train generative models on private data.
First, in the extension pane, search for Codeium:
Once you install the extension, you’ll be guided through a sign in process (I signed in with my Google account), then you’ll get a token that you’ll enter into the command palette when directed.
Next, start typing and wait for some autocomplete suggestions. Hit tab to accept.
You can use CMD-I to launch a Codeium command, or you can click the suggestions such as code explanations, or write documentation. It’ll preview what it would generate, then you can choose to accept or not.
Lots more documentation is available at Codeium’s website including:
Autocomplete: https://codeium.com/autocomplete
Chat: https://codeium.com/chat
Context Aware Everything: https://codeium.com/context
Command: https://codeium.com/command
Codium’s free plan alows unlimited AI autocomplete, in-editor chats, and command instructions. The $10/month plan includes unlimited access to GPT-4o and Claude 3.5 Sonnet. I’d love to spend more time with Claude Sonnet via Codeium to see how the results compare to Copilot for R and Python code. Another post for another day.
The Codeium pick here wasn’t based on the quality of the completions (it would take using each of these tools for a good amount of time to better understand this). I installed all three and Codeium just worked out of the box without any fuss. Also, it’s free, unless you want to use the GPT-4o or Claude 3.5 Sonnet API.