GitHub Copilot
Introduction
For advanced users who spend a lot of time in the Code mode, CDP Studio supports GitHub Copilot - an AI coding assistant that helps you write code faster and with less effort.
Requirements
To use the Copilot plugin, you need:
- An active GitHub Copilot subscription
- The GitHub Copilot Neovim plugin, see the installation instructions below.
How It Works
The Github Copilot offers coding suggestions as you type: sometimes the completion of the current line, sometimes a whole new block of code. You can accept all or a part of a suggestion or you can ignore the suggestion and keep typing.
Useful Shortcuts
- Tab - apply a suggestion as a whole
- Ctrl+Right - apply a suggestion word-by-word
- Esc - reject a suggestion
Additional Copilot shortcuts can be configured under Edit -> Preferences... -> Environment -> Keyboard.
Installation
To use the Copilot plugin, you need an active GitHub Copilot subscription.
The CDP Studio Copilot integration depends on the GitHub Copilot Neovim plugin. Follow the Copilot.vim/Readme.md instructions to install the following dependencies:
- Node.js
- Neovim
- GitHub Copilot Neovim plugin
Note: The instructions presume that git is installed on your system and in the PATH.
Finally, start CDP Studio, go to Edit -> Preferences... -> Copilot and configure the following settings:
- Select the Enable Copilot check box to use Copilot.
- In the Node.js path field, enter the full path to the Node.js executable.
- In the Path to language-server.js field, enter the path to language-server.js in the Copilot Neovim plugin installation folder.
- Select Sign In to sign into your subscription, activate your device, and authorize the GitHub Copilot plugin. When done, the button turns into a Sign Out button.
Note: This step is not needed if you have already signed in from Neovim with the ":Copilot setup" command.
- Select the Auto request check box to receive suggestions for the current text cursor position when you make changes.
Tips
- Copilot is very helpful with things like:
- Adding printouts to code
- Standard algorithms
- Generating simple test data for unit tests
- Writing boilerplate code
- To guide the Copilot suggestions, add comments to your code
- Sometimes it is helpful to temporarily copy some extra context into the file you are working on to help Copilot improve its suggestions - for example, a class definition or some documentation.
Note: The Copilot plugin is a work in progress and may not always provide the best suggestions. It is not a replacement for understanding the code you are writing. Always carefully verify the given suggestions to avoid serious mistakes in the code.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.