Copilot with Context
Simple plugin that adds snippets and other tools for Github copilot to improve productivity.
How does it work?
- Use paste snippet to quickly add any class, method, piece of code, ... as a special comment
- Prompt github copilot
- Use remove snippets to remove the comment you used as a reference
Or use any of the other utility functions provided by this extension.
Benefits
- Ensure Copilot knows how to call any API with the correct parameters
- Ensure Copilot knows the parameters for any function in your code
- Save any of your Copilot prompts as a snippet for easy access
- Find other prompts on the github discussions page!
- Quickly reformat code without fumbling around with prompts
- Generally make working with Copilot easier
Commands
Paste snippet
Search for any snippet, class, method, function, ... in your workspace and quickly paste it above your cursor.
Remove snippets
Remove any comment between <snippet></snippet> from the current file.
Add snippet
Select a section of code and add it as snippet for later.
Rewrite function
Quickly reformat a function.
Example: Both parameters are switched for all assertions in only a few seconds.
What are snippets
Snippets are simple comments in any language surrounded by <snippet> tags. They provide Copilot with the necessary context to call functions, etc. with the correct parameters.
The workflow is simple:
- Paste a snippet
- Call Copilot
- Call the 'remove snippet' command when you are satisfied with the result.
Where do snippets come from?
- You can add snippets by selecting some code and calling the 'add snippet' command
- You can search for any symbol (function, class, struct) in your project and paste it as a snippet
In the future you can define various sources for your snippets:
- Actual documentation pages
- Search for some term in your project files, then quickly paste a few lines before and after this term as a snippet.
- Snippets created by others, so that Copilot can handle any API without issues.
- Search snippets of code on github or grepper