Skip to content

Conversation

hdgarrood
Copy link
Collaborator

Refs purescript/pursuit#115

I started with the Haskell grammar (from here) and made some tweaks. Notably:

  • All of the special cases for a certain set of Prelude functions and types is gone, since Prelude is just a normal library now.
  • Removed a bunch of stuff that only applies to haskell, like CPP and pragmas.
  • forall is now highlighted properly as a keyword in type signatures
  • Within type class declarations, type constructors, type variables, and the left arrow <= (for when there are superclasses) are now highlighted properly.
  • Type constructors in foreign imports are no longer highlighted as data constructors.
  • Arrows like -> in case, or <- in do, are highlighted as keywords. Unfortunately the -> function type constructor is highlighted as a keyword too, I couldn't work out how to stop this from happening.

Unresolved questions:

  • grammars/purescript.cson is generated by a script. Would you rather it were not checked in?
  • We should note that this grammar originally came from language-haskell, perhaps in the license? I wasn't sure how you'd want to do that.

hdgarrood added 14 commits July 18, 2015 07:07
The script appends a .purescript so they're not necessary
Also add todo.txt
This should stop type classes from appearing differently based on
context.
Now types in foreign imports get highlighted as types, not as data
constructors
- Remove 'declaration.class' as it gives weird highlighting, replaced
  with 'declaration.typeclass'
- Highlight type signatures properly inside class declarations
- Handle left-pointing fat arrows, for superclasses
eg: <- in do blocks, -> in case statements

Unfortunately, -> the function type constructor is now highlighted like
a keyword. I couldn't work out how to avoid this.
@ghost
Copy link

ghost commented Jul 19, 2015

Thanks for the PR, this looks really nice. Checking in the grammar file should be fine I think and it's also okay to note something in the license file. I should mention though that I'm not really using Atom much these days so if you're interested in improving this I would be happy to transfer ownership of the repo and let you take over.

* Add language-haskell's LICENSE
* Don't use a postinstall script (because the grammar file is checked in
  now)
* Add a note to the grammar generating script about how to regenerate
@hdgarrood
Copy link
Collaborator Author

Cool, thanks. I think this is good to merge now. I'm actually not an Atom user either, I'm just trying to improve PureScript highlighting on Github.

ghost pushed a commit that referenced this pull request Jul 19, 2015
@ghost ghost merged commit 5fd5b64 into purescript-contrib:master Jul 19, 2015
@hdgarrood hdgarrood deleted the better-highlighting branch July 19, 2015 07:55
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant