Skip to content

Conversation

carlwr
Copy link

@carlwr carlwr commented Jul 30, 2025

Considerably improves the colorization of Haskell code.

Notes:

  • code is colored similarly both with and without the Haskell LSP/semantic tokens, to the extent possible
  • I tried to make choices compatible with the guidelines, and also made choices similar to those for the catppuccin Rust customizations
  • fixes Investigate improvement of Haskell syntax highlighting #360 (the data constructor in one of the comments colors correctly with this PR)

Suitable Haskell sample code to check how this PR colors, and the code used for the screenshots:
https://github.com/catppuccin/catppuccin/blob/main/samples/haskell.hs

Screenshots

Screenshot 2025-07-30 at 18 22 39 Screenshot 2025-07-30 at 18 21 48

@kingcharlesthe3rd

This comment has been minimized.

@sgoudham
Copy link
Contributor

Sorry for the wait on this @carlwr, I wanted to get around to reviewing this soon but I've pre-occupied with other parts of the organisation in my spare time.

Will try to get to this next weekend (23rd/24th Aug) !

Copy link
Contributor

@sgoudham sgoudham left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to raise this PR!

I've tested it out locally and it does look much better. One change I made was to remove rosewater imports and leave it to the default.

I tried making some other changes to better align with the style guide but those ended up having side effects that made the theme look worse overall, so happy to approve and merge this now.

Copy link
Contributor

@sgoudham sgoudham left a comment

Choose a reason for hiding this comment

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

Realised that we won't be able to merge without some more changes, sorry!

@carlwr
Copy link
Author

carlwr commented Sep 2, 2025

@sgoudham thanks for review+feedback - just pushed an update.

Changes include making all textMate selectors Haskell-specific - I had obviously totally missed that in the original PR.

There are also a number of other improvements. In my view the result is now considerably better, and (I think) more aligned to the style guide and de-facto styling of other languages.

Updated screenshot:
Screenshot 2025-09-02 at 17 10 35

The above is with italicKeywords enabled, bracketPairColorization disabled, LSP running. I have tested with and without these, and their permutations.

The Haskell textMate grammar is unfortunately rather low on semantic information, and the LSP tokens are coarse. Taken together, that explains the somewhat lengthy styling logic, but something like this is seemingly needed for a decent result.


Just tell me if you want me to change anything!

@carlwr carlwr requested a review from sgoudham September 2, 2025 16:08
@carlwr
Copy link
Author

carlwr commented Oct 10, 2025

@sgoudham just reminding - also please tell me if there is anything I can do on my part to move this forward.

@sgoudham
Copy link
Contributor

So sorry for the wait on this PR, I'll take a look this upcoming weekend @carlwr

Copy link
Contributor

@sgoudham sgoudham left a comment

Choose a reason for hiding this comment

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

Great work on this, think it looks much better.

I just had one comment surrounding preprocessers. I think the directives should be rosewater and I'm not too sure about the red/peach in the following screenshot:

Image

I think it would make sense to make those rosewater/mauve like below:

Image

I'd be keen to hear your thoughts on this as I don't write Haskell myself that much!

@carlwr
Copy link
Author

carlwr commented Oct 13, 2025

@sgoudham

Thanks!

C-style preprocessor

Agree; updated.

Pragmas

Totally; that red + peach doesn't look too good.

I've changed the pragma specifier (= capiatlized first word) to rosewater as you suggested - that's the right move; per style guide and signalling.

For LANGUAGE pragma arguments, I'm slightly hesitant to mauve - to me it is semantically rather different from ordinary keywords and so looks a bit off in the code to style them the same way.

These are colors that could perhaps be considered, and possible reasoning for the choice. Ranked by my own preference:

  1. red - would follow how other languages style low-level built-in constants like Null; (+) subjectively looks good to my eyes, (+) suitably makes language pragmas visually distinct from other constructs, (-) maybe not in perfect alignment with style guide
  2. peach - since a (language-defined) constant
  3. mauve
  4. teal - since a (language-defined) enum variant; (-) aesthetically poor

I pushed red for the moment, but just tell me your preference and I'll push an update right away - more than happy to go with mauve if you prefer!

@carlwr carlwr requested a review from sgoudham October 13, 2025 09:53
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.

Investigate improvement of Haskell syntax highlighting

4 participants