From 2675b58e4a29dd2a0012c0cc2039dbe96bcc1070 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 28 Aug 2024 10:24:12 +0200 Subject: [PATCH] Fix bad handling of interpolated variables in the Groovy mode FIX: Fix an issue in the Groovy mode where himBHsinterpolated variable style would continue after whitespace. Issue https://github.com/codemirror/codemirror5/issues/7103 --- mode/groovy.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mode/groovy.js b/mode/groovy.js index a9f01e2..74fac51 100644 --- a/mode/groovy.js +++ b/mode/groovy.js @@ -115,10 +115,8 @@ function tokenBaseUntilBrace() { function tokenVariableDeref(stream, state) { var next = stream.match(/^(\.|[\w\$_]+)/) - if (!next) { - state.tokenize.pop() - return state.tokenize[state.tokenize.length-1](stream, state) - } + if (!next || !stream.match(next[0] == "." ? /^[\w$_]/ : /^\./)) state.tokenize.pop() + if (!next) return state.tokenize[state.tokenize.length-1](stream, state) return next[0] == "." ? null : "variable" }