Skip to content

Commit d5a9339

Browse files
committed
feat(langserver): corrected and generalized semantic tokenizing if OPTION tokens in except and while statements
closes: #306
1 parent ecb5ec9 commit d5a9339

File tree

7 files changed

+417
-6
lines changed

7 files changed

+417
-6
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,7 @@ def generate_sem_sub_tokens(
543543
length,
544544
)
545545
elif get_robot_version() >= (5, 0) and token.type == Token.OPTION:
546-
if (
547-
isinstance(node, ExceptHeader)
548-
and token.value.startswith("type=")
549-
or isinstance(node, WhileHeader)
550-
and token.value.startswith("limit=")
551-
):
546+
if (isinstance(node, ExceptHeader) or isinstance(node, WhileHeader)) and "=" in token.value:
552547
if col_offset is None:
553548
col_offset = token.col_offset
554549

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 40
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 39
17+
- 0
18+
- 0
19+
- 17
20+
- 5
21+
- 54
22+
- 0
23+
- 0
24+
- 5
25+
- 1
26+
- 21
27+
- 0
28+
- 0
29+
- 6
30+
- 8
31+
- 54
32+
- 0
33+
- 0
34+
- 8
35+
- 1
36+
- 21
37+
- 0
38+
- 1
39+
- 8
40+
- 3
41+
- 39
42+
- 1024
43+
- 1
44+
- 4
45+
- 3
46+
- 39
47+
- 0
48+
- 1
49+
- 4
50+
- 3
51+
- 39
52+
- 1024
53+
- 2
54+
- 0
55+
- 24
56+
- 33
57+
- 1
58+
- 1
59+
- 4
60+
- 5
61+
- 39
62+
- 0
63+
- 0
64+
- 17
65+
- 5
66+
- 54
67+
- 0
68+
- 0
69+
- 5
70+
- 1
71+
- 21
72+
- 0
73+
- 0
74+
- 9
75+
- 16
76+
- 54
77+
- 0
78+
- 0
79+
- 16
80+
- 1
81+
- 21
82+
- 0
83+
- 1
84+
- 8
85+
- 3
86+
- 39
87+
- 1024
88+
- 1
89+
- 4
90+
- 3
91+
- 39
92+
- 0
93+
result_id: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 40
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 35
17+
- 0
18+
- 1
19+
- 8
20+
- 3
21+
- 39
22+
- 1024
23+
- 1
24+
- 4
25+
- 3
26+
- 35
27+
- 0
28+
- 1
29+
- 4
30+
- 3
31+
- 39
32+
- 1024
33+
- 2
34+
- 0
35+
- 24
36+
- 33
37+
- 1
38+
- 1
39+
- 4
40+
- 5
41+
- 35
42+
- 0
43+
- 1
44+
- 8
45+
- 3
46+
- 39
47+
- 1024
48+
- 1
49+
- 4
50+
- 3
51+
- 35
52+
- 0
53+
result_id: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 40
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 35
17+
- 0
18+
- 1
19+
- 8
20+
- 3
21+
- 39
22+
- 1024
23+
- 1
24+
- 4
25+
- 3
26+
- 35
27+
- 0
28+
- 1
29+
- 4
30+
- 3
31+
- 39
32+
- 1024
33+
- 2
34+
- 0
35+
- 24
36+
- 33
37+
- 1
38+
- 1
39+
- 4
40+
- 5
41+
- 35
42+
- 0
43+
- 1
44+
- 8
45+
- 3
46+
- 39
47+
- 1024
48+
- 1
49+
- 4
50+
- 3
51+
- 35
52+
- 0
53+
result_id: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
result: !SemanticTokens
2+
data:
3+
- 0
4+
- 0
5+
- 18
6+
- 29
7+
- 0
8+
- 1
9+
- 0
10+
- 40
11+
- 33
12+
- 1
13+
- 1
14+
- 4
15+
- 5
16+
- 35
17+
- 0
18+
- 0
19+
- 17
20+
- 5
21+
- 38
22+
- 0
23+
- 0
24+
- 5
25+
- 1
26+
- 21
27+
- 0
28+
- 0
29+
- 1
30+
- 1
31+
- 35
32+
- 0
33+
- 0
34+
- 5
35+
- 13
36+
- 35
37+
- 0
38+
- 1
39+
- 8
40+
- 3
41+
- 39
42+
- 1024
43+
- 1
44+
- 4
45+
- 3
46+
- 35
47+
- 0
48+
- 1
49+
- 4
50+
- 3
51+
- 39
52+
- 1024
53+
- 2
54+
- 0
55+
- 24
56+
- 33
57+
- 1
58+
- 1
59+
- 4
60+
- 5
61+
- 35
62+
- 0
63+
- 0
64+
- 17
65+
- 5
66+
- 38
67+
- 0
68+
- 0
69+
- 5
70+
- 1
71+
- 21
72+
- 0
73+
- 0
74+
- 1
75+
- 4
76+
- 35
77+
- 0
78+
- 0
79+
- 8
80+
- 48
81+
- 35
82+
- 0
83+
- 1
84+
- 8
85+
- 3
86+
- 39
87+
- 1024
88+
- 1
89+
- 4
90+
- 3
91+
- 35
92+
- 0
93+
result_id: null

0 commit comments

Comments
 (0)