From 67641d3f5fd1cfd49673c4eea9e3d646ed97e108 Mon Sep 17 00:00:00 2001 From: Omer Ben-Amram Date: Sat, 14 Dec 2019 13:24:07 +0200 Subject: added decorations --- crates/ra_ide/src/syntax_highlighting.rs | 4 +-- editors/code/package.json | 56 +++++++++++++++++++++++++++++++- editors/code/src/highlighting.ts | 6 ++++ 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index cd9d8b058..7be25b234 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -225,8 +225,8 @@ fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str { Def(hir::ModuleDef::EnumVariant(_)) => "constant", Def(hir::ModuleDef::Const(_)) => "constant", Def(hir::ModuleDef::Static(_)) => "constant", - Def(hir::ModuleDef::Trait(_)) => "type.trait", - Def(hir::ModuleDef::TypeAlias(_)) => "type.alias", + Def(hir::ModuleDef::Trait(_)) => "type", + Def(hir::ModuleDef::TypeAlias(_)) => "type", Def(hir::ModuleDef::BuiltinType(_)) => "type.builtin", SelfType(_) => "type.self", TypeParam(_) => "type.param", diff --git a/editors/code/package.json b/editors/code/package.json index 7bc08ec31..c24e73d24 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -422,6 +422,33 @@ "highContrast": "#B5CEA8" } }, + { + "id": "ralsp.literal.numeric", + "description": "Color for numeric literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, + { + "id": "ralsp.literal.char", + "description": "Color for character literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, + { + "id": "ralsp.literal.byte", + "description": "Color for byte literals", + "defaults": { + "dark": "#BECEA8", + "light": "#09885A", + "highContrast": "#B5CEA8" + } + }, { "id": "ralsp.macro", "description": "Color for macros", @@ -442,7 +469,34 @@ }, { "id": "ralsp.type", - "description": "Color for types", + "description": "Color for other types (traits, aliases..)", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.builtin", + "description": "Color for built-in types (&str, bool, u16, u32)", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.self", + "description": "Color for `Self` param type", + "defaults": { + "dark": "#4EC9B0", + "light": "#267F99", + "highContrast": "#4EC9B0" + } + }, + { + "id": "ralsp.type.param", + "description": "Color for type parameters", "defaults": { "dark": "#4EC9B0", "light": "#267F99", diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 6d50a2f2d..2c8a98aa6 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -53,10 +53,16 @@ export class Highlighter { decoration('parameter'), decoration('constant'), decoration('type'), + decoration('type.self'), + decoration('type.generic'), + decoration('type.param'), decoration('builtin'), decoration('text'), decoration('attribute'), decoration('literal'), + decoration('literal.numeric'), + decoration('literal.char'), + decoration('literal.byte'), decoration('macro'), decoration('variable'), decoration('variable.mut', 'underline'), -- cgit v1.2.3