Skip to content

Commit 5885fa5

Browse files
authored
Merge branch 'main' into disable-testview
2 parents 70a0a73 + 4fab1d1 commit 5885fa5

20 files changed

+134
-102
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@
315315
],
316316
"var": [
317317
"storage.type.robotframework"
318+
],
319+
"documentation": [
320+
"markup.robotframework"
318321
]
319322
}
320323
}
@@ -1493,4 +1496,4 @@
14931496
"webpack": "^5.90.3",
14941497
"webpack-cli": "^5.1.4"
14951498
}
1496-
}
1499+
}

packages/debugger/src/robotcode/debugger/protocol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ async def handle_unknown_command(self, message: Request) -> Any:
223223
raise DebugAdapterRPCErrorException(
224224
f"Unknown Command '{message.command}'",
225225
error_message=Message(
226-
format='Unknown command "{command}"',
227-
variables={"command": str(message.command)},
228-
show_user=True,
226+
format='Unknown command "{command}": {request}',
227+
variables={"command": str(message.command), "request": str(message)},
228+
show_user=False,
229229
),
230230
)
231231

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

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
from robot.parsing.lexer.tokens import Token
2424
from robot.parsing.model.statements import (
2525
Arguments,
26-
Documentation,
2726
Fixture,
2827
KeywordCall,
2928
LibraryImport,
30-
Metadata,
3129
ResourceImport,
3230
Statement,
3331
Template,
@@ -116,6 +114,7 @@ class RobotSemTokenTypes(Enum):
116114
CONFIG = "config"
117115
NAMED_ARGUMENT = "namedArgument"
118116
VAR = "var"
117+
DOCUMENTATION = "documentation"
119118

120119

121120
class RobotSemTokenModifiers(Enum):
@@ -345,7 +344,7 @@ def generate_sem_sub_tokens(
345344
if sem_info is not None:
346345
sem_type, sem_mod = sem_info
347346

348-
if isinstance(node, (Documentation, Metadata)):
347+
if token.type in [Token.DOCUMENTATION, Token.METADATA]:
349348
sem_mod = {SemanticTokenModifiers.DOCUMENTATION}
350349

351350
if token.type in [Token.VARIABLE, Token.ASSIGN]:
@@ -368,14 +367,6 @@ def generate_sem_sub_tokens(
368367
sem_mod,
369368
)
370369

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-
# )
378-
379370
yield SemTokenInfo(
380371
token.lineno,
381372
col_offset + ((last_index - 1) if is_expr else last_index),
@@ -398,19 +389,6 @@ def generate_sem_sub_tokens(
398389
else:
399390
yield SemTokenInfo.from_token(token, sem_type, sem_mod)
400391

401-
elif token.type == Token.ARGUMENT and "\\" in token.value:
402-
if col_offset is None:
403-
col_offset = token.col_offset
404-
405-
for g in cls.ESCAPE_REGEX.finditer(token.value):
406-
if g.group("x") is not None:
407-
yield SemTokenInfo.from_token(
408-
token,
409-
sem_type if g.group("x") is None else RobotSemTokenTypes.ESCAPE,
410-
sem_mod,
411-
col_offset + g.start(),
412-
g.end() - g.start(),
413-
)
414392
elif token.type in [Token.KEYWORD, ROBOT_KEYWORD_INNER] or (
415393
token.type == Token.NAME and isinstance(node, (Fixture, Template, TestTemplate))
416394
):

syntaxes/robotframework.tmLanguage.json

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
2+
"$schema": "https://raw.githubusercontent.com/RedCMD/TmLanguage-Syntax-Highlighter/main/vscode.tmLanguage.schema.json",
33
"repository": {
44
"header": {
55
"name": "keyword.other.header.robotframework",
@@ -71,12 +71,68 @@
7171
"patterns": [ { "include": "#variables" } ]
7272
},
7373
"comment": {
74-
"name": "comment.robotframework",
74+
"name": "comment.block.robotframework",
7575
"match": "(?:^ *|\\t+| {2,})(#.*)$",
7676
"captures": { "1": { "name": "comment.line.robotframework" } }
7777
},
7878
"setting": {
79-
"contentName": "variable.parameter.argument.robotframework",
79+
"patterns": [
80+
{ "include": "#documentation_setting" },
81+
{ "include": "#other_setting" }
82+
]
83+
},
84+
"escape": {
85+
"patterns": [
86+
{ "include": "#escape-sequence-unicode" },
87+
{ "include": "#escape-sequence" }
88+
]
89+
},
90+
"documentation_setting": {
91+
"contentName": "markup.robotframework",
92+
"begin": "(?i)^(documentation|dokumentation|Tài liệu hướng dẫn)(?= {2}| ?\\t| ?$)",
93+
"beginCaptures": { "1": { "name": "keyword.control.settings.robotframework" } },
94+
"end": "^(?!\\s*\\.\\.\\.)",
95+
"patterns": [
96+
{ "include": "#documentation_italic" },
97+
{ "include": "#documentation_bold" },
98+
{ "include": "#escape" },
99+
{ "include": "#comment" },
100+
{ "include": "#variables" },
101+
{ "include": "#line_continuation" }
102+
]
103+
},
104+
"documentation_bold": {
105+
"contentName": "markup.bold.documentation.robotframework",
106+
"begin": "\\*",
107+
"end": "\\*|$",
108+
"beginCaptures": { "0": { "name": "markup.robotframework" } },
109+
"endCaptures": { "0": { "name": "markup.robotframework" } },
110+
"patterns": [
111+
{ "include": "#documentation_italic" },
112+
{ "include": "#documentation_bold" },
113+
{ "include": "#escape" },
114+
{ "include": "#comment" },
115+
{ "include": "#variables" },
116+
{ "include": "#line_continuation" }
117+
]
118+
},
119+
"documentation_italic": {
120+
"contentName": "markup.italic.documentation.robotframework",
121+
"begin": "_",
122+
"end": "_|$",
123+
"beginCaptures": { "0": { "name": "markup.robotframework" } },
124+
"endCaptures": { "0": { "name": "markup.robotframework" } },
125+
"patterns": [
126+
{ "include": "#documentation_italic" },
127+
{ "include": "#documentation_bold" },
128+
{ "include": "#escape" },
129+
{ "include": "#comment" },
130+
{ "include": "#variables" },
131+
{ "include": "#line_continuation" }
132+
]
133+
},
134+
"other_setting": {
135+
"contentName": "string.unquoted.argument.robotframework",
80136
"begin": "(?i)^(\\S+( \\S+)*)(?= {2}| ?\\t| ?$)",
81137
"beginCaptures": { "1": { "name": "keyword.control.settings.robotframework" } },
82138
"end": "^(?!\\s*\\.\\.\\.)",
@@ -88,7 +144,27 @@
88144
]
89145
},
90146
"testcase_settings": {
91-
"contentName": "variable.parameter.argument.robotframework",
147+
"patterns": [
148+
{ "include": "#documentation_testcase_settings" },
149+
{ "include": "#other_testcase_settings" }
150+
]
151+
},
152+
"documentation_testcase_settings": {
153+
"contentName": "markup.robotframework",
154+
"begin": "(?i)(\\[(documentation|dokumentation|Tài liệu hướng dẫn)\\])(?= {2}| ?\\t| ?$)",
155+
"beginCaptures": { "0": { "name": "keyword.control.settings.robotframework" } },
156+
"end": "^(?!\\s*\\.\\.\\.)",
157+
"patterns": [
158+
{ "include": "#documentation_italic" },
159+
{ "include": "#documentation_bold" },
160+
{ "include": "#escape" },
161+
{ "include": "#comment" },
162+
{ "include": "#variables" },
163+
{ "include": "#line_continuation" }
164+
]
165+
},
166+
"other_testcase_settings": {
167+
"contentName": "string.unquoted.argument.robotframework",
92168
"begin": "(\\[.*?\\])(?= {2}| ?\\t| ?$)",
93169
"beginCaptures": { "0": { "name": "keyword.control.settings.robotframework" } },
94170
"end": "^(?!\\s*\\.\\.\\.)",

syntaxes/robotframework.tmLanguage.yaml

Whitespace-only changes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ result: !SemanticTokens
1919
- 0
2020
- 3
2121
- 43
22-
- 256
22+
- 0
2323
- 2
2424
- 0
2525
- 18

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,6 @@ result: !SemanticTokens
760760
- 1
761761
- 48
762762
- 0
763-
- 0
764-
- 15
765-
- 2
766-
- 50
767-
- 0
768763
- 1
769764
- 0
770765
- 2

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,42 +1304,42 @@ result: !SemanticTokens
13041304
- 29
13051305
- 2
13061306
- 47
1307-
- 256
1307+
- 0
13081308
- 0
13091309
- 6
13101310
- 1
13111311
- 48
1312-
- 256
1312+
- 0
13131313
- 1
13141314
- 4
13151315
- 3
13161316
- 43
1317-
- 256
1317+
- 0
13181318
- 1
13191319
- 4
13201320
- 3
13211321
- 43
1322-
- 256
1322+
- 0
13231323
- 0
13241324
- 21
13251325
- 2
13261326
- 47
1327-
- 256
1327+
- 0
13281328
- 0
13291329
- 7
13301330
- 1
13311331
- 48
1332-
- 256
1332+
- 0
13331333
- 0
13341334
- 2
13351335
- 2
13361336
- 47
1337-
- 256
1337+
- 0
13381338
- 0
13391339
- 15
13401340
- 1
13411341
- 48
1342-
- 256
1342+
- 0
13431343
- 2
13441344
- 4
13451345
- 9

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf50/test_semantic_tokens.test[foldingrange.robot].out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ result: !SemanticTokens
1919
- 0
2020
- 3
2121
- 43
22-
- 256
22+
- 0
2323
- 2
2424
- 0
2525
- 18

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf50/test_semantic_tokens.test[hover.robot].out

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,6 @@ result: !SemanticTokens
760760
- 1
761761
- 48
762762
- 0
763-
- 0
764-
- 15
765-
- 2
766-
- 50
767-
- 0
768763
- 1
769764
- 0
770765
- 2

0 commit comments

Comments
 (0)