atom / language-coffee-script

CoffeeScript support in Atom
Other
59 stars 56 forks source link

Splitting arrays/objects over code blocks breaks syntax highlighting #160

Open nathancarter opened 7 years ago

nathancarter commented 7 years ago

Description

In literate mode, splitting an array or object over more than one code block breaks syntax highlighting as shown below.

Steps to Reproduce

  1. Create a new file.
  2. Save it with the .litcoffee extension.
  3. Enter the code below.

    
    Some documentation, highlighted correctly.
    
    myArray = [
        'item1'

Some documentation, highlighted as code. :(

    'item2'
    'item3'
]

Things are still not right.


**Expected behavior:** Text without indentation should always be treated and highlighted as Markdown, never mistaken for Coffeescript code.  GitHub highlights it incorrectly as well, as you can see immediately above.

**Actual behavior:** The following screenshot shows that the syntax highlighter has begun to treat unindented code as if it were Coffeescript code.

<img width="478" alt="screen shot 2017-10-25 at 10 38 58 am" src="https://user-images.githubusercontent.com/1316622/32004934-019c58dc-b971-11e7-93bd-10ef3bcad1fc.png">

The same behavior occurs with objects instead of arrays, as shown below.

```litcoffee
Some documentation, highlighted correctly.

    myObject = {
        'item1' : 1

Some documentation, highlighted as code. :(

        'item2' : 2
        'item3' : 3
    }

Things are still not right.
screen shot 2017-10-25 at 10 42 19 am

According to this page, it seems like the GitHub syntax highlighting is actually handled by this package (atom/language-coffee-script), which is a little surprising to me, since there have been differences in the past on how the two behave, but perhaps this is a recent change? If need be, I'm glad to file an issue in the appropriate other repo so that the issue is fixed on GitHub also.

Reproduces how often: 100%

Versions

Atom : 1.21.0

Electron: 1.6.9

Chrome : 56.0.2924.87

Node : 7.4.0

Mac OS X 10.11.6

winstliu commented 7 years ago

GitHub hasn't picked up those changes yet most likely. This will be...difficult to fix. I'll see what I can do.