Skip to content

Latest commit

 

History

History
88 lines (44 loc) · 3.01 KB

TIPS.md

File metadata and controls

88 lines (44 loc) · 3.01 KB

GitHub Copilot Tips & Tricks

Here are some useful shortcut commands for using GitHub Copilot:

  • Ctrl + Enter (or Cmd + Enter on Mac): Open the suggestion panel to view alternative suggestions.

  • Tab: Accept the current suggestion.

  • Shift + Tab: Cycle through the available suggestions.

  • Ctrl + . (or Cmd + . on Mac): Open the context menu to view more options.

  • Ctrl + Space (or Cmd + Space on Mac): Trigger GitHub Copilot to generate code based on the context of your code.

  • Ctrl + Shift + Space (or Cmd + Shift + Space on Mac): Trigger GitHub Copilot to generate code based on the context of your code, but with more context.

  • Ctrl + Shift + Enter (or Cmd + Shift + Enter on Mac): Trigger GitHub Copilot to generate code based on the context of your code, but with even more context.

Things to try in the Copilot Chat Window

  • Select the code throwing error(s) and type Handle error in the chat.

"/" Commands

  • Type /api in the chat to get the API for the code.

  • Type /explain in the chat to get an explanation of the code.

  • Type /fix in the chat to get a fixed version of the code.

  • Type /new in the chat to create a new project with some scaffold code.

  • Type /newNotebook in the chat to create a new Jupyter notebook.

  • Type /test in the chat to generate unit test.

  • Type /help in the chat to get help with the commands.

  • Type /clear in the chat to clear the chat window.

"@" Commands

  • Type @terminal in the chat to handle/run queries on/about terminal output(s)/error(s).

  • Type @vscode in the chat to handle/run queries on/about VSCode output(s)/error(s).

  • Type @workspace in the chat to run queries on/about workspace.

"#" Commands

  • Type #editor in the chat to handle/run queries on/about editor output(s)/error(s).

  • Type #file in the chat to handle/run queries on/about file output(s)/error(s).

  • Type #selection in the chat to handle/run queries on/about selected output(s)/error(s).

  • Type #TerminalLastCommand in the chat to handle/run queries on/about the last command in the terminal.

  • Type #TerminlSelection in the chat to handle/run queries on/about selected terminal output(s)/error(s).

In-Line Chat Shortcuts

Press Ctrl + I to open inline GitHub Copilot Chat

alt text

  • Type /doc in the chat to get the documentation for the code.

  • Type /explain in the chat to get an explanation of the code.

  • Type /fix in the chat to get a fixed version of the code.

  • Type /test in the chat to generate unit test.

Easter Eggs

GitHub Copilot has a few easter eggs too! For example, try typing import antigravity in a Python file and see what happens.

Conclusion

GitHub Copilot is a powerful tool that can significantly speed up your coding process. With these tips and tricks, you'll be able to get the most out of it. Happy coding!

Credits

https://github.com/microsoft/CopilotHackathon/blob/main/Resources/GHCP%20Cheatsheet.md