Skip to content

Commit 0ce5446

Browse files
committed
fix(langserver): corrected highlightning of embedded arguments if there is a namespace given before the keyword
fixes #434
1 parent d5f1972 commit 0ce5446

File tree

94 files changed

+1446
-157
lines changed

Some content is hidden

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

94 files changed

+1446
-157
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def generate_sem_sub_tokens(
528528
Token.ARGUMENT,
529529
token.value[arg_start:arg_end],
530530
token.lineno,
531-
token.col_offset + arg_start,
531+
token.col_offset + kw_index + arg_start,
532532
)
533533

534534
for sub_token in ModelHelper.tokenize_variables(

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_semantic_tokens.test[sematic_tokenizing.robot].out

+70
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ result: !SemanticTokens
22
data:
33
- 0
44
- 0
5+
- 16
6+
- 27
7+
- 0
8+
- 1
9+
- 0
10+
- 8
11+
- 24
12+
- 0
13+
- 0
14+
- 12
15+
- 22
16+
- 51
17+
- 0
18+
- 2
19+
- 0
520
- 18
621
- 29
722
- 0
@@ -152,6 +167,61 @@ result: !SemanticTokens
152167
- 0
153168
- 2
154169
- 0
170+
- 27
171+
- 33
172+
- 1
173+
- 1
174+
- 4
175+
- 3
176+
- 39
177+
- 0
178+
- 0
179+
- 3
180+
- 4
181+
- 36
182+
- 2048
183+
- 0
184+
- 5
185+
- 5
186+
- 39
187+
- 0
188+
- 0
189+
- 5
190+
- 5
191+
- 36
192+
- 2048
193+
- 1
194+
- 4
195+
- 13
196+
- 51
197+
- 0
198+
- 0
199+
- 13
200+
- 1
201+
- 21
202+
- 0
203+
- 0
204+
- 1
205+
- 3
206+
- 39
207+
- 0
208+
- 0
209+
- 3
210+
- 4
211+
- 36
212+
- 2048
213+
- 0
214+
- 5
215+
- 5
216+
- 39
217+
- 0
218+
- 0
219+
- 5
220+
- 5
221+
- 36
222+
- 2048
223+
- 2
224+
- 0
155225
- 16
156226
- 32
157227
- 0

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_workspace_symbols.test[].out

+78-18
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,51 @@ result:
13791379
uri: duplicated_resources.robot
13801380
name: first
13811381
tags: null
1382+
- !WorkspaceSymbol
1383+
container_name: embedded_args
1384+
data: null
1385+
kind: 13
1386+
location:
1387+
range:
1388+
end:
1389+
character: 10
1390+
line: 1
1391+
start:
1392+
character: 3
1393+
line: 1
1394+
uri: embedded_args.resource
1395+
name: ${task}
1396+
tags: null
1397+
- !WorkspaceSymbol
1398+
container_name: embedded_args
1399+
data: null
1400+
kind: 13
1401+
location:
1402+
range:
1403+
end:
1404+
character: 24
1405+
line: 1
1406+
start:
1407+
character: 16
1408+
line: 1
1409+
uri: embedded_args.resource
1410+
name: ${thing}
1411+
tags: null
1412+
- !WorkspaceSymbol
1413+
container_name: embedded_args
1414+
data: null
1415+
kind: 12
1416+
location:
1417+
range:
1418+
end:
1419+
character: 24
1420+
line: 1
1421+
start:
1422+
character: 0
1423+
line: 1
1424+
uri: embedded_args.resource
1425+
name: do ${task} with ${thing}
1426+
tags: null
13821427
- !WorkspaceSymbol
13831428
container_name: embedded_keywords
13841429
data: null
@@ -4478,10 +4523,10 @@ result:
44784523
range:
44794524
end:
44804525
character: 23
4481-
line: 24
4526+
line: 31
44824527
start:
44834528
character: 19
4484-
line: 24
4529+
line: 31
44854530
uri: sematic_tokenizing.robot
44864531
name: ${a}
44874532
tags: null
@@ -4493,10 +4538,10 @@ result:
44934538
range:
44944539
end:
44954540
character: 31
4496-
line: 24
4541+
line: 31
44974542
start:
44984543
character: 27
4499-
line: 24
4544+
line: 31
45004545
uri: sematic_tokenizing.robot
45014546
name: ${b}
45024547
tags: null
@@ -4508,10 +4553,10 @@ result:
45084553
range:
45094554
end:
45104555
character: 39
4511-
line: 24
4556+
line: 31
45124557
start:
45134558
character: 35
4514-
line: 24
4559+
line: 31
45154560
uri: sematic_tokenizing.robot
45164561
name: ${c}
45174562
tags: null
@@ -4523,10 +4568,10 @@ result:
45234568
range:
45244569
end:
45254570
character: 26
4526-
line: 19
4571+
line: 26
45274572
start:
45284573
character: 19
4529-
line: 19
4574+
line: 26
45304575
uri: sematic_tokenizing.robot
45314576
name: ${type}
45324577
tags: null
@@ -4538,10 +4583,10 @@ result:
45384583
range:
45394584
end:
45404585
character: 40
4541-
line: 1
4586+
line: 4
45424587
start:
45434588
character: 0
4544-
line: 1
4589+
line: 4
45454590
uri: sematic_tokenizing.robot
45464591
name: Continue when iteration limit is reached
45474592
tags: null
@@ -4553,10 +4598,10 @@ result:
45534598
range:
45544599
end:
45554600
character: 24
4556-
line: 7
4601+
line: 10
45574602
start:
45584603
character: 0
4559-
line: 7
4604+
line: 10
45604605
uri: sematic_tokenizing.robot
45614606
name: Limit as iteration count
45624607
tags: null
@@ -4568,13 +4613,28 @@ result:
45684613
range:
45694614
end:
45704615
character: 12
4571-
line: 18
4616+
line: 25
45724617
start:
45734618
character: 0
4574-
line: 18
4619+
line: 25
45754620
uri: sematic_tokenizing.robot
45764621
name: do something
45774622
tags: null
4623+
- !WorkspaceSymbol
4624+
container_name: sematic_tokenizing
4625+
data: null
4626+
kind: 5
4627+
location:
4628+
range:
4629+
end:
4630+
character: 27
4631+
line: 20
4632+
start:
4633+
character: 0
4634+
line: 20
4635+
uri: sematic_tokenizing.robot
4636+
name: some embedded args keywords
4637+
tags: null
45784638
- !WorkspaceSymbol
45794639
container_name: sematic_tokenizing
45804640
data: null
@@ -4583,10 +4643,10 @@ result:
45834643
range:
45844644
end:
45854645
character: 14
4586-
line: 12
4646+
line: 15
45874647
start:
45884648
character: 0
4589-
line: 12
4649+
line: 15
45904650
uri: sematic_tokenizing.robot
45914651
name: some templated
45924652
tags: null
@@ -4598,10 +4658,10 @@ result:
45984658
range:
45994659
end:
46004660
character: 8
4601-
line: 23
4661+
line: 30
46024662
start:
46034663
character: 0
4604-
line: 23
4664+
line: 30
46054665
uri: sematic_tokenizing.robot
46064666
name: template
46074667
tags: null

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_workspace_symbols.test[as].out

+49-4
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,36 @@ result:
359359
uri: duplicated.resource
360360
name: a resource keyword B
361361
tags: null
362+
- !WorkspaceSymbol
363+
container_name: embedded_args
364+
data: null
365+
kind: 13
366+
location:
367+
range:
368+
end:
369+
character: 10
370+
line: 1
371+
start:
372+
character: 3
373+
line: 1
374+
uri: embedded_args.resource
375+
name: ${task}
376+
tags: null
377+
- !WorkspaceSymbol
378+
container_name: embedded_args
379+
data: null
380+
kind: 12
381+
location:
382+
range:
383+
end:
384+
character: 24
385+
line: 1
386+
start:
387+
character: 0
388+
line: 1
389+
uri: embedded_args.resource
390+
name: do ${task} with ${thing}
391+
tags: null
362392
- !WorkspaceSymbol
363393
container_name: embedded_keywords
364394
data: null
@@ -877,10 +907,10 @@ result:
877907
range:
878908
end:
879909
character: 40
880-
line: 1
910+
line: 4
881911
start:
882912
character: 0
883-
line: 1
913+
line: 4
884914
uri: sematic_tokenizing.robot
885915
name: Continue when iteration limit is reached
886916
tags: null
@@ -892,13 +922,28 @@ result:
892922
range:
893923
end:
894924
character: 24
895-
line: 7
925+
line: 10
896926
start:
897927
character: 0
898-
line: 7
928+
line: 10
899929
uri: sematic_tokenizing.robot
900930
name: Limit as iteration count
901931
tags: null
932+
- !WorkspaceSymbol
933+
container_name: sematic_tokenizing
934+
data: null
935+
kind: 5
936+
location:
937+
range:
938+
end:
939+
character: 27
940+
line: 20
941+
start:
942+
character: 0
943+
line: 20
944+
uri: sematic_tokenizing.robot
945+
name: some embedded args keywords
946+
tags: null
902947
- !WorkspaceSymbol
903948
container_name: some_tasks
904949
data: null

0 commit comments

Comments
 (0)