Skip to content

Commit b08362f

Browse files
committed
Address feedback
1 parent 9ade271 commit b08362f

File tree

3 files changed

+32
-35
lines changed

3 files changed

+32
-35
lines changed

crates/ra_ide_api/src/syntax_highlighting.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ pub struct HighlightedRange {
1313

1414
fn is_control_keyword(kind: SyntaxKind) -> bool {
1515
match kind {
16-
FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW
17-
| RETURN_KW => true,
16+
T![for]
17+
| T![loop]
18+
| T![while]
19+
| T![continue]
20+
| T![break]
21+
| T![if]
22+
| T![else]
23+
| T![match]
24+
| T![return] => true,
1825
_ => false,
1926
}
2027
}
@@ -37,8 +44,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
3744
NAME => "function",
3845
INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal",
3946
LIFETIME => "parameter",
40-
UNSAFE_KW => "unsafe",
41-
k if is_control_keyword(k) => "control",
47+
T![unsafe] => "keyword.unsafe",
48+
k if is_control_keyword(k) => "keyword.control",
4249
k if k.is_keyword() => "keyword",
4350
_ => {
4451
if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) {

editors/code/package.json

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -270,20 +270,11 @@
270270
}
271271
],
272272
"colors": [
273-
{
274-
"id": "ralsp.background",
275-
"description": "Background color",
276-
"defaults": {
277-
"dark": "#3F3F3F",
278-
"light": "#001080",
279-
"highContrast": "#000000"
280-
}
281-
},
282273
{
283274
"id": "ralsp.comment",
284275
"description": "Color for comments",
285276
"defaults": {
286-
"dark": "#7F9F7F",
277+
"dark": "#6A9955",
287278
"light": "#008000",
288279
"highContrast": "#7CA668"
289280
}
@@ -292,43 +283,43 @@
292283
"id": "ralsp.string",
293284
"description": "Color for strings",
294285
"defaults": {
295-
"dark": "#CC9393",
286+
"dark": "#CE9178",
296287
"light": "#A31515",
297288
"highContrast": "#CE9178"
298289
}
299290
},
300-
{
301-
"id": "ralsp.unsafe",
302-
"description": "Color for unsafe",
303-
"defaults": {
304-
"dark": "#FF3030",
305-
"light": "#FF1010",
306-
"highContrast": "#FF1010"
307-
}
308-
},
309291
{
310292
"id": "ralsp.keyword",
311293
"description": "Color for keywords",
312294
"defaults": {
313-
"dark": "#F0DFAF",
295+
"dark": "#569cd6",
314296
"light": "#0000FF",
315297
"highContrast": "#569CD6"
316298
}
317299
},
318300
{
319-
"id": "ralsp.control",
301+
"id": "ralsp.keyword.control",
320302
"description": "Color for control keywords",
321303
"defaults": {
322-
"dark": "#CF20FB",
304+
"dark": "#C586C0",
323305
"light": "#AF00DB",
324306
"highContrast": "#C586C0"
325307
}
326308
},
309+
{
310+
"id": "ralsp.keyword.unsafe",
311+
"description": "Color for unsafe",
312+
"defaults": {
313+
"dark": "#FF3030",
314+
"light": "#FF1010",
315+
"highContrast": "#FF1010"
316+
}
317+
},
327318
{
328319
"id": "ralsp.function",
329320
"description": "Color for functions",
330321
"defaults": {
331-
"dark": "#93E0E3",
322+
"dark": "#DCDCAA",
332323
"light": "#795E26",
333324
"highContrast": "#DCDCAA"
334325
}
@@ -337,7 +328,7 @@
337328
"id": "ralsp.parameter",
338329
"description": "Color for parameters",
339330
"defaults": {
340-
"dark": "#94BFF3",
331+
"dark": "#9CDCFE",
341332
"light": "#001080",
342333
"highContrast": "#9CDCFE"
343334
}
@@ -355,7 +346,7 @@
355346
"id": "ralsp.text",
356347
"description": "Color for text",
357348
"defaults": {
358-
"dark": "#DCDCCC",
349+
"dark": "#D4D4D4",
359350
"light": "#000000",
360351
"highContrast": "#FFFFFF"
361352
}
@@ -364,7 +355,7 @@
364355
"id": "ralsp.attribute",
365356
"description": "Color for attributes",
366357
"defaults": {
367-
"dark": "#BFEBBF",
358+
"dark": "#9FE9BF",
368359
"light": "#1F4B1F",
369360
"highContrast": "#108010"
370361
}
@@ -373,7 +364,7 @@
373364
"id": "ralsp.literal",
374365
"description": "Color for literals",
375366
"defaults": {
376-
"dark": "#DFAF8F",
367+
"dark": "#BECEA8",
377368
"light": "#09885A",
378369
"highContrast": "#B5CEA8"
379370
}

editors/code/src/highlighting.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ export class Highlighter {
2626
const decorations: Iterable<
2727
[string, vscode.TextEditorDecorationType]
2828
> = [
29-
colorContrib('background'),
3029
colorContrib('comment'),
3130
colorContrib('string'),
32-
colorContrib('unsafe'),
3331
colorContrib('keyword'),
34-
colorContrib('control'),
32+
colorContrib('keyword.control'),
33+
colorContrib('keyword.unsafe'),
3534
colorContrib('function'),
3635
colorContrib('parameter'),
3736
colorContrib('builtin'),

0 commit comments

Comments
 (0)