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

Font lock types in their own color #1237

Merged
merged 5 commits into from Apr 4, 2016
Merged

Font lock types in their own color #1237

merged 5 commits into from Apr 4, 2016

Conversation

gracjan
Copy link
Contributor

@gracjan gracjan commented Mar 28, 2016

Fixes #899.

@gracjan
Copy link
Contributor Author

gracjan commented Mar 28, 2016

So it currently looks like this:

font-lock-types

font-lock-types-case

@gracjan gracjan changed the title Font lock types in their own color [WIP] Font lock types in their own color Mar 28, 2016
@gracjan
Copy link
Contributor Author

gracjan commented Mar 28, 2016

Todo:

  • multiline cases do not refresh properly, possibly use font-lock-extend-region-functions
  • handle class and instance with functional deps
  • handle data ... where (looks easy)
  • handle normal data X1 = X2 Int String (this is hard, has to know that X2 is constructor but Int and String are types )
  • write lots of unit cases
  • handle module (...) header (very hard)
  • patterns? views?
  • handle type MyInt = Int (hard, has to cross equal sign)
  • handle data family and type family
  • handle data X = Int :+: String | String :-: Int
  • handle data X a b = Either a Int :+: Either String b | Either a String :-: Either Int b

@gracjan
Copy link
Contributor Author

gracjan commented Mar 29, 2016

In case of data X = X1 Int | X2 String everything is a type except uppercase constructors directly following equals or vertical bar.

@geraldus
Copy link
Contributor

Nice solution (:

@gracjan
Copy link
Contributor Author

gracjan commented Mar 29, 2016

So both patterns and views work only with constructors.

((and (member (match-string-no-properties 0)
'("<-" "=" "<-" "←" "," ";"
")" "]" "}" "|"
"case" "class" "data" "default" "deriving" "do"
Copy link
Contributor

Choose a reason for hiding this comment

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

can haskell-font-lock--reverved-ids be re-used here? (:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorta maybe. I mean I'm too tired to make sure that all keywords end types. Is forall a keyword? is there other keyword that can happen in types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And, btw, thanks for reading this. It wasn't easy to write so I'm grateful for all the help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I always read everything, PRs, issues, and code (: But, unfortunately most of the time I have nothing to add ):

@gracjan gracjan changed the title [WIP] Font lock types in their own color Font lock types in their own color Mar 29, 2016
@gracjan
Copy link
Contributor Author

gracjan commented Mar 29, 2016

Mostly done. Lets give it a couple of days lying here and then we merge.

@gracjan gracjan merged commit c4c74ba into haskell:master Apr 4, 2016
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.

None yet

2 participants