Skip to content

Commit 69131e6

Browse files
committed
feat(debugger): refactored robotcode debugger to support debugging/running tests with robotcode's configurations and profiles, also command line tool changes.
The command line `robotcode.debugger` is deprectated and do not support configs and profiles, to use the full feature set use `robotcode debug` to start the debug server. By default `robotcode debug` starts a debug session and waits for incoming connections.
1 parent 114866b commit 69131e6

File tree

54 files changed

+1806
-1195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1806
-1195
lines changed

.vscode/launch.json

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,33 @@
5252
},
5353
"args": [
5454
"--verbose",
55-
// "--dry",
56-
// "-p",
57-
// "firefox",
58-
// "--dry",
59-
// "robot",
60-
// "--",
61-
// "--help"
62-
// "tests1"
63-
// "profiles",
64-
// "show",
65-
// "list",
66-
// "--format",
67-
// "toml"
68-
"robot",
69-
"-t", "first",
70-
"-ZLN", "Data.Tests.Playground.first",
71-
"--name", "blahblah",
72-
"-ZLN", "Data.Tests.Playground.second",
73-
"--doc", "uchda",
74-
"-ZEL", "Data.Tests.Playground.third",
75-
"."
55+
// "robot"
56+
// "debug-launch",
57+
// "--pipe-server",
58+
// "\\\\.\\pipe\\926ab05cd224ef08dc3aec29eda1ba61"
59+
"debug",
60+
"--",
61+
"--help"
62+
]
63+
},
64+
{
65+
"name": "Python: RobotCode Tool",
66+
"type": "python",
67+
"request": "launch",
68+
"program": "${workspaceFolder}/bundled/tool/robotcode",
69+
"justMyCode": false,
70+
"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data",
71+
// "env": {
72+
// "ROBOTCODE_COLOR": "1",
73+
// },
74+
"env": {
75+
"CMD_VAR_LONG": "long",
76+
},
77+
"args": [
78+
"--verbose",
79+
"debug-launch",
80+
"--pipe-server",
81+
"\\\\.\\pipe\\926ab05cd224ef08dc3aec29eda1ba61"
7682
]
7783
},
7884
{

bundled/tool/debugger/__main__.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

bundled/tool/debugger/launcher/__init__.py

Whitespace-only changes.

bundled/tool/debugger/launcher/__main__.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

bundled/tool/robotcode/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ def update_sys_path(path_to_add: str, strategy: str) -> None:
2424

2525
from robotcode.cli import robotcode
2626

27-
sys.exit(robotcode(windows_expand_args=False))
27+
robotcode(
28+
windows_expand_args=False,
29+
default_map={"launcher_script": str(pathlib.Path(__file__).parent)},
30+
)

package-lock.json

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,15 @@
324324
"title": "RobotCode",
325325
"type": "object",
326326
"properties": {
327+
"robotcode.extraArgs": {
328+
"type": "array",
329+
"default": [],
330+
"items": {
331+
"type": "string"
332+
},
333+
"markdownDescription": "Specifies the arguments to be passed to the `robotcode` command line tool (i.e.: [`--log`, `--log-level=TRACE`, `--log-calls`]). Requires a VSCode restart to take effect.",
334+
"scope": "resource"
335+
},
327336
"robotcode.python": {
328337
"type": "string",
329338
"default": "",
@@ -362,35 +371,36 @@
362371
"markdownDescription": "Specifies the arguments to be passed to the language server (i.e.: [`--log`, `--log-file=~/robotcode.log`]). Requires a VSCode restart to take effect.",
363372
"scope": "resource"
364373
},
365-
"robotcode.debugAdapter.mode": {
374+
"robotcode.debugLauncher.mode": {
366375
"type": "string",
367-
"default": "stdio",
376+
"default": "pipe-server",
368377
"description": "Specifies the mode the debug adapter is started. Requires a VSCode restart to take effect.",
369378
"enum": [
370379
"stdio",
371-
"tcp"
380+
"tcp",
381+
"pipe-server"
372382
],
373383
"scope": "resource"
374384
},
375-
"robotcode.debugAdapter.tcpPort": {
385+
"robotcode.debugLauncher.tcpPort": {
376386
"type": "number",
377387
"default": 0,
378388
"description": "If the port is specified, connect to the debug adapter previously started at the given port. Requires a VSCode restart to take effect.",
379389
"scope": "resource"
380390
},
381-
"robotcode.debugAdapter.host": {
391+
"robotcode.debugLauncher.host": {
382392
"type": "string",
383393
"default": null,
384394
"description": "If the host is specified, connect to the debug adapter previously started at the given host. Requires a VSCode restart to take effect.",
385395
"scope": "resource"
386396
},
387-
"robotcode.debugAdapter.args": {
397+
"robotcode.debugLauncher.args": {
388398
"type": "array",
389399
"default": [],
390400
"items": {
391401
"type": "string"
392402
},
393-
"markdownDescription": "Specifies the arguments to be passed to the debug adapter (i.e.: [`--log`, `--log-file=~/debug-adapter.log`]). Requires a VSCode restart to take effect.",
403+
"markdownDescription": "Specifies the arguments to be passed to the debug adapter. Requires a VSCode restart to take effect.",
394404
"scope": "resource"
395405
},
396406
"robotcode.robot.args": {
@@ -849,6 +859,11 @@
849859
"description": "Attach also the python debugger if a robot test starts.",
850860
"default": false
851861
},
862+
"attachPythonPort": {
863+
"type": "number",
864+
"description": "The port the python debugger (debugpy) should use.",
865+
"default": 5678
866+
},
852867
"pythonConfiguration": {
853868
"type": [
854869
"object",
@@ -869,13 +884,21 @@
869884
"markdownDescription": "The `.robot` file or a folder containing `.robot` files to be launched.",
870885
"default": "${file}"
871886
},
887+
"profiles": {
888+
"type": "array",
889+
"default": [],
890+
"items": {
891+
"type": "string"
892+
},
893+
"markdownDescription": "Specifies the profiles to be used for execution. Corresponds to the '--profile' option of __robotcode__."
894+
},
872895
"paths": {
873896
"type": "array",
874897
"default": [],
875898
"items": {
876899
"type": "string"
877900
},
878-
"markdownDescription": "Specifies the paths where robot should discover tests. Corresponds to the 'paths' option of __robot__."
901+
"markdownDescription": "Specifies the paths where robot should discover tests. Corresponds to the 'paths' argument of __robot__."
879902
},
880903
"args": {
881904
"type": "array",
@@ -933,6 +956,11 @@
933956
"description": "Attach also the python debugger if a robot test starts.",
934957
"default": false
935958
},
959+
"attachPythonPort": {
960+
"type": "number",
961+
"description": "The port the python debugger (debugpy) should use.",
962+
"default": 5678
963+
},
936964
"pythonConfiguration": {
937965
"type": [
938966
"object",
@@ -1001,6 +1029,11 @@
10011029
"description": "Timeout the debugger waits for a client connection.",
10021030
"default": 10
10031031
},
1032+
"robotCodeArgs": {
1033+
"type": "array",
1034+
"description": "Extra command line arguments passed to robotcode.",
1035+
"default": []
1036+
},
10041037
"outputDir": {
10051038
"type": "string",
10061039
"default": null,
@@ -1222,7 +1255,6 @@
12221255
"ms-python.python"
12231256
],
12241257
"dependencies": {
1225-
"@vscode/debugadapter": "^1.59.0",
12261258
"ansi-colors": "^4.1.3",
12271259
"vscode-languageclient": "^8.1.0"
12281260
},
@@ -1231,7 +1263,6 @@
12311263
"@types/vscode": "^1.74.0",
12321264
"@typescript-eslint/eslint-plugin": "^5.58.0",
12331265
"@typescript-eslint/parser": "^5.58.0",
1234-
"@vscode/debugadapter-testsupport": "^1.59.0",
12351266
"@vscode/test-electron": "^2.3.0",
12361267
"eslint": "^8.38.0",
12371268
"eslint-config-prettier": "^8.8.0",

packages/analyze/src/robotcode/analyze/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def analyze(
2222
ctx: click.Context,
2323
) -> Union[str, int, None]:
24-
"""Analyzes a Robot Framework project.
24+
"""TODO: Analyzes a Robot Framework project.
2525
2626
TODO: This is not implemented yet.
2727
"""
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from enum import Enum, unique
2+
from typing import NamedTuple, Sequence, Union
3+
4+
5+
@unique
6+
class ServerMode(str, Enum):
7+
STDIO = "stdio"
8+
TCP = "tcp"
9+
SOCKET = "socket"
10+
PIPE = "pipe"
11+
PIPE_SERVER = "pipe-server"
12+
13+
def __str__(self) -> str:
14+
return self.value
15+
16+
def __repr__(self) -> str:
17+
return repr(self.value)
18+
19+
20+
class TcpParams(NamedTuple):
21+
host: Union[str, Sequence[str], None] = None
22+
port: int = 0

packages/debugger/pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,19 @@ classifiers = [
2525
"Framework :: Robot Framework",
2626
"Framework :: Robot Framework :: Tool",
2727
]
28-
dependencies = ["robotcode-jsonrpc2", "robotframework>=4.1.0"]
2928
dynamic = ["version"]
29+
dependencies = [
30+
"robotframework>=4.1.0",
31+
"robotcode-jsonrpc2",
32+
"robotcode-runner",
33+
]
3034

3135
[project.optional-dependencies]
3236
debugpy = ["debugpy"]
3337

38+
[project.entry-points.robotcode]
39+
debugger = "robotcode.debugger.hooks"
40+
3441
[project.scripts]
3542
'robotcode.debugger' = 'robotcode.debugger.__main__:main'
3643

0 commit comments

Comments
 (0)