Skip to content

Commit 6495d59

Browse files
committed
feat(langserver): added support for GROUP block in RF 7.2
1 parent 98c96f9 commit 6495d59

File tree

1,507 files changed

+181729
-8
lines changed

Some content is hidden

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

1,507 files changed

+181729
-8
lines changed

hatch.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ create-json-schema = "python ./scripts/create_robot_toml_json_schema.py"
4343
generate-rf-options = "python ./scripts/generate_rf_options.py"
4444
install-packages = "python ./scripts/install_packages.py"
4545

46-
[envs.rflatest313]
46+
[envs.rfbeta]
4747
python = "3.13"
48-
extra-dependencies = ["robotframework==7.1"]
48+
extra-dependencies = ["robotframework==7.2b1"]
4949

5050
[envs.rfmaster313]
5151
python = "3.13"
@@ -76,7 +76,7 @@ python = "3.8"
7676

7777
[[envs.devel.matrix]]
7878
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
79-
rf = ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71"]
79+
rf = ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71", "rf72"]
8080

8181
[envs.devel.overrides]
8282
matrix.rf.dependencies = [
@@ -98,14 +98,17 @@ matrix.rf.dependencies = [
9898
{ value = "robotframework>=7.1, <7.2", if = [
9999
"rf71",
100100
] },
101+
{ value = "robotframework>=7.2, <7.3", if = [
102+
"rf72b1",
103+
] },
101104
]
102105

103106
[envs.hatch-test]
104107
dependencies = ["pytest", "pytest-html", "pytest_asyncio>=0.23", "pyyaml"]
105108
pre-install-commands = ["python ./scripts/install_packages.py"]
106109

107110
[[envs.test.matrix]]
108-
rf = ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71"]
111+
rf = ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71", "rf72"]
109112

110113
[envs.test.overrides]
111114
matrix.rf.dependencies = [
@@ -127,6 +130,9 @@ matrix.rf.dependencies = [
127130
{ value = "robotframework>=7.1, <7.2", if = [
128131
"rf71",
129132
] },
133+
{ value = "robotframework>=7.2, <7.3", if = [
134+
"rf72b1",
135+
] },
130136
]
131137

132138
[envs.lint]

packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,18 @@ def get_snippets() -> Dict[str, List[str]]:
261261
"VAR &{}": [r"VAR &{${1}} ${0}"],
262262
}
263263
)
264+
265+
if get_robot_version() >= (7, 2):
266+
__snippets.update(
267+
{
268+
"GROUP": [
269+
"GROUP ${1}",
270+
" $0",
271+
"END",
272+
"",
273+
]
274+
}
275+
)
264276
return __snippets
265277

266278

@@ -283,10 +295,12 @@ def get_reserved_keywords() -> List[str]:
283295
"CONTINUE",
284296
"RETURN",
285297
]
298+
286299
if get_robot_version() >= (7, 0):
287300
__reserved_keywords += ["VAR"]
288-
else:
289-
__reserved_keywords += ["ELIF"]
301+
302+
if get_robot_version() >= (7, 2):
303+
__reserved_keywords += ["GROUP"]
290304

291305
__reserved_keywords = sorted(__reserved_keywords)
292306
return __reserved_keywords

packages/language_server/src/robotcode/language_server/robotframework/parts/folding_range.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def visit_ForLoop(self, node: ast.AST) -> None: # noqa: N802
9797
self.__append(node, kind="for_loop")
9898
self.generic_visit(node)
9999

100+
def visit_Group(self, node: ast.AST) -> None: # noqa: N802
101+
self.__append(node, kind="group")
102+
self.generic_visit(node)
103+
100104
def visit_For(self, node: ast.AST) -> None: # noqa: N802
101105
self.__append(node, kind="for")
102106
self.generic_visit(node)

packages/language_server/src/robotcode/language_server/robotframework/parts/semantic_tokens.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ def generate_mapping(cls) -> Dict[str, Tuple[Enum, Optional[Set[Enum]]]]:
316316
}
317317
)
318318

319+
if get_robot_version() >= (7, 2):
320+
definition.update(
321+
{
322+
frozenset({Token.GROUP}): (RobotSemTokenTypes.CONTROL_FLOW, None),
323+
}
324+
)
319325
result: Dict[str, Tuple[Enum, Optional[Set[Enum]]]] = {}
320326
for k, v in definition.items():
321327
for e in k:

