diff options
-rw-r--r-- | crates/ra_ide_api/src/syntax_highlighting.rs | 15 | ||||
-rw-r--r-- | editors/code/package.json | 47 | ||||
-rw-r--r-- | editors/code/src/highlighting.ts | 5 |
3 files changed, 32 insertions, 35 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index ab69a4374..2158291dc 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs | |||
@@ -13,8 +13,15 @@ pub struct HighlightedRange { | |||
13 | 13 | ||
14 | fn is_control_keyword(kind: SyntaxKind) -> bool { | 14 | fn is_control_keyword(kind: SyntaxKind) -> bool { |
15 | match kind { | 15 | match kind { |
16 | FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW | 16 | T![for] |
17 | | RETURN_KW => true, | 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, | ||
18 | _ => false, | 25 | _ => false, |
19 | } | 26 | } |
20 | } | 27 | } |
@@ -37,8 +44,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
37 | NAME => "function", | 44 | NAME => "function", |
38 | INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal", | 45 | INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal", |
39 | LIFETIME => "parameter", | 46 | LIFETIME => "parameter", |
40 | UNSAFE_KW => "unsafe", | 47 | T![unsafe] => "keyword.unsafe", |
41 | k if is_control_keyword(k) => "control", | 48 | k if is_control_keyword(k) => "keyword.control", |
42 | k if k.is_keyword() => "keyword", | 49 | k if k.is_keyword() => "keyword", |
43 | _ => { | 50 | _ => { |
44 | if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) { | 51 | if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) { |
diff --git a/editors/code/package.json b/editors/code/package.json index c72037da9..750c97bb1 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -271,19 +271,10 @@ | |||
271 | ], | 271 | ], |
272 | "colors": [ | 272 | "colors": [ |
273 | { | 273 | { |
274 | "id": "ralsp.background", | ||
275 | "description": "Background color", | ||
276 | "defaults": { | ||
277 | "dark": "#3F3F3F", | ||
278 | "light": "#001080", | ||
279 | "highContrast": "#000000" | ||
280 | } | ||
281 | }, | ||
282 | { | ||
283 | "id": "ralsp.comment", | 274 | "id": "ralsp.comment", |
284 | "description": "Color for comments", | 275 | "description": "Color for comments", |
285 | "defaults": { | 276 | "defaults": { |
286 | "dark": "#7F9F7F", | 277 | "dark": "#6A9955", |
287 | "light": "#008000", | 278 | "light": "#008000", |
288 | "highContrast": "#7CA668" | 279 | "highContrast": "#7CA668" |
289 | } | 280 | } |
@@ -292,43 +283,43 @@ | |||
292 | "id": "ralsp.string", | 283 | "id": "ralsp.string", |
293 | "description": "Color for strings", | 284 | "description": "Color for strings", |
294 | "defaults": { | 285 | "defaults": { |
295 | "dark": "#CC9393", | 286 | "dark": "#CE9178", |
296 | "light": "#A31515", | 287 | "light": "#A31515", |
297 | "highContrast": "#CE9178" | 288 | "highContrast": "#CE9178" |
298 | } | 289 | } |
299 | }, | 290 | }, |
300 | { | 291 | { |
301 | "id": "ralsp.unsafe", | ||
302 | "description": "Color for unsafe", | ||
303 | "defaults": { | ||
304 | "dark": "#FF3030", | ||
305 | "light": "#FF1010", | ||
306 | "highContrast": "#FF1010" | ||
307 | } | ||
308 | }, | ||
309 | { | ||
310 | "id": "ralsp.keyword", | 292 | "id": "ralsp.keyword", |
311 | "description": "Color for keywords", | 293 | "description": "Color for keywords", |
312 | "defaults": { | 294 | "defaults": { |
313 | "dark": "#F0DFAF", | 295 | "dark": "#569cd6", |
314 | "light": "#0000FF", | 296 | "light": "#0000FF", |
315 | "highContrast": "#569CD6" | 297 | "highContrast": "#569CD6" |
316 | } | 298 | } |
317 | }, | 299 | }, |
318 | { | 300 | { |
319 | "id": "ralsp.control", | 301 | "id": "ralsp.keyword.control", |
320 | "description": "Color for control keywords", | 302 | "description": "Color for control keywords", |
321 | "defaults": { | 303 | "defaults": { |
322 | "dark": "#CF20FB", | 304 | "dark": "#C586C0", |
323 | "light": "#AF00DB", | 305 | "light": "#AF00DB", |
324 | "highContrast": "#C586C0" | 306 | "highContrast": "#C586C0" |
325 | } | 307 | } |
326 | }, | 308 | }, |
327 | { | 309 | { |
310 | "id": "ralsp.keyword.unsafe", | ||
311 | "description": "Color for unsafe", | ||
312 | "defaults": { | ||
313 | "dark": "#FF3030", | ||
314 | "light": "#FF1010", | ||
315 | "highContrast": "#FF1010" | ||
316 | } | ||
317 | }, | ||
318 | { | ||
328 | "id": "ralsp.function", | 319 | "id": "ralsp.function", |
329 | "description": "Color for functions", | 320 | "description": "Color for functions", |
330 | "defaults": { | 321 | "defaults": { |
331 | "dark": "#93E0E3", | 322 | "dark": "#DCDCAA", |
332 | "light": "#795E26", | 323 | "light": "#795E26", |
333 | "highContrast": "#DCDCAA" | 324 | "highContrast": "#DCDCAA" |
334 | } | 325 | } |
@@ -337,7 +328,7 @@ | |||
337 | "id": "ralsp.parameter", | 328 | "id": "ralsp.parameter", |
338 | "description": "Color for parameters", | 329 | "description": "Color for parameters", |
339 | "defaults": { | 330 | "defaults": { |
340 | "dark": "#94BFF3", | 331 | "dark": "#9CDCFE", |
341 | "light": "#001080", | 332 | "light": "#001080", |
342 | "highContrast": "#9CDCFE" | 333 | "highContrast": "#9CDCFE" |
343 | } | 334 | } |
@@ -355,7 +346,7 @@ | |||
355 | "id": "ralsp.text", | 346 | "id": "ralsp.text", |
356 | "description": "Color for text", | 347 | "description": "Color for text", |
357 | "defaults": { | 348 | "defaults": { |
358 | "dark": "#DCDCCC", | 349 | "dark": "#D4D4D4", |
359 | "light": "#000000", | 350 | "light": "#000000", |
360 | "highContrast": "#FFFFFF" | 351 | "highContrast": "#FFFFFF" |
361 | } | 352 | } |
@@ -364,7 +355,7 @@ | |||
364 | "id": "ralsp.attribute", | 355 | "id": "ralsp.attribute", |
365 | "description": "Color for attributes", | 356 | "description": "Color for attributes", |
366 | "defaults": { | 357 | "defaults": { |
367 | "dark": "#BFEBBF", | 358 | "dark": "#9FE9BF", |
368 | "light": "#1F4B1F", | 359 | "light": "#1F4B1F", |
369 | "highContrast": "#108010" | 360 | "highContrast": "#108010" |
370 | } | 361 | } |
@@ -373,7 +364,7 @@ | |||
373 | "id": "ralsp.literal", | 364 | "id": "ralsp.literal", |
374 | "description": "Color for literals", | 365 | "description": "Color for literals", |
375 | "defaults": { | 366 | "defaults": { |
376 | "dark": "#DFAF8F", | 367 | "dark": "#BECEA8", |
377 | "light": "#09885A", | 368 | "light": "#09885A", |
378 | "highContrast": "#B5CEA8" | 369 | "highContrast": "#B5CEA8" |
379 | } | 370 | } |
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 432f40ff4..e1a68544a 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -26,12 +26,11 @@ export class Highlighter { | |||
26 | const decorations: Iterable< | 26 | const decorations: Iterable< |
27 | [string, vscode.TextEditorDecorationType] | 27 | [string, vscode.TextEditorDecorationType] |
28 | > = [ | 28 | > = [ |
29 | colorContrib('background'), | ||
30 | colorContrib('comment'), | 29 | colorContrib('comment'), |
31 | colorContrib('string'), | 30 | colorContrib('string'), |
32 | colorContrib('unsafe'), | ||
33 | colorContrib('keyword'), | 31 | colorContrib('keyword'), |
34 | colorContrib('control'), | 32 | colorContrib('keyword.control'), |
33 | colorContrib('keyword.unsafe'), | ||
35 | colorContrib('function'), | 34 | colorContrib('function'), |
36 | colorContrib('parameter'), | 35 | colorContrib('parameter'), |
37 | colorContrib('builtin'), | 36 | colorContrib('builtin'), |