Address feedback

This commit is contained in:
Laurențiu Nicola 2019-05-21 16:28:10 +03:00
parent 9ade271a67
commit b08362f6d2
3 changed files with 39 additions and 42 deletions

View file

@ -13,8 +13,15 @@ pub struct HighlightedRange {
fn is_control_keyword(kind: SyntaxKind) -> bool { fn is_control_keyword(kind: SyntaxKind) -> bool {
match kind { match kind {
FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW T![for]
| RETURN_KW => true, | T![loop]
| T![while]
| T![continue]
| T![break]
| T![if]
| T![else]
| T![match]
| T![return] => true,
_ => false, _ => false,
} }
} }
@ -37,8 +44,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
NAME => "function", NAME => "function",
INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal", INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal",
LIFETIME => "parameter", LIFETIME => "parameter",
UNSAFE_KW => "unsafe", T![unsafe] => "keyword.unsafe",
k if is_control_keyword(k) => "control", k if is_control_keyword(k) => "keyword.control",
k if k.is_keyword() => "keyword", k if k.is_keyword() => "keyword",
_ => { _ => {
if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) { if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) {

View file

@ -270,20 +270,11 @@
} }
], ],
"colors": [ "colors": [
{
"id": "ralsp.background",
"description": "Background color",
"defaults": {
"dark": "#3F3F3F",
"light": "#001080",
"highContrast": "#000000"
}
},
{ {
"id": "ralsp.comment", "id": "ralsp.comment",
"description": "Color for comments", "description": "Color for comments",
"defaults": { "defaults": {
"dark": "#7F9F7F", "dark": "#6A9955",
"light": "#008000", "light": "#008000",
"highContrast": "#7CA668" "highContrast": "#7CA668"
} }
@ -292,13 +283,31 @@
"id": "ralsp.string", "id": "ralsp.string",
"description": "Color for strings", "description": "Color for strings",
"defaults": { "defaults": {
"dark": "#CC9393", "dark": "#CE9178",
"light": "#A31515", "light": "#A31515",
"highContrast": "#CE9178" "highContrast": "#CE9178"
} }
}, },
{ {
"id": "ralsp.unsafe", "id": "ralsp.keyword",
"description": "Color for keywords",
"defaults": {
"dark": "#569cd6",
"light": "#0000FF",
"highContrast": "#569CD6"
}
},
{
"id": "ralsp.keyword.control",
"description": "Color for control keywords",
"defaults": {
"dark": "#C586C0",
"light": "#AF00DB",
"highContrast": "#C586C0"
}
},
{
"id": "ralsp.keyword.unsafe",
"description": "Color for unsafe", "description": "Color for unsafe",
"defaults": { "defaults": {
"dark": "#FF3030", "dark": "#FF3030",
@ -306,29 +315,11 @@
"highContrast": "#FF1010" "highContrast": "#FF1010"
} }
}, },
{
"id": "ralsp.keyword",
"description": "Color for keywords",
"defaults": {
"dark": "#F0DFAF",
"light": "#0000FF",
"highContrast": "#569CD6"
}
},
{
"id": "ralsp.control",
"description": "Color for control keywords",
"defaults": {
"dark": "#CF20FB",
"light": "#AF00DB",
"highContrast": "#C586C0"
}
},
{ {
"id": "ralsp.function", "id": "ralsp.function",
"description": "Color for functions", "description": "Color for functions",
"defaults": { "defaults": {
"dark": "#93E0E3", "dark": "#DCDCAA",
"light": "#795E26", "light": "#795E26",
"highContrast": "#DCDCAA" "highContrast": "#DCDCAA"
} }
@ -337,7 +328,7 @@
"id": "ralsp.parameter", "id": "ralsp.parameter",
"description": "Color for parameters", "description": "Color for parameters",
"defaults": { "defaults": {
"dark": "#94BFF3", "dark": "#9CDCFE",
"light": "#001080", "light": "#001080",
"highContrast": "#9CDCFE" "highContrast": "#9CDCFE"
} }
@ -355,7 +346,7 @@
"id": "ralsp.text", "id": "ralsp.text",
"description": "Color for text", "description": "Color for text",
"defaults": { "defaults": {
"dark": "#DCDCCC", "dark": "#D4D4D4",
"light": "#000000", "light": "#000000",
"highContrast": "#FFFFFF" "highContrast": "#FFFFFF"
} }
@ -364,7 +355,7 @@
"id": "ralsp.attribute", "id": "ralsp.attribute",
"description": "Color for attributes", "description": "Color for attributes",
"defaults": { "defaults": {
"dark": "#BFEBBF", "dark": "#9FE9BF",
"light": "#1F4B1F", "light": "#1F4B1F",
"highContrast": "#108010" "highContrast": "#108010"
} }
@ -373,7 +364,7 @@
"id": "ralsp.literal", "id": "ralsp.literal",
"description": "Color for literals", "description": "Color for literals",
"defaults": { "defaults": {
"dark": "#DFAF8F", "dark": "#BECEA8",
"light": "#09885A", "light": "#09885A",
"highContrast": "#B5CEA8" "highContrast": "#B5CEA8"
} }

View file

@ -26,12 +26,11 @@ export class Highlighter {
const decorations: Iterable< const decorations: Iterable<
[string, vscode.TextEditorDecorationType] [string, vscode.TextEditorDecorationType]
> = [ > = [
colorContrib('background'),
colorContrib('comment'), colorContrib('comment'),
colorContrib('string'), colorContrib('string'),
colorContrib('unsafe'),
colorContrib('keyword'), colorContrib('keyword'),
colorContrib('control'), colorContrib('keyword.control'),
colorContrib('keyword.unsafe'),
colorContrib('function'), colorContrib('function'),
colorContrib('parameter'), colorContrib('parameter'),
colorContrib('builtin'), colorContrib('builtin'),