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!

Comment on lines +28 to +35
{
name: "typeclasses",
scope: ["entity.name.type.class"],
settings: {
foreground: palette.yellow,
fontStyle: "",
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Everything in this file should be specific to haskell in the textmate scopes. This generic scope will affect other languages outside of haskell and should be carefully introduced in the index.ts file if need be.

I'd like to see this removed in favour of a more specific scope.

Comment on lines 43 to 75
{
name: "type parameters",
scope: ["entity.name.type.parameter", "variable.other.generic-type"],
settings: { foreground: palette.maroon },
},
{
name: "pragma keywords",
scope: [" keyword.other.preprocessor"],
settings: { foreground: palette.red },
},
{
name: "pragma arguments",
scope: [" keyword.other.preprocessor.extension"],
settings: { foreground: palette.peach },
},
{
name: "preprocessor directives",
scope: ["meta.preprocessor"],
settings: { foreground: palette.rosewater },
},

{
name: "type families",
scope: ["entity.name.type.interface"],
settings: { foreground: palette.pink },
// we need something distinct from typeclasses
// -> pick pink which is used for meta-variables in Rust
},
{
name: "getters in data constructors/records",
scope: ["variable.other.property", "variable.other.member"],
settings: { foreground: palette.blue },
},
Copy link
Contributor

@sgoudham sgoudham Aug 25, 2025

Choose a reason for hiding this comment

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

Everything in this file should be specific to haskell in the textmate scopes. These generic scope will affect other languages outside of haskell and should be carefully introduced in the index.ts file if need be.

I'd like to see this removed in favour of a more specific scope.

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