Makes themes resilient to stylesheets without trailing newlines. #8594
Conversation
Also deletes a bit of unused cruft from the dark theme.
@MiguelCastillo Try to make comments from the "Files changed" tab of the PR rather than the commit. It keeps everything together better and makes the email from GitHub more useful. The bug is not actually in the LESS parser... it's a problem in our code. The reason I needed to add the newline in this particular place... consider the last line of Light theme's main.less: // This is the default theme and doesn't need to do anything! Without the newline, you end up with: // This is the default theme and doesn't need to do anything!} See? The closing brace is at the end of a comment. Adding the newline before the closing brace ensures that this can't happen. |
@dangoor Yeah, sorry about that. I did it from commits tab as I was quickly going through the changes... But I see what you mean. Looks good, ship it! |
…ines Makes themes resilient to stylesheets without trailing newlines.
@dangoor Shouldn't this get into release branch? (So it doesn't trip up theme authors) |
@SAplayer We could probably just document it at https://github.com/adobe/brackets/wiki/Creating-Themes for now... |
But OTOH this does seem quite safe to put into |
This would be safe to put into release, but it's also pretty minor. It's not so much a problem with missing trailing newlines as it is a problem with putting a line comment as the last line of the file. For example, .foo {
border: 1px solid fuschia;
} With no newline at the end of that, it should still be okay because it'll just get a second brace added to that last line. I would think that putting a line comment as the very last thing in the file wouldn't be common. |
Thanks for adding the notes to the creating themes document, @peterflynn. I don't think this fix is worth pushing to release (the next release will come soon enough!) |
@dangoor Well, your comment made me think about an even more uncommon, but still possible issue: It will then look like this: .foo {
foo: #baa;
}
/*
This block comment breaks everything, yay!
} |
Unclosed block comments are a problem in pretty much any language ;) |
@dangoor Yes, but in this particular case, it's unexpected since the original doc (everything except the last line) is valid... |
Oh well, I just noticed I talked bullshit... I blindly assumed the LESS compiler would compile unclosed block comments (and therefore, such files are valid), but after testing it, I now know it results in an error. |
Heh, no worries! |
Also deletes a bit of unused cruft from the dark theme.
For #8490
cc @MiguelCastillo