syntaxes/robotframework.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
"control_flow_statements": {
372372
"name": "meta.keyword-call.content.robotframework",
373373
"contentName": "string.unquoted.argument.robotframework",
374-
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(FOR|END|ELSE|TRY|EXCEPT|FINALLY)(?= {2,}| ?\\t ?| ?$)",
374+
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(FOR|GROUP|END|ELSE|TRY|EXCEPT|FINALLY)(?= {2,}| ?\\t ?| ?$)",
375375
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
376376
"beginCaptures": { "1": { "name": "keyword.control.flow.robotframework" } },
377377
"patterns": [

syntaxes/robotframework.tmLanguage.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
"control_flow_statements": {
372372
"name": "meta.keyword-call.content.robotframework",
373373
"contentName": "string.unquoted.argument.robotframework",
374-
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(FOR|END|ELSE|TRY|EXCEPT|FINALLY)(?= {2,}| ?\\t ?| ?$)",
374+
"begin": "^(?!(?: {2,}| ?\\t ?)+(?:(?=[$\\[@&%]|\\.)))(?: {2,}| ?\\t ?)+(FOR|GROUP|END|ELSE|TRY|EXCEPT|FINALLY)(?= {2,}| ?\\t ?| ?$)",
375375
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
376376
"beginCaptures": { "1": { "name": "keyword.control.flow.robotframework" } },
377377
"patterns": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 5
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 39
17+
- 0
18+
- 0
19+
- 9
20+
- 9
21+
- 36
22+
- 0
23+
- 1
24+
- 8
25+
- 5
26+
- 39
27+
- 0
28+
- 1
29+
- 4
30+
- 3
31+
- 39
32+
- 0
33+
- 2
34+
- 4
35+
- 5
36+
- 39
37+
- 0
38+
- 0
39+
- 9
40+
- 11
41+
- 36
42+
- 0
43+
- 1
44+
- 8
45+
- 6
46+
- 39
47+
- 0
48+
- 1
49+
- 8
50+
- 5
51+
- 39
52+
- 0
53+
- 0
54+
- 9
55+
- 5
56+
- 36
57+
- 0
58+
- 1
59+
- 12
60+
- 6
61+
- 39
62+
- 0
63+
- 2
64+
- 8
65+
- 3
66+
- 39
67+
- 0
68+
- 2
69+
- 4
70+
- 3
71+
- 39
72+
- 0
73+
result_id: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 5
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 39
17+
- 0
18+
- 0
19+
- 9
20+
- 9
21+
- 36
22+
- 0
23+
- 1
24+
- 8
25+
- 5
26+
- 39
27+
- 0
28+
- 1
29+
- 4
30+
- 3
31+
- 39
32+
- 0
33+
- 2
34+
- 4
35+
- 5
36+
- 39
37+
- 0
38+
- 0
39+
- 9
40+
- 11
41+
- 36
42+
- 0
43+
- 1
44+
- 8
45+
- 6
46+
- 39
47+
- 0
48+
- 1
49+
- 8
50+
- 5
51+
- 39
52+
- 0
53+
- 0
54+
- 9
55+
- 5
56+
- 36
57+
- 0
58+
- 1
59+
- 12
60+
- 6
61+
- 39
62+
- 0
63+
- 2
64+
- 8
65+
- 3
66+
- 39
67+
- 0
68+
- 2
69+
- 4
70+
- 3
71+
- 39
72+
- 0
73+
result_id: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 5
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 39
17+
- 0
18+
- 0
19+
- 9
20+
- 9
21+
- 36
22+
- 0
23+
- 1
24+
- 8
25+
- 5
26+
- 39
27+
- 0
28+
- 1
29+
- 4
30+
- 3
31+
- 39
32+
- 0
33+
- 2
34+
- 4
35+
- 5
36+
- 39
37+
- 0
38+
- 0
39+
- 9
40+
- 11
41+
- 36
42+
- 0
43+
- 1
44+
- 8
45+
- 6
46+
- 39
47+
- 0
48+
- 1
49+
- 8
50+
- 5
51+
- 39
52+
- 0
53+
- 0
54+
- 9
55+
- 5
56+
- 36
57+
- 0
58+
- 1
59+
- 12
60+
- 6
61+
- 39
62+
- 0
63+
- 2
64+
- 8
65+
- 3
66+
- 39
67+
- 0
68+
- 2
69+
- 4
70+
- 3
71+
- 39
72+
- 0
73+
result_id: null

0 commit comments

Comments
 (0)