runner icon indicating copy to clipboard operation
runner copied to clipboard

Wrong syntax highlighting for Groovy GStrings when interpolating values

Open FranzMartyn opened this issue 1 year ago • 6 comments

Describe the bug Sometimes, codewars' code runner gets the syntax highlighting for GStrings wrong when they contain interpolated values

Code runner does this:

image

Expected behavior

instead of this (example from Intellij Idea):

image

To Reproduce

  • Create a Kumite in Groovy
  • Create variables and interpolate them into a String

Kumite: https://www.codewars.com/kumite/66cc60e3d8acf6782ef5515c

Browser

  • OS: Windows 10 Pro, Version 22H2, Build 19045.4780
  • Browser: Chrome
  • Version: 128.0.6613.84 (Official Build) (64-Bit)

FranzMartyn avatar Aug 26 '24 11:08 FranzMartyn

IIRC, syntax highlighting is done with capabilities of the CodeMirror 5 editor, and Codewars does not have any special control over it. Ideally this problem would be resolved by submitting a PR to CodeMirror, so Codewars could later use the fixed version.

Problematic part can be that CW uses CodeMirror 5, which is not the latest version. I do not know if it still accepts fixes and improvements.

hobovsky avatar Aug 26 '24 11:08 hobovsky

Are there any plans on updating to a later version of CodeMirror or is there no need for it?

FranzMartyn avatar Aug 27 '24 08:08 FranzMartyn

I am not aware of any.

hobovsky avatar Aug 27 '24 08:08 hobovsky

Seems like it's fixes now

https://github.com/codemirror/legacy-modes/commit/2675b58e4a29dd2a0012c0cc2039dbe96bcc1070

FranzMartyn avatar Aug 29 '24 12:08 FranzMartyn

I will check what has to be done to make sure that CW uses the fixed mode.

hobovsky avatar Aug 29 '24 12:08 hobovsky

An update to this issue:

@marijnh created this commit to codemirror/legacy-modes which is also present in codemirror/codemirror5

FranzMartyn avatar Mar 27 '25 15:03 FranzMartyn