The latest update 1.96.1 of VSCode, enables the GitHub Copilot Free plan. You can compare the plans although basically the Free Plan provides:
2000 Code completions per month
50 Chat messages per month
As long as you have a Github Account & an updated VSCode, all you need to do, is fire up VSCode & click the copilot icon, right of the search bar.
Then click Use Copilot for Free and Sign in with a GitHub.com Account. If nothing seems to happen, quit and reload VSCode.
Copilot Chats
Once open you can chat with Copilot and use the Apply in Editor link to insert into your editor. Here I’m asking it to ….
Create a PL/SQL input validation package for APEX Application to use to validate inputs
This created a new file for us & we just interacted with Chat via the middle icon
You can also drag in a symbol from the Outline view e.g procedure remove_sample_data into the chat window and ask questions. Here im asking it to:
Remove the where clauses
Again, I just need to click Apply in Editor to make the change.
Note: In Chat, you can only ask Coding questions
Copilot Edits
For PL/SQL you can select multiple lines of code, Right-Click > Copilot > Explain any PL/SQL to you
You can ask Copilot to write inline code by selecting Right-Click > Copilot > Editor Inline Chat (or Ctrl+I)
Now a prompt appears, where I ask a question.
It can also Right-Click > Copilot > fix code. e.g given this (modified) code below, it finds an issue
and then supplies the fix (green) for me to Accept or Discard
It can also Right-Click > Copilot > review and comment
and by applying those suggestions, we get a better code refinement
We can also generate Right-Click > Copilot > Create Docs
It can also produce utplsql tests
and unit tests
By dragging your files into the Copilot Working Set (see bottom-right of the picture below) of the Edits tab (edits allow Copilot to make changes to all files within the Working Set. By clicking Add Files, co-pilot will suggest files to add to the Working Set.
Once files have been added, you can ask a question of your code within the working set e.g.
How do I send an Email?
In its response, it told me about apex_mail.send
as well as creating a new send_custom_mail
procedure as well as providing a sample runner script.
Next, I can ask it to overload the procedure to add a BCC address. All I need to do is accept the change.
In order to call these two procedures… I need to add it to the specification of EBA_CUST_EMAIL
. Therefore I just drag into the specification file, copilot performs the change and I accept the change
You can also drag folders into the working set
In this next step I’m demonstration multiple changes in multiple files
prefix all procedures with pn_ and all functions with fn_
In the above picture, I can review and accept all changes in all 7 files.
Additional
Coding Style
Copilot can write code i a certain style by following instructions.
Commit Messages
Copilot can write you commit message based on the changes, by clicking the icon in the box
But first you need to activate it by File > Preferences > Settings and pasting this in to the finder
@id:
github.copilot.chat
.commitMessageGeneration.instructions
Then just slap this at the end of your settings.json
file
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "Use conventional commit message format."
}
]
ENJOY!
What repo was I using? I was using this one
What’ the picture? It’s Nidd Gorge. Jack Carter’s Cave near the riverbank is shown on ordnance survey maps, though there are no visible traces. Legend has it that a Civil War ( English Civil War, which took place from 1642 to 1651) drummer hid in a cave in Nidd Gorge instead of leading troops to battle. The story has inspired a wooden seat carved with drumsticks.