WEBVTT

1
00:00:00.000 --> 00:00:02.700
Another noteworthy feature GitHub

2
00:00:02.700 --> 00:00:06.260
Copilot offers to you is its code actions

3
00:00:06.260 --> 00:00:06.900
feature.

4
00:00:07.380 --> 00:00:09.480
For example, if I select this code here, I

5
00:00:09.480 --> 00:00:11.340
get these sparkles here.

6
00:00:12.120 --> 00:00:15.020
And that's the code actions icon that

7
00:00:15.020 --> 00:00:17.240
should pop up when you select code.

8
00:00:18.160 --> 00:00:21.400
If you click it, you get some smart

9
00:00:21.400 --> 00:00:23.500
suggestions, which may differ

10
00:00:23.500 --> 00:00:25.860
depending on what you selected, that

11
00:00:25.860 --> 00:00:28.440
are suggested by the GitHub Copilot

12
00:00:28.440 --> 00:00:28.980
extensions.

13
00:00:29.760 --> 00:00:32.200
For example, here, I get the suggestion

14
00:00:32.200 --> 00:00:35.100
to rewrite this selected code by

15
00:00:35.100 --> 00:00:37.580
modifying it with using Copilot.

16
00:00:38.220 --> 00:00:40.460
If I click that, it simply opens the inline

17
00:00:40.460 --> 00:00:43.060
chat with that code selected, and I can

18
00:00:43.060 --> 00:00:45.060
ask questions as you learned it before.

19
00:00:46.360 --> 00:00:48.660
Or alternatively, I could review it.

20
00:00:48.860 --> 00:00:51.980
And if I click that, it behind the scenes

21
00:00:51.980 --> 00:00:55.100
uses GitHub Copilot chat to ask for

22
00:00:55.100 --> 00:00:57.700
suggestions regarding how this selected

23
00:00:57.700 --> 00:00:58.940
code could be optimized.

24
00:01:00.220 --> 00:01:04.160
And it displays the comments it has here

25
00:01:04.160 --> 00:01:05.580
in this overlay window.

26
00:01:06.380 --> 00:01:09.640
In my case here, it does not suggest any

27
00:01:09.640 --> 00:01:11.340
changes, but that might differ

28
00:01:11.340 --> 00:01:13.100
depending on which code you selected.

29
00:01:14.040 --> 00:01:16.360
So it's a nice way of getting a second

30
00:01:16.360 --> 00:01:18.400
opinion on your code to find out

31
00:01:18.400 --> 00:01:20.120
whether there's something you might

32
00:01:20.120 --> 00:01:21.800
wanna change or improve.

33
00:01:22.740 --> 00:01:25.000
And that's this code actions feature here.

34
00:01:25.960 --> 00:01:29.160
If you, for example, have an error, if I

35
00:01:29.160 --> 00:01:31.980
remove a key here, you also get such

36
00:01:31.980 --> 00:01:34.200
code actions if you click this light bulb.

37
00:01:35.380 --> 00:01:37.480
Here, you get some other suggestions as

38
00:01:37.480 --> 00:01:39.580
well, which come directly from Visual

39
00:01:39.580 --> 00:01:42.200
Studio Code, but you also get the

40
00:01:42.200 --> 00:01:44.980
suggestion to fix this with Copilot.

41
00:01:45.700 --> 00:01:48.080
So if you can't figure out why you have

42
00:01:48.080 --> 00:01:51.220
an error here, you can click this, and it

43
00:01:51.220 --> 00:01:53.540
automatically asks GitHub Copilot for

44
00:01:53.540 --> 00:01:54.100
the fix.

45
00:01:54.640 --> 00:01:56.660
So here, for example, it tells me that I

46
00:01:56.660 --> 00:01:59.260
need to fix the import statement and it

47
00:01:59.260 --> 00:02:01.800
then suggests the fix down there, and I

48
00:02:01.800 --> 00:02:04.160
can now accept it to automatically apply

49
00:02:04.160 --> 00:02:04.460
it.

50
00:02:05.400 --> 00:02:07.760
So that's the code actions feature, which

51
00:02:07.760 --> 00:02:09.759
is also a feature you should be aware of.

