Get startedGet started for free

Exploring GitHub Copilot modes

1. Exploring GitHub Copilot modes

Now, it's time to see Copilot in action.

2. How to access GitHub Copilot

GitHub Copilot can be used within your IDE and on the GitHub platform.

3. How to access GitHub Copilot

For this course, we will use it with Visual Studio Code.

4. The different Copilot interfaces

You can find Copilot in various places: your code editor, a specialized chat window, and other places, such as the terminal or in your source control tab.

5. The different Copilot interfaces

It's basically anywhere you see the sparkles icon. Let's explore each interface to know which to use when.

6. Autcomplete and Inline Chat in action

We will start with the code editor. Here, you have an Autocomplete feature. You can access it by pressing Enter on a code line and receiving a suggestion. You can accept the suggestion with Tab. This usually leads to another suggestion, and so on. Another feature in the editor is the Inline Chat. You can access it by highlighting code, clicking the sparkles icon, and clicking Modify. This will open Inline Chat, where you can ask Copilot for modifications. Observe how Copilot produces the code, and accept the changes if you're happy with them. Otherwise, you can keep chatting with Copilot or close the conversation to reject the changes.

7. When to use Autocomplete or Inline Chat

Autocomplete and Inline Chat are perfect for: quick code modifications, adding missing logic, fixing small bugs, or refactoring a specific section.

8. Ask Mode in action

But what if you need to tackle something more complex? That's where the Copilot Chat comes in. You can find the chat on the right side panel of VS Code, and you can open or close it using the Copilot icon. Near the message area, you'll find several options: You can select between Agent, Ask, and Edit modes. You can also choose different LLM models, and you can add context. In upcoming lessons, we will cover context and models in depth. For now, I'll show you the Ask mode. In this mode, you can ask Copilot questions, and it will not make any code modifications. For example, if I ask an architectural question, it will understand my code and provide a tailored answer. This mode is great when you need to think through complex problems or explore different solutions before writing code.

9. When to use Ask Mode

Use the Ask mode when you want Copilot to: Help you plan your application's architecture, explore multiple approaches to a particular problem, walk through specific implementation steps, or reference multiple files and concepts.

10. Edit Mode in action

The next interface is Edit Mode. As the name suggests, Copilot will write or modify your code in this mode. It is excellent when you know exactly what you want to do, but don't necessarily want to write it yourself. You can use this mode to ask for broader changes involving several parts of the code and even multiple files. Then, you can keep or undo all the changes, or even accept and revert individual changes. It's also possible to see the scope of the changes in terms of lines of code added and removed.

11. When to use Edit Mode

Edit Mode is great for multi-file refactoring, feature implementation that spans multiple components, setting up new project structures, or complex operations that require understanding relationships between files.

12. How to select the right mode

There you have it! We've explored the primary Copilot interfaces.

13. How to select the right mode

In summary, when you need speed and focus, use Autocomplete or Inline Chat.

14. How to select the right mode

When you need to think and plan, use Ask Mode.

15. How to select the right mode

When you need more complex tasks, use Edit Mode. But what about Agent mode? Don't worry, we will explore it in depth in the next lesson!

16. Let's practice!

Now it's your turn—let's apply what you've learned through a few exercises.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.