Skip to content

Commit 6db88f2

Browse files
committed
fix(langserver): correct highlightning of embedded keywords arguments
fix #379
1 parent 2f1265a commit 6db88f2

File tree

54 files changed

+143005
-23607
lines changed

Some content is hidden

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

54 files changed

+143005
-23607
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,9 @@ def generate_sem_sub_tokens(
537537
ignore_errors=True,
538538
identifiers="$@&%",
539539
):
540-
for e in self.generate_sem_sub_tokens(namespace, builtin_library_doc, sub_token, node):
540+
for e in self.generate_sem_sub_tokens(
541+
namespace, builtin_library_doc, sub_token, node, yield_arguments=True
542+
):
541543
e.sem_modifiers = {RobotSemTokenModifiers.EMBEDDED}
542544
yield e
543545

syntaxes/robotframework-repl.tmLanguage.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
},
115115
"escape": {
116116
"patterns": [
117+
{
118+
"name": "constant.character.escape.python",
119+
"match": "\\\\[\\$@&%]"
120+
},
117121
{ "include": "#escape-sequence-unicode" },
118122
{ "include": "#escape-sequence" }
119123
]

syntaxes/robotframework.tmLanguage.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
},
115115
"escape": {
116116
"patterns": [
117+
{
118+
"name": "constant.character.escape.python",
119+
"match": "\\\\[\\$@&%]"
120+
},
117121
{ "include": "#escape-sequence-unicode" },
118122
{ "include": "#escape-sequence" }
119123
]
@@ -186,11 +190,7 @@
186190
"testcase_name_def": {
187191
"contentName": "string.unquoted.argument.robotframework",
188192
"begin": "^( ?\\S+( ?\\S*)*?)(?= {2}| ?\\t| ?$)",
189-
"beginCaptures": {
190-
"1": {
191-
"patterns": [ { "include": "#testcase_name" } ]
192-
}
193-
},
193+
"beginCaptures": { "1": { "patterns": [ { "include": "#testcase_name" } ] } },
194194
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
195195
"patterns": [
196196
{ "include": "#escape" },
@@ -204,18 +204,12 @@
204204
"contentName": "entity.name.function.testcase.name.robotframework",
205205
"begin": "",
206206
"while": ".",
207-
"patterns": [
208-
{ "include": "#variables" }
209-
]
207+
"patterns": [ { "include": "#escape" }, { "include": "#variables" } ]
210208
},
211209
"keyword_name_def": {
212210
"contentName": "string.unquoted.argument.robotframework",
213211
"begin": "^( ?\\S+( ?\\S*)*?)(?= {2}| ?\\t| ?$)",
214-
"beginCaptures": {
215-
"1": {
216-
"patterns": [ { "include": "#keyword_name" } ]
217-
}
218-
},
212+
"beginCaptures": { "1": { "patterns": [ { "include": "#keyword_name" } ] } },
219213
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
220214
"patterns": [
221215
{ "include": "#escape" },
@@ -230,6 +224,7 @@
230224
"begin": "",
231225
"while": ".",
232226
"patterns": [
227+
{ "include": "#escape" },
233228
{ "include": "#embedded_argument" }
234229
]
235230
},
@@ -365,7 +360,7 @@
365360
"beginCaptures": {
366361
"1": {
367362
"name": "entity.name.function.keyword-call.robotframework",
368-
"patterns": [ { "include": "#variables" } ]
363+
"patterns": [ { "include": "#escape" }, { "include": "#variables" } ]
369364
}
370365
},
371366
"patterns": [
@@ -383,9 +378,7 @@
383378
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
384379
"beginCaptures": {
385380
"1": { "name": "keyword.control.flow.robotframework" },
386-
"5": {
387-
"patterns": [ { "include": "#expression" } ]
388-
}
381+
"5": { "patterns": [ { "include": "#expression" } ] }
389382
},
390383
"patterns": [
391384
{ "include": "#escape" },

syntaxes/robotframework.tmLanguage.template.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@
114114
},
115115
"escape": {
116116
"patterns": [
117+
{
118+
"name": "constant.character.escape.python",
119+
"match": "\\\\[\\$@&%]"
120+
},
117121
{ "include": "#escape-sequence-unicode" },
118122
{ "include": "#escape-sequence" }
119123
]
@@ -186,11 +190,7 @@
186190
"testcase_name_def": {
187191
"contentName": "string.unquoted.argument.robotframework",
188192
"begin": "^( ?\\S+( ?\\S*)*?)(?= {2}| ?\\t| ?$)",
189-
"beginCaptures": {
190-
"1": {
191-
"patterns": [ { "include": "#testcase_name" } ]
192-
}
193-
},
193+
"beginCaptures": { "1": { "patterns": [ { "include": "#testcase_name" } ] } },
194194
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
195195
"patterns": [
196196
{ "include": "#escape" },
@@ -204,18 +204,12 @@
204204
"contentName": "entity.name.function.testcase.name.robotframework",
205205
"begin": "",
206206
"while": ".",
207-
"patterns": [
208-
{ "include": "#variables" }
209-
]
207+
"patterns": [ { "include": "#escape" }, { "include": "#variables" } ]
210208
},
211209
"keyword_name_def": {
212210
"contentName": "string.unquoted.argument.robotframework",
213211
"begin": "^( ?\\S+( ?\\S*)*?)(?= {2}| ?\\t| ?$)",
214-
"beginCaptures": {
215-
"1": {
216-
"patterns": [ { "include": "#keyword_name" } ]
217-
}
218-
},
212+
"beginCaptures": { "1": { "patterns": [ { "include": "#keyword_name" } ] } },
219213
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
220214
"patterns": [
221215
{ "include": "#escape" },
@@ -230,6 +224,7 @@
230224
"begin": "",
231225
"while": ".",
232226
"patterns": [
227+
{ "include": "#escape" },
233228
{ "include": "#embedded_argument" }
234229
]
235230
},
@@ -365,7 +360,7 @@
365360
"beginCaptures": {
366361
"1": {
367362
"name": "entity.name.function.keyword-call.robotframework",
368-
"patterns": [ { "include": "#variables" } ]
363+
"patterns": [{ "include": "#escape" }, { "include": "#variables" } ]
369364
}
370365
},
371366
"patterns": [
@@ -383,9 +378,7 @@
383378
"end": "^(?!(\\s*(\\.\\.\\.((( {2}| ?\\t)\\s*\\S.*)|(\\s*))?$))|(\\s*#.*$)|(\\s*$))",
384379
"beginCaptures": {
385380
"1": { "name": "keyword.control.flow.robotframework" },
386-
"5": {
387-
"patterns": [ { "include": "#expression" } ]
388-
}
381+
"5": { "patterns": [ { "include": "#expression" } ] }
389382
},
390383
"patterns": [
391384
{ "include": "#escape" },

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

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,119 @@ result: !SemanticTokens
285285
- 2
286286
- 39
287287
- 0
288+
- 1
289+
- 0
290+
- 10
291+
- 33
292+
- 1
293+
- 1
294+
- 4
295+
- 5
296+
- 41
297+
- 0
298+
- 0
299+
- 5
300+
- 1
301+
- 39
302+
- 0
303+
- 0
304+
- 1
305+
- 14
306+
- 39
307+
- 0
308+
- 0
309+
- 14
310+
- 4
311+
- 36
312+
- 2048
313+
- 0
314+
- 5
315+
- 11
316+
- 39
317+
- 0
318+
- 1
319+
- 4
320+
- 4
321+
- 41
322+
- 0
323+
- 0
324+
- 4
325+
- 1
326+
- 39
327+
- 0
328+
- 0
329+
- 1
330+
- 37
331+
- 39
332+
- 0
333+
- 0
334+
- 37
335+
- 1
336+
- 36
337+
- 2048
338+
- 1
339+
- 4
340+
- 4
341+
- 41
342+
- 0
343+
- 0
344+
- 4
345+
- 1
346+
- 39
347+
- 0
348+
- 0
349+
- 1
350+
- 31
351+
- 39
352+
- 0
353+
- 0
354+
- 31
355+
- 10
356+
- 36
357+
- 2048
358+
- 1
359+
- 4
360+
- 3
361+
- 41
362+
- 0
363+
- 0
364+
- 3
365+
- 1
366+
- 39
367+
- 0
368+
- 0
369+
- 1
370+
- 31
371+
- 39
372+
- 0
373+
- 0
374+
- 31
375+
- 5
376+
- 36
377+
- 2048
378+
- 1
379+
- 4
380+
- 3
381+
- 41
382+
- 0
383+
- 0
384+
- 3
385+
- 1
386+
- 39
387+
- 0
388+
- 0
389+
- 1
390+
- 31
391+
- 39
392+
- 0
393+
- 0
394+
- 31
395+
- 2
396+
- 47
397+
- 2048
398+
- 0
399+
- 3
400+
- 1
401+
- 48
402+
- 2048
288403
result_id: null

0 commit comments

Comments
 (0)