-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added PureScript language definition #2526
Added PureScript language definition #2526
Conversation
Thank you for making this language definition @sriharshachilakapati! I will review it once the issue with the many generated files is resolved. This should be quite simple. My guess is that you ran |
I was using pnpm instead of npm and it didn't respect that lock file. My bad, will correct that and push soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, thank you for the language definition @sriharshachilakapati!
I left you a few comments with suggestions and improvements. Please take a look!
The syntax of PureScript follows closely to that of Haskell, and hence I derived this from Haskell's one. Will reply to the comments one by one. |
It's ok to use another language as the base but we usually use the Prism.languages.purescript = Prism.languages.extend('haskell', {
'keyword': /\b(?:ado|case|class|data|derive|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,
'import_statement': {
// The imported or hidden names are not included in this import
// statement. This is because we want to highlight those exactly like
// we do for the names in the program.
pattern: /((?:\r?\n|\r|^)\s*)import\s+(?:[A-Z][\w']*)(?:\.[A-Z][\w']*)*(?:\s+as\s+(?:[A-Z][_a-zA-Z0-9']*)(?:\.[A-Z][\w']*)*)?(?:\s+hiding\b)?/m,
lookbehind: true,
inside: {
'keyword': /\b(?:import|as|hiding)\b/
}
},
// These are builtin variables only. Constructors are highlighted later as a constant.
'builtin': /\b(?:when|unless|liftA1|apply|bind|discard|join|ifM|identity|whenM|unlessM|liftM1|ap|compose|otherwise|top|bottom|recip|eq|notEq|degree|div|mod|lcm|gcd|flip|const|map|void|flap|conj|disj|not|mempty|compare|min|max|comparing|clamp|between|sub|negate|append|add|zero|mul|one|show|unit|absurd)\b/,
}); The main benefits of this approach are that you have to write less code and that improvements from the extended language will trickle down (e.g. I will make a pull to fix the exponential backtracking in Haskell). Please use the above code. It's equivalent to your current approach. I will close all comments on patterns that are identical to Haskell's ones. |
@RunDevelopment I've updated the definition to use extend, but now the test cases are failing.
Where do I specify that dependency in test suite? |
My bad. You have add |
9512d1e
to
2f246ce
Compare
Co-authored-by: Michael Schmidt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A rebuild is required after making any changes to components.json
or any language definition.
Also, my unresolved review comments still stand.
Co-authored-by: Michael Schmidt <[email protected]>
6e2da60
to
4d0d06f
Compare
Thank you for contributing @sriharshachilakapati! |
@RunDevelopment Thanks for your patience in guiding me through the PR. By the way, may I know if there are any plans for a release anytime soon? |
No. We release rather infrequently, so maybe in a few weeks? |
I'm asking cause I came here from another project. If released, I can directly update the package.json file there and it should work for me. |
@sriharshachilakapati I can't commit to anything in particular, but I will spend some time going through PRs and looking at what we should include in our next release. @RunDevelopment We get this question a lot. We may want to consider either a regular release cycle and/or automating the release process. |
@mAAdhaTTah I was thinking about a regular release cycle too (maybe monthly?) and automating sounds good. How would we go about automating? (I always hand it off to you after making the changelog, so how involved is the process of making a new release?) |
It's not super involved, I think you really just need publish perms. But if we can set up a bot to do this stuff for us, it would be a lot easier. |
Perms? We could set up a bot with GH actions. They finally support manual triggers. |
perms => permissions. We could definitely have the bot only act in response to certain users (org members, probably). I'll create an issue to flesh this out a bit. |
I can see I've narrowly missed the boat here, but I've always felt that highlighting some arbitrary set of "built-in" functions isn't very true to the spirit of these languages, since there isn't actually anything special about them. There was a discussion about this in the Haskell Vscode plugin, and it was decided to remove it. |
Added PureScript language definition with test cases and examples.