GitHub Copilot Shortcuts #
Description #
GitHub Copilot provides developers with a set of keyboard shortcuts to accelerate the coding process. These shortcuts make the navigation and interaction with GitHub Copilot’s AI-driven suggestions more intuitive and efficient. In this pattern, we will explore the keyboard shortcuts that are essential for rapid code development with Copilot.
Example #
For example, to accept a suggestion from Copilot, you can simply press the TAB
key. Here’s a list of some key shortcuts:
- Accept suggestion:
TAB
key - Reject suggestion:
Esc
key - Show combined suggestions:
Ctrl
+Enter
key - Accept at word level:
Ctrl
+Right Arrow
key - See next suggestion:
Alt
+]
key - See previous suggestion:
Alt
+[
key - Trigger inline suggestion:
Alt
+/
key - Show Labs feature list:
Ctrl
+Shift
+Alt
+e
key - Toggle sidebar:
Ctrl
+Shift+a
key
Exercise #
- Exercise 1: Try using the
TAB
key to accept a Copilot suggestion in your current project. How does it feel? - Exercise 2: Press
Esc
key to reject a suggestion. What happens? - Exercise 3: Use
Ctrl
+Enter
key to see combined suggestions. Explore them and identify a useful one. - Exercise 4: Navigate through the suggestions using
Alt
+]
andAlt
+[
keys. How does it affect your code selection process? - Exercise 5: Experiment with the other shortcuts listed above and describe your experience with each of them.
Checklist for Further Learning #
- Have I internalized the shortcuts for accepting and rejecting Copilot suggestions?
- Am I comfortable using shortcuts to navigate through multiple suggestions?
- What other shortcuts within VSCode can enhance my coding experience with Copilot?
- How can I customize the shortcuts to suit my personal coding workflow?
- Could the use of these shortcuts help me in other coding environments or only in Visual Studio Code with Copilot?