Regex styling errors in CoffeeScript, JavaScript #414

Closed
ervumlens opened this Issue Jul 12, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@ervumlens

Problem
Regular expression styling in CoffeeScript breaks in normal circumstances. JavaScript has a similar problem when working with very simple statements.

Komodo Edit, version 9.1.0, build 15798, platform linux-x86_64. Built on Sat May 30 05:22:08 2015.

CoffeeScript Code

value = "0"

#Ok (b/c in parens)
if (/\d+/.test value)
    console.log "1"

#Problem: Style is shifted b/c no parens and regex ends in +
if /\d+/.test value
    console.log "2"

#Same problem, regex ends in ? (probably other chars do this too)
if /\d\d?/.test value
    console.log "3"

#Problem: Style is absent b/c no parens and no magic char
if /(\d+)/.test value
    console.log "4"

#half wrong, half right
if /(\d+)/.test(value) || /(\d+)/.test(value)
    console.log "5"

CoffeeScript Screenshot
image

JavaScript Code

//Problem: no styling (no previous statements)
/c+c/g.exec('abccccdef');
console.log(RegExp.lastMatch);

while (false) {}

//Problem: no styling (no trailing semicolon in line 10)
/c+c/g.exec('abccccdef');
console.log(RegExp.lastMatch);

while (false) {};

//Ok: there is a semicolon at line 16
/c+/g.exec('abccccdef');
console.log(RegExp.lastMatch);

while (false) {}

//Ok: in parens
if (/c+/g.exec('abcccccdef')) {}

JavaScript Screenshot
image

@ervumlens

This comment has been minimized.

Show comment
Hide comment
@ervumlens

ervumlens Jul 12, 2015

JavaScript also has the "style drift" problem in the simple statements.

image

JavaScript also has the "style drift" problem in the simple statements.

image

@mitchell-as mitchell-as added this to the 9.2 milestone Jul 13, 2015

@mitchell-as mitchell-as self-assigned this Jul 13, 2015

@mitchell-as mitchell-as modified the milestones: 9.2.1, 9.2 Jul 13, 2015

mitchell-as added a commit that referenced this issue Aug 10, 2015

fix: Scintilla: Highlight JavaScript and CoffeeScript regex properly -
…fixes #414

rn=

(integrated from master branch change 9.2.1-214-g2768da4 by Mitchell <mitchellb@activestate.com>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment