From 48c7f9e7071ebba9bd05da363a6e51f14ce94e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Mon, 22 Feb 2021 16:08:23 +0100 Subject: [PATCH] Tiny tokenizer improvements --- assets/js/cell/live_editor/elixir/monarch_language.js | 10 +++++++++- assets/js/cell/live_editor/monaco.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/js/cell/live_editor/elixir/monarch_language.js b/assets/js/cell/live_editor/elixir/monarch_language.js index 56f32ae27..22943596b 100644 --- a/assets/js/cell/live_editor/elixir/monarch_language.js +++ b/assets/js/cell/live_editor/elixir/monarch_language.js @@ -192,7 +192,15 @@ const ElixirMonarchLanguage = { [ // In-scope call - an identifier followed by ( or .( /(@variableName)(?=\s*\.?\s*\()/, - ["function.call"], + { + cases: { + // Tokenize as keyword in cases like `if(..., do: ..., else: ...)` + "@declarationKeywords": "keyword.declaration", + "@namespaceKeywords": "keyword", + "@otherKeywords": "keyword", + "@default": "function.call" + } + }, ], [ // Referencing function in a module diff --git a/assets/js/cell/live_editor/monaco.js b/assets/js/cell/live_editor/monaco.js index 8f3d3a1ac..9debf2b71 100644 --- a/assets/js/cell/live_editor/monaco.js +++ b/assets/js/cell/live_editor/monaco.js @@ -25,7 +25,7 @@ monaco.editor.defineTheme("custom", { inherit: false, rules: [ { token: "", foreground: "#abb2bf" }, - { token: "variable", foreground: "#abb2bf" }, + { token: "variable", foreground: "#e06c75" }, { token: "constant", foreground: "#61afef" }, { token: "constant.character.escape", foreground: "#61afef" }, { token: "comment", foreground: "#5c6370" },