danielkhoo.io

twitter

github

Github Copilot and Copilot Chat

Until recently I've solely used Github Copilot as a better auto complete without actually exploring its deeper features. Some of them are so simple I'm annoyed with myself for not trying it earlie


1. Generate multiple options (⌃+Enter)

If the generated code isn't right but its close, you can browse alternative options.


Generate multiple options

2. Inline Selection Prompt (Cmd + I)

You don't have to copy/paste code, just selecting and prompting works. You can also treat the side bar (toggle with ⌃+Cmd+I) as a ChatGPT window but better cause it has context for selected text + workspace


Inline Selection with workspace context

3. Generate Comment Documentation

Copilot chat has a bunch of default commands/prompts that handle common use cases. "/doc" is a good example to instantly document functions.


Generate Function Doc Comments

4. Generate Unit Tests Cases

This one is more hit or miss, Copilot tries its best to generate plausible test cases for a function. It's maybe 60% there but still saves some time writing boilerplate test code.


Mulitple Test cases (Not all make sense)