File tree Expand file tree Collapse file tree 4 files changed +3769
-35
lines changed
packages/language_server/src/robotcode/language_server/robotframework/parts Expand file tree Collapse file tree 4 files changed +3769
-35
lines changed Original file line number Diff line number Diff line change 66 // symbols used as brackets
77 "brackets" : [
88 [" ${{" , " }}" ],
9+ [" &{{" , " }}" ],
10+ [" @{{" , " }}" ],
911 [" ${" , " }" ],
1012 [" @{" , " }" ],
1113 [" %{" , " }" ],
1618 ],
1719 "colorizedBracketPairs" : [
1820 [" ${{" , " }}" ],
21+ [" &{{" , " }}" ],
22+ [" @{{" , " }}" ],
1923 [" ${" , " }" ],
2024 [" @{" , " }" ],
2125 [" %{" , " }" ],
2731 // symbols that are auto closed when typing
2832 "autoClosingPairs" : [
2933 [" ${{" , " }}" ],
34+ [" &{{" , " }}" ],
35+ [" @{{" , " }}" ],
3036 [" ${" , " }" ],
3137 [" @{" , " }" ],
3238 [" %{" , " }" ],
4046 // symbols that can be used to surround a selection
4147 "surroundingPairs" : [
4248 [" ${{" , " }}" ],
49+ [" &{{" , " }}" ],
50+ [" @{{" , " }}" ],
4351 [" ${" , " }" ],
4452 [" @{" , " }" ],
4553 [" %{" , " }" ],
Original file line number Diff line number Diff line change 269269 "variable" : [
270270 " variable.other.readwrite.robotframework"
271271 ],
272+ "variableExpression" : [
273+ " variable.expression.readwrite.robotframework"
274+ ],
272275 "keywordCall" : [
273276 " entity.name.function.keyword-call.robotframework"
274277 ],
339342 "scopeName" : " source.robotframework" ,
340343 "path" : " ./syntaxes/robotframework.tmLanguage.json" ,
341344 "tokenTypes" : {
342- "string.unquoted.argument.robotframework" : " other"
343- },
344- "embeddedLanguages" : {
345- "meta.expression.robotframework" : " python"
345+ "string.unquoted.argument.robotframework" : " other" ,
346+ "variable.expression.robotframework" : " other"
346347 }
347348 }
348349 ],
14811482 "webpack" : " ^5.90.3" ,
14821483 "webpack-cli" : " ^5.1.4"
14831484 }
1484- }
1485+ }
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ class RobotSemTokenTypes(Enum):
109109 FOR_SEPARATOR = "forSeparator"
110110 VARIABLE_BEGIN = "variableBegin"
111111 VARIABLE_END = "variableEnd"
112+ VARIABLE_EXPRESSION = "variableExpression"
112113 ESCAPE = "escape"
113114 NAMESPACE = "namespace"
114115 ERROR = "error"
@@ -355,27 +356,30 @@ def generate_sem_sub_tokens(
355356 length = token .end_col_offset - token .col_offset
356357
357358 last_index = token .value .rfind ("}" )
359+
360+ is_expr = token .value [1 :2 ] == "{" and token .value [last_index - 1 : last_index ] == "}"
361+
358362 if last_index >= 0 :
359363 yield SemTokenInfo (
360364 token .lineno ,
361365 col_offset ,
362- 2 ,
366+ 3 if is_expr else 2 ,
363367 RobotSemTokenTypes .VARIABLE_BEGIN ,
364368 sem_mod ,
365369 )
366370
367- yield SemTokenInfo .from_token (
368- token ,
369- sem_type ,
370- sem_mod ,
371- col_offset + 2 ,
372- last_index - 2 ,
373- )
371+ # yield SemTokenInfo.from_token(
372+ # token,
373+ # RobotSemTokenTypes.VARIABLE_EXPRESSION if is_expr else sem_type,
374+ # sem_mod,
375+ # col_offset + (3 if is_expr else 2) ,
376+ # last_index - (4 if is_expr else 2) ,
377+ # )
374378
375379 yield SemTokenInfo (
376380 token .lineno ,
377- col_offset + last_index ,
378- 1 ,
381+ col_offset + (( last_index - 1 ) if is_expr else last_index ) ,
382+ 2 if is_expr else 1 ,
379383 RobotSemTokenTypes .VARIABLE_END ,
380384 sem_mod ,
381385 )
You can’t perform that action at this time.
0 commit comments