jashkenas / jashkenas/coffee-script-tmbundle
Incorrect Syntax Highlighting (regex string)
- Dominant language
- JavaScript
- Stars
- 826
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
FYI, when using a single frontslash in a line, the highlighter assumes it's a regex string, which breaks syntax highlighting basically all the way through my coffeescript file. This breaks in TM2, but seems to work in TM1. For example, a line such as:
x = ((width-height)/2)
will assume that EVERYTHING until the end of the file is a regex expression, and thus no syntax highlighting. Pretty useless. The cultprit is "string.regexp.coffee". Removing this from the CoffeeScript language grammers fixes my problem (although now it doesn't highlight regex strings properly):
{
name = 'string.regexp.coffee';
begin = '/(?![\s=/*+{}?])';
end = '(/)[igmy]{0,4}(?![a-zA-Z0-9])';
beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.coffee'; }; };
endCaptures = { 1 = { name = 'punctuation.definition.string.end.coffee'; }; };
patterns = ( { include = 'source.js.regexp'; } );
},
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the CoffeeScript language grammar entry named string.regexp.coffee and reproduce the issue in TM2 using the x = ((width-height)/2) example. Check the regex start and end patterns against the reported behavior; done means division expressions no longer consume the rest of the file while regex strings still receive syntax highlighting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100