Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiveScript lexer #650

Merged
merged 5 commits into from Jun 2, 2020
Merged

LiveScript lexer #650

merged 5 commits into from Jun 2, 2020

Conversation

lkinasiewicz
Copy link
Contributor

@lkinasiewicz lkinasiewicz commented Apr 2, 2017

LiveScript support added, will close #309

lib/rouge/demos/livescript Outdated Show resolved Hide resolved
@lkinasiewicz lkinasiewicz force-pushed the livescript branch 2 times, most recently from e1997a0 to 3545bcd Compare April 23, 2017 17:59
@lkinasiewicz
Copy link
Contributor Author

Just fixed the demo and also improved numbers recognition

jneen
jneen previously requested changes Apr 24, 2017
lib/rouge/lexers/livescript.rb Show resolved Hide resolved
@lkinasiewicz lkinasiewicz force-pushed the livescript branch 2 times, most recently from 2c65cb3 to bffa404 Compare September 22, 2017 16:12
@lkinasiewicz
Copy link
Contributor Author

lkinasiewicz commented Sep 22, 2017

Hi, I used subclassing and also did some changes in coffeescript lexer because I found some bugs in it. Hope it's better now. 🙂

@lkinasiewicz
Copy link
Contributor Author

@jneen ping 🙂

@ice1000
Copy link

ice1000 commented Aug 4, 2018

@jneen ping

@pyrmont pyrmont mentioned this pull request Jun 19, 2019
@HosseinAgha
Copy link

@jneen @pyrmont could you merge this PR? It is much appreciated.
We need LiveScript syntax highlighting in Gitlab and waiting for this to be merged.

@pyrmont
Copy link
Contributor

pyrmont commented Feb 16, 2020

@HosseinAgha It's not currently in a state where it can be merged but I'll have a look tonight and see what I can do.

@pyrmont pyrmont self-assigned this Feb 16, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Feb 16, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Feb 16, 2020

@HosseinAgha Having had more of a look over the code there's a few things that make this situation complicated.

  1. The LiveScript lexer shouldn't subclass the CoffeeScript lexer. I realise that this is the opposite of what @jneen suggested in her review back in 2017 but I think this approach is correct only when one language is a superset of another. While CoffeeScript provided the initial base for LiveScript (as a fork of Coco, itself a fork of CoffeeScript), as best as I can tell, LiveScript is not intended to maintain compatibility with CoffeeScript. In fact, the opposite appears to be true. The LiveScript website has an entire section explaining how to change your CoffeeScript to make it compatible with LiveScript.

  2. The CoffeeScript changes should be split out and submitted as a separate PR. We try to follow a 'separation of concerns' approach to PR submissions. This has benefits for maintenance that are worth preserving. Given how long ago this PR was submitted, it seems unrealistic (and a little unfair) to ask @lkinasiewicz to separate out the CoffeeScript changes. For that reason, I have done so myself and submitted these changes as Improve regex and string lexing in CoffeeScript lexer #1441.

  3. The JavaScript lexer change should be reverted. I'm not sure why @lkinasiewicz made the changes to the JavaScript lexer that they did. They are not consistent with the JavaScript lexers in comparable syntax highlighters (e.g. Pygments and Chroma). I'm not familiar enough with CoffeeScript or LiveScript to know if they were necessary to ensure those lexers worked correctly. If anyone in the thread has any insight, that would be appreciated.

Once #1441 is dealt with, I can look at rebasing this PR and adjusting it as necessary. Sorry that means this will still be more of a wait :(

@HosseinAgha
Copy link

@pyrmont, thank you very much for extensive review. It is good to know that we still have open source projects with such active maintainers. I personally don't know Ruby otherwise I'd be happy to contribute the change. 🙏

@lkinasiewicz
Copy link
Contributor Author

Hi again. 🙂 Thank you for your interest in this merge request (I thought it would never happen) and splitting out coffescript changes to a separate ticket.

The JavaScript lexer change should be reverted. I'm not sure why @lkinasiewicz made the changes to the JavaScript lexer that they did. They are not consistent with the JavaScript lexers in comparable syntax highlighters (e.g. Pygments and Chroma). I'm not familiar enough with CoffeeScript or LiveScript to know if they were necessary to ensure those lexers worked correctly. If anyone in the thread has any insight, that would be appreciated.

The changes in JS lexer are not required for livescript or coffeescript. I thought that if things such as window, global and even sun are treated as built-ins, then it would be nice to also indicate more obvious console that is available in most of environments (node and browsers). Alert is only specific to browsers (like window) so adding it is questionable.
On the other hand all of the words mentioned above depend on the runtime environment so if we want to stay as close to the language specs as possible, I think they all should be removed from JS lexer and treated like regular variables.

Whatever you think about such changes in JS lexer, the commit should be reverted and handled in a new ticket if necessary. Sorry for inconvenience and touching unrelated code.

@pyrmont If I can help you somehow with livescript lexer, please let me know.

I personally don't know Ruby otherwise I'd be happy to contribute the change

@HosseinAgha Neither do I but this doesn't stop me. 😄

@pyrmont
Copy link
Contributor

pyrmont commented Feb 18, 2020

Oh, great! You're here, @lkinasiewicz! I've just merged the changes to the CoffeeScript lexer into master. Could you rebase the changes in this PR against master and then update the LiveScript lexer to no longer depend on CoffeeScript? I can do that but I'm not as familiar as you (hopefully still) are. That would be a big help!

@lkinasiewicz
Copy link
Contributor Author

Sure, I'll try to do it on weekend.

@pyrmont
Copy link
Contributor

pyrmont commented Feb 26, 2020

@lkinasiewicz Sorry for the delay—will get to this soon!

Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very sorry for how long this has taken. Hopefully the comments make sense but if they don't, please do let me know. It's quite late here as I type this so I might have simply made a silly mistake!

lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Show resolved Hide resolved
spec/visual/samples/livescript Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Mar 31, 2020
@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Apr 22, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Apr 22, 2020
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took a few days!

lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Apr 22, 2020
@lkinasiewicz lkinasiewicz requested a review from pyrmont May 24, 2020 15:02
@pyrmont pyrmont added needs-review The PR needs to be reviewed and removed author-action The PR has been reviewed but action by the author is needed labels May 30, 2020
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Show resolved Hide resolved
lib/rouge/lexers/livescript.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels May 30, 2020
@pyrmont pyrmont dismissed jneen’s stale review June 2, 2020 18:44

This issue has been resolved

@pyrmont pyrmont merged commit 865cde6 into rouge-ruby:master Jun 2, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Jun 2, 2020

@lkinasiewicz Thanks for all your work on this. Three years is a long time but this will finally be part of the next version of Rouge, v3.20.0. That's scheduled for release on Tuesday 9 June 🎉

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Jun 2, 2020
@lkinasiewicz lkinasiewicz deleted the livescript branch June 3, 2020 20:46
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
This commit adds a lexer for LiveScript.

Co-authored-by: Michael Camilleri <mike@inqk.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Livescript support
5 participants