Skip to content

Commit 12308bb

Browse files
committed
feat: language server now is a robotcode cli plugin and can use config files and execution profiles
1 parent deb1aeb commit 12308bb

File tree

25 files changed

+296
-503
lines changed

25 files changed

+296
-503
lines changed

.vscode/launch.json

Lines changed: 5 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,6 @@
5757
"."
5858
]
5959
},
60-
{
61-
"name": "Python: RobotCode Tool",
62-
"type": "python",
63-
"request": "launch",
64-
"program": "${workspaceFolder}/bundled/tool/robotcode",
65-
"justMyCode": false,
66-
"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data",
67-
// "env": {
68-
// "ROBOTCODE_COLOR": "1",
69-
// },
70-
"env": {
71-
"CMD_VAR_LONG": "long",
72-
},
73-
"args": [
74-
"--verbose",
75-
"debug-launch",
76-
"--pipe-server",
77-
"\\\\.\\pipe\\926ab05cd224ef08dc3aec29eda1ba61"
78-
]
79-
},
8060
{
8161
"name": "Python: Attach using Process Id",
8262
"type": "python",
@@ -157,110 +137,15 @@
157137
"cwd": "${workspaceFolder}",
158138
},
159139
{
160-
"name": "Python: robotcode.debugger",
140+
"name": "Python: robotcode language_server",
161141
"type": "python",
162142
"request": "launch",
163-
"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data",
164-
"module": "robotcode.debugger",
165-
"justMyCode": false,
166-
"args": [
167-
"-p",
168-
"6612",
169-
"-b",
170-
"localhost",
171-
"-b",
172-
"192.168.178.83",
173-
"-w",
174-
"--",
175-
"-d",
176-
"results",
177-
"-P",
178-
"./lib",
179-
"-P",
180-
"./resources",
181-
//"C:\\tmp\\robottest\\tests\\bdd_style.robot"
182-
"."
183-
]
184-
},
185-
{
186-
"name": "Python: robotcode.debugger.launcher tcp",
187-
"type": "python",
188-
"request": "launch",
189-
"module": "robotcode.debugger.launcher",
190-
"justMyCode": false,
191-
"args": [
192-
"--mode",
193-
"tcp",
194-
"--call-tracing",
195-
"--log-config",
196-
"log.ini"
197-
]
198-
},
199-
{
200-
"name": "Python: robotcode.debugger.launcher stdio",
201-
"type": "python",
202-
"request": "launch",
203-
"module": "robotcode.debugger.launcher",
204-
"justMyCode": false,
205-
"args": [
206-
"--mode",
207-
"stdio"
208-
]
209-
},
210-
{
211-
"name": "Python: robotcode.language_server tcp",
212-
"type": "python",
213-
"request": "launch",
214-
"module": "robotcode.language_server",
215-
"justMyCode": false,
216-
"args": [
217-
"--mode",
218-
"tcp",
219-
"--log",
220-
"--log-level",
221-
"TRACE",
222-
//"--log-json-rpc-data",
223-
"--log-json-rpc",
224-
//"--log-language-server",
225-
//"--log-robotframework",
226-
//"--debug-asyncio",
227-
//"--log-asyncio"
228-
//"--call-tracing",
229-
// "--log-config",
230-
// "log.ini"
231-
]
232-
},
233-
{
234-
"name": "Python: robotcode.language_server stdio",
235-
"type": "python",
236-
"request": "launch",
237-
"module": "robotcode.language_server",
238-
"justMyCode": false,
239-
"args": [
240-
"--mode",
241-
"stdio",
242-
"--log",
243-
"--log-level",
244-
"TRACE",
245-
"--call-tracing",
246-
"--log-json-rpc",
247-
"--log-json-rpc-data",
248-
"--log-language-server",
249-
"--log-language-server-parts",
250-
"--log-robotframework",
251-
"--log-asyncio",
252-
"--debug-asyncio"
253-
]
254-
},
255-
{
256-
"name": "Python: robot.libdoc",
257-
"type": "python",
258-
"request": "launch",
259-
"module": "robot.libdoc",
143+
"module": "robotcode.cli",
260144
"justMyCode": false,
261145
"args": [
262-
"./playground/second.py",
263-
"list",
146+
"language-server",
147+
"--stdio",
148+
"${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data/tests"
264149
]
265150
},
266151
{

bundled/tool/language_server/__init__.py

Whitespace-only changes.

bundled/tool/language_server/__main__.py

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

package-lock.json

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

package.json

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,22 @@
330330
"items": {
331331
"type": "string"
332332
},
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.",
333+
"markdownDescription": "Specifies extra arguments to be passed to the `robotcode` command line tool (i.e.: [`--log`, `--log-level=TRACE`, `--log-calls`]).",
334+
"scope": "resource"
335+
},
336+
"robotcode.profiles": {
337+
"type": "array",
338+
"default": [],
339+
"items": {
340+
"type": "string"
341+
},
342+
"markdownDescription": "Specifies the execution profiles to be used. Corresponds to the '--profile' option of `robotcode` commandline tool.",
334343
"scope": "resource"
335344
},
336345
"robotcode.python": {
337346
"type": "string",
338347
"default": "",
339-
"description": "Specifies the python executable to be used for RobotCode. If no path is specified, try to get it from \"python\" extension. Requires a VSCode restart to take effect.",
348+
"description": "Specifies the python executable to be used for RobotCode. If no path is specified, try to get it from \"python\" extension.",
340349
"scope": "resource"
341350
},
342351
"robotcode.editor.4SpacesTab": {
@@ -347,7 +356,7 @@
347356
"robotcode.languageServer.mode": {
348357
"type": "string",
349358
"default": "pipe",
350-
"description": "Specifies the mode the language server is started. Requires a VSCode restart to take effect.",
359+
"description": "Specifies the mode the language server is started.",
351360
"enum": [
352361
"stdio",
353362
"pipe",
@@ -359,22 +368,13 @@
359368
"robotcode.languageServer.tcpPort": {
360369
"type": "number",
361370
"default": 0,
362-
"description": "If the port is specified, connect to the language server previously started at the given port. Requires a VSCode restart to take effect.",
363-
"scope": "resource"
364-
},
365-
"robotcode.languageServer.args": {
366-
"type": "array",
367-
"default": [],
368-
"items": {
369-
"type": "string"
370-
},
371-
"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.",
371+
"description": "If the port is specified, connect to the language server previously started at the given port.",
372372
"scope": "resource"
373373
},
374374
"robotcode.debugLauncher.mode": {
375375
"type": "string",
376376
"default": "stdio",
377-
"description": "Specifies the mode the debug launcher is started. Requires a VSCode restart to take effect.",
377+
"description": "Specifies the mode the debug launcher is started.",
378378
"enum": [
379379
"stdio",
380380
"tcp",
@@ -390,13 +390,13 @@
390390
"robotcode.debugLauncher.tcpPort": {
391391
"type": "number",
392392
"default": 0,
393-
"description": "If the port is specified, connect to the debug adapter previously started at the given port. Requires a VSCode restart to take effect.",
393+
"description": "If the port is specified, connect to the debug adapter previously started at the given port.",
394394
"scope": "resource"
395395
},
396396
"robotcode.debugLauncher.host": {
397397
"type": "string",
398398
"default": null,
399-
"description": "If the host is specified, connect to the debug adapter previously started at the given host. Requires a VSCode restart to take effect.",
399+
"description": "If the host is specified, connect to the debug adapter previously started at the given host.",
400400
"scope": "resource"
401401
},
402402
"robotcode.debugLauncher.args": {
@@ -405,7 +405,7 @@
405405
"items": {
406406
"type": "string"
407407
},
408-
"markdownDescription": "Specifies the arguments to be passed to the debug adapter. Requires a VSCode restart to take effect.",
408+
"markdownDescription": "Specifies the arguments to be passed to the debug adapter.",
409409
"scope": "resource"
410410
},
411411
"robotcode.robot.args": {
@@ -544,15 +544,6 @@
544544
"description": "Defines if the report or log file should be opened after a run.",
545545
"scope": "resource"
546546
},
547-
"robotcode.run.profiles": {
548-
"type": "array",
549-
"default": [],
550-
"items": {
551-
"type": "string"
552-
},
553-
"markdownDescription": "Specifies the profiles to be used for execution. Corresponds to the '--profile' option of __robotcode__.",
554-
"scope": "resource"
555-
},
556547
"robotcode.debug.defaultConfiguration": {
557548
"type": "object",
558549
"default": {},

packages/core/src/robotcode/core/dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def from_dict(
332332
return cast(_T, v)
333333

334334
raise TypeError(
335-
f"Cant convert value {value!r} of type {type(value).__name__} to type(s) "
335+
"Value must be of type `"
336336
+ (
337337
repr(types[0])
338338
if len(types) == 1
@@ -347,7 +347,7 @@ def from_dict(
347347
for e in types
348348
)
349349
)
350-
+ "."
350+
+ f"` but is `{type(value).__name__}`."
351351
)
352352

353353

packages/language_server/pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ classifiers = [
2525
"Framework :: Robot Framework",
2626
"Framework :: Robot Framework :: Tool",
2727
]
28-
dependencies = ["robotframework>=4.1.0", "robotcode-jsonrpc2==0.38.0"]
28+
dependencies = [
29+
"robotframework>=4.1.0",
30+
"robotcode-jsonrpc2==0.38.0",
31+
"robotcode==0.38.0",
32+
]
2933
dynamic = ["version"]
3034

31-
[project.scripts]
32-
'robotcode.language_server' = 'robotcode.language_server.__main__:main'
35+
[project.entry-points.robotcode]
36+
langserver = "robotcode.language_server.hooks"
3337

3438
[project.urls]
3539
Homepage = "https://robotcode.io"

packages/language_server/src/robotcode/language_server/__main__.py

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

0 commit comments

Comments
 (0)