Lukasa / language-restructuredtext

A ReStructuredText syntax package for Atom
MIT License
27 stars 15 forks source link

Syntax Highlighting won't stop in indented blocks #22

Closed raphiz closed 8 years ago

raphiz commented 8 years ago

I stumbled over this issue when I tied to use a code block inside a glossary block. This compiles just fine with sphinx - but the atom language grammar keeps the syntax highlighting to that language until the next line that begins with no indent.

012

Same issue when just using indented blocks:


    Indented Block...
    .. code-block:: java

        Point a = new Point();

    Other stuff in indented block...

Works fine again...
Lukasa commented 8 years ago

Hmm, the grammar might not be restrictive enough here. Let me take a look.

Lukasa commented 8 years ago

Hmm, a quick reading of the regex seems to suggest that the block should stop marking when dedented back to the level of the ... Let me dig further.

Lukasa commented 8 years ago

Ah, no, nevermind, I see it. It looks like that regex could never have matched an indented block. Hmm.

Lukasa commented 8 years ago

@raphiz Can you try the code in #23 and confirm it solves your problem (and more importantly, doesn't introduce new ones)?

raphiz commented 8 years ago

Yay, thanks for the quick response! The code from #23 seems to work just fine for the glossary! However, there is still something going wrong when using just indent blocks...

Some text....

    Now indent...

    .. code-block:: java

        class Foo {
        }

    Still syntax highlighting here...

But here it's gone!

013

I tried out some other test cases - there everything seems to work fine!

Lukasa commented 8 years ago

Hmm, weird. I'll try and take another look this afternoon. Regexes make me sad. :disappointed:

remexre commented 8 years ago

Is there any progress on this? Working with Lisp means code blocks have unmatched 's and `s, which do interesting things to the syntax highlighting for the rest of the file...

Lukasa commented 8 years ago

No progress so far I'm afraid, I'd welcome some investigation!

Alhadis commented 8 years ago

Fixed.