Now, besides adding context and participants to chat, GitHub Copilot chat also offers you
these slash commands, which you also see here on my screen and some other slash commands
to quickly invoke various functionalities that are supported by GitHub Copilot.
So if I type a slash here, I'll actually see some of these suggestions down here and
also up here.
For example, I can use at terminal slash explain to explain some command I currently have in
my terminal or some command I currently have selected.
I can also, and that's sometimes even more useful, use the inline chat and for example
select some code and then use a slash command here to quickly invoke a command, a feature
if you want to call it like this, provided by GitHub Copilot that will take this selected
code into account or that will take this selected code as a base.
For example, if I use slash explain with this code selected, I don't need to type anything
else.
I could to add more instructions or more context, but I can also run it like this to have this
code be explained to me.
I could add more information if I wanted to specify which kind of explanation I'm looking
for, but if I run it like this, you see it will open up this little window here and it
will explain that code for me here.
Of course, it can be a bit annoying to browse that here, so I can always click view in chat
and I have the entire explanation here in my chat now.
And besides slash explain, I could also run slash fix if there is some problem with that
code and I want Copilot to fix it.
I also might want to add some text here then where I describe the problem.
Like I don't want to use the logging package and it will now fix that code, taking my instruction
into account and go back to the print statement, for example.
And I could now accept this or discard it if I don't want it.
And here I'll discard it because I'm happy with the logging package.
But that would have been one way of using this fix command.
Now of course, I could have also described my intent without fix, like I don't want to
use the logging package.
And chances are high that it would have worked as well, as you can tell.
But by using slash fix, you're adding some extra context again.
And using these AI chat tools is all about context.
It's always about adding the right context in the right place, because with this slash
fix command, we make it very clear that we want to fix this code.
And therefore, for certain commands where sometimes GitHub Copilot might not always
give us the right response, the right result, adding little extra pieces of context like
this can make the difference, which is why it's important to know about it.
Now another very useful slash command is slash tests.
And we'll explore this in the next lecture.