-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
1114 lines (978 loc) · 40.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<!-- extensionAPI/api-debugging/ Sat, 30 Oct 2021 04:57:15 -->
<!-- Added by HTTrack --><meta
http-equiv="content-type"
content="text/html;charset=utf-8"
/><!-- /Added by HTTrack -->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Api debugging - vscode</title>
<link rel="shortcut icon" href="../../img/favicon.ico" />
<link
href="https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700"
rel="stylesheet"
type="text/css"
/>
<link rel="stylesheet" href="../../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="../../css/highlight.css" />
<link
href="../../../../../assets.readthedocs.org/static/css/badge_only.css"
rel="stylesheet"
/>
<link
href="../../../../../assets.readthedocs.org/static/css/readthedocs-doc-embed.css"
rel="stylesheet"
/>
<script>
// Current page data
var mkdocs_page_name = "Api debugging";
var mkdocs_page_input_path = "extensionAPI/api-debugging.md";
var mkdocs_page_url =
"https://vscode.readthedocs.io/extensionAPI/api-debugging/";
</script>
<script src="../../js/jquery-2.1.1.min.js"></script>
<script src="../../js/modernizr-2.8.3.min.js"></script>
<script type="text/javascript" src="../../js/highlight.pack.js"></script>
<script src="../../js/theme.js"></script>
<script src="../../readthedocs-data.js"></script>
<script src="../../readthedocs-dynamic-include.js"></script>
<script src="../../../../../assets.readthedocs.org/static/static/core/js/readthedocs-doc-embed.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-nav-search">
<a href="../../index.html" class="icon icon-home"> vscode</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div
class="wy-menu wy-menu-vertical"
data-spy="affix"
role="navigation"
aria-label="main navigation"
>
<ul class="current">
<li></li>
<li class="toctree-l1">
<a class="" href="../../index.html">Home</a>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Customization</span></li>
<li class="toctree-l1">
<a
class=""
href="../../customization/keyboard-shortcuts/index.html"
>Keyboard shortcuts</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Editor</span></li>
<li class="toctree-l1">
<a class="" href="../../editor/accessibility/index.html"
>Accessibility</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/codebasics/index.html"
>Codebasics</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/command-line/index.html"
>Command line</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/debugging/index.html"
>Debugging</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/editingevolved/index.html"
>Editingevolved</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/emmet/index.html">Emmet</a>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/extension-gallery/index.html"
>Extension gallery</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/integrated-terminal/index.html"
>Integrated terminal</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/intellisense/index.html"
>Intellisense</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/tasks-appendix/index.html"
>Tasks appendix</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/tasks-v1-appendix/index.html"
>Tasks v1 appendix</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/tasks-v1/index.html"
>Tasks v1</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/tasks/index.html">Tasks</a>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/userdefinedsnippets/index.html"
>Userdefinedsnippets</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/versioncontrol/index.html"
>Versioncontrol</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../editor/whyvscode/index.html"
>Whyvscode</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>extensionAPI</span></li>
<li class="toctree-l1">
<a class="" href="../activation-events/index.html"
>Activation events</a
>
</li>
<li class="toctree-l1 current">
<a class="current" href="index.html">Api debugging</a>
<ul>
<li class="toctree-l3">
<a href="#the-vs-code-debug-protocol"
>The VS Code Debug Protocol</a
>
</li>
<li>
<a class="toctree-l4" href="#debug-adapter"
>Debug Adapter</a
>
</li>
<li>
<a
class="toctree-l4"
href="#the-vs-code-debug-protocol-in-a-nutshell"
>The VS Code Debug Protocol in a Nutshell</a
>
</li>
<li>
<a class="toctree-l4" href="#next-steps">Next Steps</a>
</li>
</ul>
</li>
<li class="toctree-l1">
<a class="" href="../api-markdown/index.html">Api markdown</a>
</li>
<li class="toctree-l1">
<a class="" href="../api-scm/index.html">Api scm</a>
</li>
<li class="toctree-l1">
<a class="" href="../extension-manifest/index.html"
>Extension manifest</a
>
</li>
<li class="toctree-l1">
<a class="" href="../extension-points/index.html"
>Extension points</a
>
</li>
<li class="toctree-l1">
<a class="" href="../language-support/index.html"
>Language support</a
>
</li>
<li class="toctree-l1">
<a class="" href="../overview/index.html">Overview</a>
</li>
<li class="toctree-l1">
<a class="" href="../patterns-and-principles/index.html"
>Patterns and principles</a
>
</li>
<li class="toctree-l1">
<a class="" href="../vscode-api-commands/index.html"
>Vscode api commands</a
>
</li>
<li class="toctree-l1">
<a class="" href="../vscode-api/index.html">Vscode api</a>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Extensions</span></li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/debugging-extensions/index.html"
>Debugging extensions</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/example-debuggers/index.html"
>Example debuggers</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/example-hello-world/index.html"
>Example hello world</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/example-language-server/index.html"
>Example language server</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/example-word-count/index.html"
>Example word count</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../extensions/overview/index.html"
>Overview</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/publish-extension/index.html"
>Publish extension</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../extensions/samples/index.html"
>Samples</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/testing-extensions/index.html"
>Testing extensions</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../extensions/themes-snippets-colorizers/index.html"
>Themes snippets colorizers</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../extensions/yocode/index.html"
>Yocode</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Getstarted</span></li>
<li class="toctree-l1">
<a class="" href="../../getstarted/introvideos/index.html"
>Introvideos</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../getstarted/keybindings/index.html"
>Keybindings</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../getstarted/locales/index.html"
>Locales</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../getstarted/settings/index.html"
>Settings</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../getstarted/theme-color-reference/index.html"
>Theme color reference</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../getstarted/themes/index.html"
>Themes</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../getstarted/userinterface/index.html"
>Userinterface</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Introvideos</span></li>
<li class="toctree-l1">
<a class="" href="../../introvideos/basics/index.html"
>Basics</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/codeediting/index.html"
>Codeediting</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/configure/index.html"
>Configure</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/debugging/index.html"
>Debugging</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/extend/index.html"
>Extend</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/intellisense/index.html"
>Intellisense</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/quicktour/index.html"
>Quicktour</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../introvideos/versioncontrol/index.html"
>Versioncontrol</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Languages</span></li>
<li class="toctree-l1">
<a class="" href="../../languages/cpp/index.html">Cpp</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/csharp/index.html"
>Csharp</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/css/index.html">Css</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/dockerfile/index.html"
>Dockerfile</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/go/index.html">Go</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/html/index.html">Html</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/identifiers/index.html"
>Identifiers</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/javascript/index.html"
>Javascript</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/jsconfig/index.html"
>Jsconfig</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/json/index.html">Json</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/markdown/index.html"
>Markdown</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/overview/index.html"
>Overview</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/php/index.html">Php</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/python/index.html"
>Python</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/tsql/index.html">Tsql</a>
</li>
<li class="toctree-l1">
<a class="" href="../../languages/typescript/index.html"
>Typescript</a
>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Nodejs</span></li>
<li class="toctree-l1">
<a class="" href="../../nodejs/angular-tutorial/index.html"
>Angular tutorial</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/extensions/index.html"
>Extensions</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../nodejs/javascript-transpilers/index.html"
>Javascript transpilers</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/nodejs-debugging/index.html"
>Nodejs debugging</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/nodejs-deployment/index.html"
>Nodejs deployment</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/nodejs-tutorial/index.html"
>Nodejs tutorial</a
>
</li>
<li class="toctree-l1">
<a
class=""
href="../../nodejs/other-javascript-runtimes/index.html"
>Other javascript runtimes</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/overview/index.html"
>Overview</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/reactjs-tutorial/index.html"
>Reactjs tutorial</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../nodejs/tasks/index.html">Tasks</a>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Other</span></li>
<li class="toctree-l1">
<a class="" href="../../other/dotnet/index.html">Dotnet</a>
</li>
<li class="toctree-l1">
<a class="" href="../../other/office/index.html">Office</a>
</li>
<li class="toctree-l1">
<a class="" href="../../other/unity/index.html">Unity</a>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Setup</span></li>
<li class="toctree-l1">
<a
class=""
href="../../setup/additional-components/index.html"
>Additional components</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../setup/linux/index.html">Linux</a>
</li>
<li class="toctree-l1">
<a class="" href="../../setup/mac/index.html">Mac</a>
</li>
<li class="toctree-l1">
<a class="" href="../../setup/network/index.html">Network</a>
</li>
<li class="toctree-l1">
<a class="" href="../../setup/setup-overview/index.html"
>Setup overview</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../setup/windows/index.html">Windows</a>
</li>
</ul>
</li>
<li></li>
<li>
<ul class="subnav">
<li><span>Supporting</span></li>
<li class="toctree-l1">
<a class="" href="../../supporting/errors/index.html"
>Errors</a
>
</li>
<li class="toctree-l1">
<a class="" href="../../supporting/faq/index.html">Faq</a>
</li>
<li class="toctree-l1">
<a class="" href="../../supporting/requirements/index.html"
>Requirements</a
>
</li>
</ul>
</li>
<li></li>
</ul>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">vscode</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html">Docs</a> »</li>
<li>extensionAPI »</li>
<li>Api debugging</li>
<li class="wy-breadcrumbs-aside"></li>
</ul>
<hr />
</div>
<div role="main">
<div class="section">
<h1 id="the-vs-code-debug-protocol">
The VS Code Debug Protocol
</h1>
<p>
Since Visual Studio Code implements a language agnostic debug
UI, it does not communicate directly with real debuggers but
instead talks to so-called <em>debug adapters</em> through an
abstract wire protocol, the <em>VS Code Debug Protocol</em>.
</p>
<p>
<img
alt="Debugger Architecture"
src="../images/api-debugging/debug-arch.png"
/>
</p>
<p>
Extensibility of the debug component of VS Code is currently
limited to adding new debug adapters. So it is not (yet)
possible to extend the debugger UI in similar ways as for
example the editor component of VS Code.
</p>
<h2 id="debug-adapter">Debug Adapter</h2>
<p>
A debug adapter is a standalone executable that talks to a
real debugger and translates between the VS Code Debug
Protocol and the concrete protocol of the debugger. Since a
debug adapter can be implemented in the language that is best
suited or a given debugger or runtime, the wire protocol is
more important than the API of a particular client library
that implements that protocol.
</p>
<p>
You can find the VS Code Debug Protocol specification
expressed as a
<a
href="https://github.com/Microsoft/vscode-debugadapter-node/blob/master/debugProtocol.json"
>JSON schema</a
>
or as a (generated)
<a
href="https://github.com/Microsoft/vscode-debugadapter-node/blob/master/protocol/src/debugProtocol.ts"
>TypeScript definition</a
>
file in the
<a
href="https://github.com/Microsoft/vscode-debugadapter-node"
><code>vscode-debugadapter-node</code></a
>
repository. Both files show the detailed structure of the
individual protocol requests, responses and events. The
protocol is also available as the NPM module
<a href="https://www.npmjs.com/package/vscode-debugprotocol"
><code>vscode-debugprotocol</code></a
>.
</p>
<p>
We have implemented client libraries for the VS Code Debug
Protocol in TypeScript and C#, but only the
JavaScript/TypeScript client library is already available as
an NPM module
<a
href="https://github.com/Microsoft/vscode-debugadapter-node"
><code>vscode-debugadapter-node</code></a
>. You can find the C# client library in the
<a
href="https://github.com/Microsoft/vscode-mono-debug/blob/master/src/DebugSession.cs"
>Mono Debug</a
>
repository.
</p>
<p>
The following debugger extension projects can serve as
examples for how to implement debug adapters:
</p>
<table>
<thead>
<tr>
<th>GitHub Project</th>
<th>Description</th>
<th>Implementation Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a
href="https://github.com/Microsoft/vscode-node-debug.git"
>Node Debug</a
>
</td>
<td>The built-in v8-based Node.js debugger</td>
<td>TypeScript/JavaScript</td>
</tr>
<tr>
<td>
<a
href="https://github.com/Microsoft/vscode-node-debug2.git"
>Node Debug2</a
>
</td>
<td>The built-in CDP-based Node.js debugger</td>
<td>TypeScript/JavaScript</td>
</tr>
<tr>
<td>
<a
href="https://github.com/Microsoft/vscode-mono-debug.git"
>Mono Debug</a
>
</td>
<td>A simple C# debugger for Mono</td>
<td>C#</td>
</tr>
<tr>
<td>
<a
href="https://github.com/Microsoft/vscode-mock-debug.git"
>Mock Debug</a
>
</td>
<td>A 'fake' debugger</td>
<td>TypeScript/JavaScript</td>
</tr>
</tbody>
</table>
<h2 id="the-vs-code-debug-protocol-in-a-nutshell">
The VS Code Debug Protocol in a Nutshell
</h2>
<p>
In this section we give a high-level overview of the
interaction between VS Code and a debug adapter. This should
help you in your implementation of a debug adapter based on
the VS Code Debug Protocol.
</p>
<p>
When a debug sessions starts, VS Code launches the debug
adapter executable and talks to it through <em>stdin</em> and
<em>stdout</em>. VS Code sends an
<strong>initialize</strong> request to configure the adapter
with information about the path format (native or URI) and
whether line and column values are 0 or 1 based. If your
adapter is derived from the TypeScript or C# default
implementation <code>DebugSession</code>, you don't have to
handle the initialize request yourself.
</p>
<p>
Depending on the 'request' attribute used in the launch
configuration created by the user, VS Code either sends a
<em>launch</em> or an <em>attach</em> request. For
<strong>launch</strong> the debug adapter has to launch a
runtime or program so that it can be debugged. If the program
can interact with the user through stdin/stdout, it is
important that the debug adapter launches the program in an
interactive terminal or console. For
<strong>attach</strong> the debug adapter has to attach or
connect to an already running program.
</p>
<p>
Since arguments for both requests are highly dependent on a
specific debug adapter implementation, the VS Code Debug
Protocol does not prescribe any arguments. Instead VS Code
passes all arguments from the user's launch configuration to
the <em>launch</em> or <em>attach</em> requests. A schema for
IntelliSense and hover information for these attributes can be
contributed in the <code>package.json</code> of the debug
adapter extension. This will guide the user when creating or
editing launch configurations.
</p>
<p>
Since VS Code persists breakpoints on behalf of the debug
adapter, it has to register the breakpoints with the debug
adapter when a session starts. Since VS Code does not know
when is a good time for this, the debug adapter is expected to
send an <strong>initialize</strong> event to VS Code to
announce that it is ready to accept breakpoint configuration
requests.
</p>
<p>
VS Code will then send all breakpoints by calling these
breakpoint configuration requests:
</p>
<ul>
<li>
<strong>setBreakpoints</strong> for every source file with
breakpoints,
</li>
<li>
<strong>setFunctionBreakpoints</strong> if the debug adapter
supports function breakpoints,
</li>
<li>
<strong>setExceptionBreakpoints</strong> if the debug
adapter supports any exception options,
</li>
<li>
<strong>configurationDoneRequest</strong> to indicate the
end of the configuration sequence.
</li>
</ul>
<p>
So don't forget to send the <em>initialize</em> event when you
are ready to accept breakpoints. Otherwise persisted
breakpoints are not restored.
</p>
<p>
The <em>setBreakpoint</em> request sets all breakpoints that
exist for a file (so it is not incremental). A simple
implementation of this semantics in the debug adapter is to
clear all breakpoints for a file and then set the breakpoints
specified in the request. <em>setBreakpoints</em> and
<em>setFunctionBreakpoints</em> are expected to return the
'actual' breakpoints and VS Code updates the UI dynamically if
a breakpoint could not be set at the requested position and
was moved by the debugger backend.
</p>
<p>
Whenever the program stops (on program entry, because a
breakpoint was hit, an exception occurred, or the user
requested execution to be paused), the debug adapter has to
send a <strong>stopped</strong> event with the appropriate
reason and thread id. Upon receipt VS Code will first request
the <strong>threads</strong> (see below), and then the
<strong>stacktrace</strong> (a list of stack frames) for the
thread mentioned in the stopped event. If the user then drills
into the stack frame, VS Code first requests the
<strong>scopes</strong> for a stack frame, and then the
<strong>variables</strong> for a scope. If a variable is
itself structured, VS Code requests its properties through
additional <em>variables</em> requests. This leads to the
following hierarchy:
</p>
<pre><code>Threads
Stackframes
Scopes
Variables
...
Variables
</code></pre>
<p>
The VS Code debug UI supports multiple threads (but you are
probably not aware of this if you are only using the Node.js
debugger). Whenever VS Code receives a
<strong>stopped</strong> or a <strong>thread</strong> event,
VS Code requests all <strong>threads</strong> that exist at
that point in time and displays them if there are more than
one. If only one thread is detected, the VS Code UI stays in