Another noteworthy feature GitHub
Copilot offers to you is its code actions
feature.
For example, if I select this code here, I
get these sparkles here.
And that's the code actions icon that
should pop up when you select code.
If you click it, you get some smart
suggestions, which may differ
depending on what you selected, that
are suggested by the GitHub Copilot
extensions.
For example, here, I get the suggestion
to rewrite this selected code by
modifying it with using Copilot.
If I click that, it simply opens the inline
chat with that code selected, and I can
ask questions as you learned it before.
Or alternatively, I could review it.
And if I click that, it behind the scenes
uses GitHub Copilot chat to ask for
suggestions regarding how this selected
code could be optimized.
And it displays the comments it has here
in this overlay window.
In my case here, it does not suggest any
changes, but that might differ
depending on which code you selected.
So it's a nice way of getting a second
opinion on your code to find out
whether there's something you might
wanna change or improve.
And that's this code actions feature here.
If you, for example, have an error, if I
remove a key here, you also get such
code actions if you click this light bulb.
Here, you get some other suggestions as
well, which come directly from Visual
Studio Code, but you also get the
suggestion to fix this with Copilot.
So if you can't figure out why you have
an error here, you can click this, and it
automatically asks GitHub Copilot for
the fix.
So here, for example, it tells me that I
need to fix the import statement and it
then suggests the fix down there, and I
can now accept it to automatically apply
it.
So that's the code actions feature, which
is also a feature you should be aware of.