@@ -35,3 +35,57 @@ you'll need to make the library available within the Python environment that you
35
35
3 . Run ` pip install sr.robot3 ` .
36
36
37
37
[ code-completion ] : https://en.wikipedia.org/wiki/Autocomplete#In_source_code_editors
38
+
39
+ ## Remote Debugging
40
+
41
+ <div class =" info " >
42
+ This documentation refers to a feature which is only available from software version <code >2023.1.0</code > and later.
43
+ </div >
44
+
45
+ When connected to the [ robot's WiFi hotspot] ({{ site.baseurl }}/kit/wifi), it is possible to attach VS Code's
46
+ debugger to the robot by performing the following steps:
47
+
48
+ 1 . Ensure the [ Python extension] ( #python-extension ) is installed.
49
+ 2 . Open the Run and Debug panel.
50
+ 3 . Click the cog icon at the top of the panel.
51
+ 4 . Paste the following configuration:
52
+ ``` json
53
+ {
54
+ "version" : " 0.2.0" ,
55
+ "configurations" : [
56
+ {
57
+ "name" : " Attach to Robot" ,
58
+ "type" : " python" ,
59
+ "request" : " attach" ,
60
+ "connect" : {
61
+ "host" : " robot.lan" ,
62
+ "port" : 5678
63
+ },
64
+ "pathMappings" : [
65
+ {
66
+ "localRoot" : " ${workspaceFolder}" ,
67
+ "remoteRoot" : " ."
68
+ }
69
+ ],
70
+ "justMyCode" : true
71
+ }
72
+ ]
73
+ }
74
+ ```
75
+ 5 . Add the following snippet to the top of your code:
76
+ ``` python
77
+ import debugpy
78
+ debugpy.listen((" 0.0.0.0" , 5678 ))
79
+ ```
80
+
81
+ If you would like for your code to not run until the debugger is attached, you can also add the following:
82
+ ``` python
83
+ print (" Waiting for debugger..." )
84
+ debugpy.wait_for_client()
85
+ ```
86
+
87
+ 6 . In order to debug, you can now either click the green play button at the top of the Run and Debug panel or press <kbd >F5</kbd >.
88
+
89
+ For more information on debugging with Visual Studio Code, please visit the [ VS Code documentation] [ vs-code-debug-docs ]
90
+
91
+ [ vs-code-debug-docs ] : https://code.visualstudio.com/Docs/editor/debugging
0 commit comments