WEBVTT

1
00:00:01.460 --> 00:00:07.420
Now, here in this program, I could of course now also enhance the restore database function

2
00:00:07.420 --> 00:00:10.920
by using inline chat and also add error handling here.

3
00:00:11.500 --> 00:00:14.220
But I'll instead do something else.

4
00:00:14.580 --> 00:00:23.000
I'll open that sidebar chat by using the appropriate shortcut or the command palette

5
00:00:23.000 --> 00:00:24.260
command open chat.

6
00:00:25.420 --> 00:00:32.000
And with that, we got a more powerful chat window that opens up where the inline chat

7
00:00:32.000 --> 00:00:38.140
is really a very useful feature for tweaking specific parts of your code or for quickly

8
00:00:38.140 --> 00:00:40.640
adding code in certain parts of your file.

9
00:00:41.360 --> 00:00:48.940
This chat sidebar, this chat window here is really about completing more complex tasks

10
00:00:48.940 --> 00:00:52.940
or asking more complex questions about your code base.

11
00:00:54.540 --> 00:01:00.000
And here it will also not generate code, but instead generate answers which may contain

12
00:01:00.000 --> 00:01:02.640
code but which may also contain other information.

13
00:01:04.360 --> 00:01:15.000
For example, here I could ask, how could the following Python code be optimized and improved?

14
00:01:16.460 --> 00:01:21.380
And I could then copy this code here into this chat.

15
00:01:22.780 --> 00:01:26.380
And I'll show you another way soon, but I could copy it in here and hit enter.

16
00:01:26.880 --> 00:01:28.880
And now this will be sent to GitHub servers.

17
00:01:29.200 --> 00:01:32.400
It will be analyzed and it will tell me how I could improve it.

18
00:01:34.360 --> 00:01:42.200
And essentially here, it also suggests that I could add error handling and also use this

19
00:01:42.200 --> 00:01:47.040
logging package here for better structured logging and so on.

20
00:01:47.080 --> 00:01:48.640
So that's what it's also telling me here.

21
00:01:50.020 --> 00:01:55.140
And then it shows me how the code would have to be adjusted to, well, have this functionality.

22
00:01:56.520 --> 00:01:59.140
And as you can see, it also gives me some buttons here.

23
00:01:59.480 --> 00:02:02.460
If I hover over this code snippet, it generates it.

24
00:02:03.180 --> 00:02:09.259
It gives me a button for applying these changes in the editor, for inserting them at the cursor

25
00:02:09.259 --> 00:02:15.180
position in the editor, for copying it so that I can manually edit wherever I want,

26
00:02:15.860 --> 00:02:21.120
or for inserting this code into the terminal, which doesn't make too much sense, but that

27
00:02:21.120 --> 00:02:24.860
could make sense if a terminal command would be generated here.

28
00:02:25.000 --> 00:02:26.360
We'll dive into that later.

29
00:02:27.440 --> 00:02:29.720
Or I could insert it into a new file.

30
00:02:30.980 --> 00:02:37.000
So here, if I click apply, this first button in my case here, apply an editor, you see

31
00:02:38.260 --> 00:02:43.600
it's going ahead and it's trying to apply this code here to my code here.

32
00:02:43.700 --> 00:02:48.220
And the operator makes a lot of changes here because it does not just take this code and

33
00:02:48.220 --> 00:02:50.280
paste it into one place in my code.

34
00:02:50.520 --> 00:02:53.620
Instead, it tries to apply it to the entire file.

35
00:02:55.040 --> 00:02:57.420
For example, the import gets added to the top.

36
00:02:57.740 --> 00:03:02.840
This configuration gets added to the top, and then it changes the restore database function.

37
00:03:04.320 --> 00:03:08.560
Now here, it actually also does something which is not part of this code snippet.

38
00:03:09.240 --> 00:03:15.660
It understands that this function should probably also use this logging package here

39
00:03:15.660 --> 00:03:19.360
if I'm using it in the other function, so that we're consistent again.

40
00:03:21.660 --> 00:03:24.600
And therefore, of course, I can evaluate these changes.

41
00:03:25.060 --> 00:03:28.320
Again, code that's added is highlighted in dark green.

42
00:03:28.800 --> 00:03:31.000
Code that would be removed would be red.

43
00:03:32.400 --> 00:03:37.540
And I can accept them, I can discard them, so that we go back to the original state.

44
00:03:37.640 --> 00:03:43.640
I can also click show changes to get that more detailed view where it essentially shows

45
00:03:43.640 --> 00:03:49.540
me that it erases my old code, but then re-adds it with those changes, so that technically

46
00:03:49.540 --> 00:03:51.700
only small parts of the code change.

47
00:03:53.580 --> 00:03:57.460
And therefore, finally here, I'll accept these changes like this.

48
00:03:59.060 --> 00:04:04.580
And now with that, I got my code updated here with those changes applied.

49
00:04:05.160 --> 00:04:10.220
So with the logging package used and with error handling used here in a restore DB.

50
00:04:12.340 --> 00:04:20.920
Now with that, if I rerun this and I try to restore, you see I'm getting an error here

51
00:04:20.920 --> 00:04:25.180
that it failed to restore because the backup DB file does not exist, but I got this different

52
00:04:25.180 --> 00:04:28.440
logging format here now due to this logging package being used.

53
00:04:30.000 --> 00:04:32.180
And that's there for another way of using chat.

54
00:04:33.000 --> 00:04:39.920
Not using the inline chat, but instead this chat here in the sidebar to have more space

55
00:04:39.920 --> 00:04:41.540
for writing your command.

56
00:04:42.000 --> 00:04:47.440
You can paste in some extra code and for getting more details regarding the reply so that it's

57
00:04:47.440 --> 00:04:51.880
not just a code being edited, but you also get some explanations regarding what changed

58
00:04:51.880 --> 00:04:52.420
and why.

59
00:04:52.820 --> 00:04:58.260
And as you saw, you then got different options of applying those changes or of using any

60
00:04:58.160 --> 00:04:59.820
code that might have been generated.

