@@ -370,6 +370,26 @@ async def generate_sem_tokens(
370
370
resources_matchers : Container [KeywordMatcher ],
371
371
) -> AsyncGenerator [SemTokenInfo , None ]:
372
372
from robot .parsing .lexer .tokens import Token as RobotToken
373
+ from robot .parsing .model .statements import Fixture , KeywordCall
374
+ from robot .utils .escaping import split_from_equals
375
+
376
+ if token .type in {RobotToken .ARGUMENT } and isinstance (node , (KeywordCall , Fixture )):
377
+ name , value = split_from_equals (token .value )
378
+ if value is not None :
379
+ if isinstance (node , KeywordCall ):
380
+ doc = await namespace .find_keyword (node .keyword )
381
+ elif isinstance (node , Fixture ):
382
+ doc = await namespace .find_keyword (node .name )
383
+ else :
384
+ doc = None
385
+
386
+ if doc and any (v for v in doc .args if v .name == name ):
387
+ length = len (name )
388
+ yield SemTokenInfo .from_token (token , RobotSemTokenTypes .VARIABLE , length = length )
389
+ yield SemTokenInfo .from_token (
390
+ token , SemanticTokenTypes .OPERATOR , col_offset = token .col_offset + length , length = 1
391
+ )
392
+ token = RobotToken (token .type , value , token .lineno , token .col_offset + length + 1 , token .error )
373
393
374
394
if token .type in {* RobotToken .ALLOW_VARIABLES , RobotToken .KEYWORD , ROBOT_KEYWORD_INNER }:
375
395
@@ -499,7 +519,7 @@ async def generate_run_kw_if() -> AsyncGenerator[Tuple[Token, ast.AST], None]:
499
519
500
520
yield arguments [0 ], node ,
501
521
arguments = arguments [1 :]
502
- has_separator = False
522
+
503
523
while arguments :
504
524
async for b in skip_non_data_tokens ():
505
525
yield b
@@ -553,11 +573,9 @@ async def generate_run_kw_if() -> AsyncGenerator[Tuple[Token, ast.AST], None]:
553
573
if separator_token is not None :
554
574
args = arguments [: arguments .index (separator_token )]
555
575
arguments = arguments [arguments .index (separator_token ) :]
556
- has_separator = True
557
576
else :
558
- if has_separator :
559
- args = arguments
560
- arguments = []
577
+ args = arguments
578
+ arguments = []
561
579
562
580
async for e in self .generate_run_kw_tokens (
563
581
namespace ,
0 commit comments