Marie-Hélène Burle
January 23, 2024
OpenAI Codex—based on GPT-3—is the model behind GitHub Copilot
All the big corporate companies are rushing to launch a growing number of similar (and not free, not open source) productivity products (e.g. tabnine, Microsoft Visual Studio IntelliCode, Amazon CodeWhisperer)
These products generate code in a narrow context (auto-completion or transformation of natural language to code or vise-versa)
Google DeepMind AlphaCode 2—based on Gemini—stands out as a totally different (and for now totally unavailable) product generating code at the level of competitive programming (reaching the 85th percentile)
Think of it as code evolution by “natural” selection:
AlphaCode 2 is able to solve much more open-ended problems
These models are large and most convenient to run on servers
→ Price of cloud service
Some self-hosted options exist. A very promising one is Tabby. Not practical for everyone
While these models feed from open source code, they are themselves not open source 🙁
The open source community is trying to provide open source alternatives (e.g. Tabby). Despite the much more limited resources, the performance of some of these alternatives is very good
(not free, not open source…)
→ Cloud-hosted AI programming assistant
Individual or organization GitHub accounts
Requires subscription
Students, teachers, and maintainers of popular open source projects can apply for free access
Filters are in place for offensive words, but…
Generated code comes with no guaranty of safety or quality
A lawsuit is open against GitHub Copilot for licenses violation
Any language used in public repos
Quality of suggestions is higher for languages with lots of data
Start typing code and get autocomplete suggestions
Write comments describing what the code should do and get code generation based on context
It is easy to:
→ accept suggestions word by word
→ line by line
→ for entire functions
→ cycle through different suggestions
Extensions to text editors:
→ Visual Studio Code/Visual Studio
→ Vim/Neovim/Emacs
→ JetBrains IDEs
→ Azure Data Studio
Go to your GitHub account page
→ Settings
→ Copilot
→ Enable
Provide free access or payment method
Set settings
Next suggestion: Alt+]
Previous suggestion: Alt+[
Reject suggestion: Esc
Accept suggestion: Tab
Accept next suggested word: Ctrl+→
(Command+→
for macOS)
Set your own key binding for editor.action.inlineSuggest.acceptNextLine
to accept next suggested line
Open new tab with options: Ctrl+Enter
You can also hover over suggestions
Install Node.js
Clone https://github.com/github/copilot.vim
Configure:
Enable:
Get help:
Install Node.js
Assuming straight is installed:
(straight-use-package 'editorconfig) ; Copilot dependency
(use-package copilot
:straight (:host github
:repo "copilot-emacs/copilot.el"
:files ("dist" "*.el"))
:hook (prog-mode . copilot-mode) ; Settings up to you
:bind (("C-8" . copilot-complete)
:map copilot-completion-map
("C-j" . copilot-accept-completion)
("C-f" . copilot-accept-completion-by-word)
("C-t" . copilot-accept-completion-by-line)
("C-n" . copilot-next-completion)
("C-p" . copilot-previous-completion)))
Login to your GitHub account (only needs to be done once): M-x copilot-login
In beta
An extension to GitHub CLI (GitHub operations from the CLI)
→ Generate commands from natural language
→ Generate natural language explanations from commands
Trained on data up to 2021
Lower performance for natural languages ≠ English
Be very careful: the command line is powerful and you can delete your data or mess up your system if you don’t know what you are doing. Check commands carefully!
Get code explanations:
Get code from natural language:
Stack Overflow [github-copilot] tag
copilot.el (unofficial Emacs plug-in)