-
-
Notifications
You must be signed in to change notification settings - Fork 67
feat(syntax): add support for Haskell (#360) #559
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
Open
carlwr
wants to merge
5
commits into
catppuccin:main
Choose a base branch
from
carlwr:add-haskell
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
85ca553
feat(syntax): add support for Haskell (#360)
carlwr 033cc66
fix(haskell): remove rosewater override for imports
sgoudham 4ad1aed
fix(haskell): be specific for type constructors
sgoudham 0909328
chore: remove whitespace
sgoudham 3bc2962
Merge branch 'main' into add-haskell
sgoudham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import type { TextmateColors, ThemeContext } from "@/types"; | ||
|
||
const tokens = (context: ThemeContext): TextmateColors => { | ||
const { palette } = context; | ||
|
||
/* | ||
should preferrably appear visually distinct: | ||
- data constructors -> use blue | ||
- type constructors -> use yellow+italic | ||
- typeclasses -> use yellow | ||
*/ | ||
|
||
return [ | ||
{ | ||
name: "data constructors", | ||
scope: ["meta.declaration.data constant.other", "constant.other"], | ||
settings: { foreground: palette.blue }, | ||
// like functions (capitalized -> still visually distinct) | ||
}, | ||
{ | ||
name: "type constructors", | ||
scope: ["storage.type.haskell"], | ||
settings: { | ||
foreground: palette.yellow, | ||
fontStyle: "italic", | ||
}, | ||
}, | ||
{ | ||
name: "typeclasses", | ||
scope: ["entity.name.type.class"], | ||
settings: { | ||
foreground: palette.yellow, | ||
fontStyle: "", | ||
}, | ||
}, | ||
{ | ||
name: "module name", | ||
scope: "meta.declaration.module.haskell entity.name.namespace.haskell", | ||
settings: { | ||
foreground: palette.peach, // as in Rust | ||
}, | ||
}, | ||
{ | ||
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 }, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 I'd like to see this removed in favour of a more specific scope. |
||
{ | ||
name: "fix else keyword", | ||
scope: ["keyword.control.else.haskell"], | ||
settings: { foreground: palette.mauve }, | ||
// catppuccin default sets to yellow considering it preprocessor-like, which it is not for Haskell | ||
}, | ||
]; | ||
}; | ||
|
||
export default tokens; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.