From 6e44a5118f105268f7f8979845b1d5269f46c472 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijn@haverbeke.nl>
Date: Fri, 4 Aug 2017 08:41:29 +0200
Subject: [PATCH] [css mode] Don't feed comment tokens to the state machine

Closes #4892
---
 mode/css/css.js  | 3 ++-
 mode/css/test.js | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/mode/css/css.js b/mode/css/css.js
index 056c48e68..bfe11d3b0 100644
--- a/mode/css/css.js
+++ b/mode/css/css.js
@@ -383,7 +383,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
         style = style[0];
       }
       override = style;
-      state.state = states[state.state](type, stream, state);
+      if (type != "comment")
+        state.state = states[state.state](type, stream, state);
       return override;
     },
 
diff --git a/mode/css/test.js b/mode/css/test.js
index 7a496fb09..6fc6e33ca 100644
--- a/mode/css/test.js
+++ b/mode/css/test.js
@@ -197,4 +197,10 @@
 
    MT("counter-style-symbols",
       "[tag ol] { [property list-style]: [atom symbols]([atom cyclic] [string \"*\"] [string \"\\2020\"] [string \"\\2021\"] [string \"\\A7\"]); }");
+
+  MT("comment-does-not-disrupt",
+     "[def @font-face] [comment /* foo */] {",
+     "  [property src]: [atom url]([string x]);",
+     "  [property font-family]: [variable One];",
+     "}")
 })();
-- 
GitLab