WEBVTT

1
00:00:01.820 --> 00:00:09.440
Now, in the previous lecture, I did paste some code into this chat box here when asking

2
00:00:09.440 --> 00:00:12.780
a question regarding how this code could be optimized.

3
00:00:14.440 --> 00:00:17.300
Now, you actually don't have to do that.

4
00:00:17.580 --> 00:00:22.340
If I open a new chat, which I can by pressing the plus button here, by the way, I could

5
00:00:22.340 --> 00:00:26.840
have also added a follow-up question to the old chat, but now I want to start a new chat.

6
00:00:27.320 --> 00:00:37.020
If I do that, then I can again ask this question, how can I optimize the code?

7
00:00:37.880 --> 00:00:41.420
But this time I won't paste in any code snippet.

8
00:00:42.440 --> 00:00:47.260
Because let's say I want to optimize the entire file and ask about the code of this

9
00:00:47.260 --> 00:00:47.880
entire file.

10
00:00:48.680 --> 00:00:54.820
Now, if I send this question like this, it does indeed automatically evaluate this file

11
00:00:54.800 --> 00:00:56.040
which I currently have open.

12
00:00:57.440 --> 00:01:02.080
And depending on when you're watching this, it might even evaluate other files in your

13
00:01:02.080 --> 00:01:02.680
project.

14
00:01:03.020 --> 00:01:04.080
That is possible.

15
00:01:04.819 --> 00:01:10.960
But if it wouldn't do that, if I open another new chat, how can I optimize this code?

16
00:01:13.119 --> 00:01:20.780
I could also add an explicit file reference here to tell GitHub Copilot Chat which code

17
00:01:20.780 --> 00:01:21.280
I mean.

18
00:01:23.080 --> 00:01:29.180
You can do this by adding context by pressing this button here.

19
00:01:31.380 --> 00:01:37.920
And then you see I could select code base here or a current editor to refer to the currently

20
00:01:37.920 --> 00:01:39.020
open editor.

21
00:01:40.560 --> 00:01:41.940
I could use selection.

22
00:01:42.140 --> 00:01:46.360
If I had some code selected here, I could use selection to refer to this code.

23
00:01:47.380 --> 00:01:50.000
Symbol to refer to a specific symbol.

24
00:01:51.080 --> 00:01:52.240
I'll get back to that.

25
00:01:53.540 --> 00:01:59.080
I could refer to the last command I ran in the terminal or to any selection I have in

26
00:01:59.080 --> 00:01:59.660
the terminal.

27
00:02:01.200 --> 00:02:05.860
And then here I also got some files suggested so that I can ask about these files.

28
00:02:07.060 --> 00:02:13.760
Though I can also do this by choosing symbol or by typing a hash manually and then the

29
00:02:13.760 --> 00:02:14.440
file name.

30
00:02:15.440 --> 00:02:20.120
So in my case here, dbBackup.

31
00:02:22.120 --> 00:02:27.140
Alternatively, I could also choose symbol or type a hash symbol manually.

32
00:02:28.660 --> 00:02:36.500
And then I can select functions from my file or choose the entire file here.

33
00:02:38.120 --> 00:02:44.020
I can also type file and then get a suggestion of the files I could choose.

34
00:02:45.260 --> 00:02:52.360
I could also choose symbol or type a hash manually and then I can ask questions about

35
00:02:52.360 --> 00:02:55.800
specific functions or variables from my file.

36
00:02:55.900 --> 00:02:57.040
So I can do that too.

37
00:02:58.560 --> 00:03:05.640
Alternatively, here in the chat box, you can also enter a hash symbol and then you can

38
00:03:06.300 --> 00:03:11.960
use these shortcuts here to refer to your entire code base, to your editor or to a specific

39
00:03:11.960 --> 00:03:17.340
file by typing hash tag file and then choose one of the files like dbBackup.

40
00:03:18.520 --> 00:03:21.360
And you see this now gets added like this here to the code editor.

41
00:03:22.520 --> 00:03:28.200
So there are different ways of referring to different parts of your project to the entire

42
00:03:28.200 --> 00:03:28.800
code base.

43
00:03:29.040 --> 00:03:33.900
So to all your files with all your code to a specific file and so on.

44
00:03:35.620 --> 00:03:41.300
So that would be another more explicit way of referring to this specific dbBackup py

45
00:03:41.300 --> 00:03:41.800
file.

46
00:03:42.220 --> 00:03:48.360
We can then ask the same question to get an answer regarding how this code could be optimized.

47
00:03:50.460 --> 00:03:54.780
For example, to remove redundant logging, combine exception handling.

48
00:03:55.280 --> 00:04:01.920
And again, I get a little suggestion here, which I could apply to improve my code.

49
00:04:03.120 --> 00:04:06.440
And that shows you the strength of this chat feature.

50
00:04:06.640 --> 00:04:12.320
You can ask anything about your code, for example, about general ways of improving it.

51
00:04:12.580 --> 00:04:18.880
And you can refer to specific parts of your code or to specific files to make sure that

52
00:04:18.880 --> 00:04:26.240
this chat has just the right context to answer your question in hopefully the best possible

53
00:04:26.240 --> 00:04:26.620
way.

