Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JustusAdam/language-haskell
Highlighting support for the Haskell language in visual studio code.
https://github.com/JustusAdam/language-haskell
haskell-language highlighting visual-studio-code
Last synced: 14 days ago
JSON representation
Highlighting support for the Haskell language in visual studio code.
- Host: GitHub
- URL: https://github.com/JustusAdam/language-haskell
- Owner: JustusAdam
- License: bsd-3-clause
- Created: 2015-11-18T18:44:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-16T15:16:58.000Z (7 months ago)
- Last Synced: 2024-06-01T20:42:09.620Z (5 months ago)
- Topics: haskell-language, highlighting, visual-studio-code
- Language: Haskell
- Homepage: https://marketplace.visualstudio.com/items/justusadam.language-haskell
- Size: 1.59 MB
- Stars: 95
- Watchers: 9
- Forks: 48
- Open Issues: 39
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Haskell Syntax Highlighting Support
Syntax highlighting support for Haskell and associated languages (e.g. Cabal, Happy and Alex) in Visual Studio Code.
## Syntax highlighting
Adds syntax highlighting support for Haskell (.hs and .lhs). This is a (now heavily) modified version of
the syntax file from the [Haskell TextMate bundle](https://github.com/textmate/haskell.tmbundle).
Additionally there is support for Cabal files (.cabal) via a concoction of my own.Also adds automatic indentation after `where`, `do`, `->` etc. and surrounding brackets (`[]`, `{}` etc)
![Screenshot Haskell](/images/screenshot1.png?raw=true)
![Screenshot Cabal](/images/screenshot-cabal1.png?raw=true)
## Bugs
If you happen to notice bugs or have suggestions for improvements visit the [issue
section](https://github.com/JustusAdam/language-haskell/issues) of the
[repository](https://github.com/JustusAdam/language-haskell).## Themes
This extension provides TextMate scopes for use in syntax highlighting, but the colours displayed
depend on the theme being used.
Unfortunately many themes have incomplete support for the different TextMate scopes, and as a
result different tokens can end up with identical colours.For a theme that supports all the scopes provided by this extension, see the
[Groovy Lambda theme](https://github.com/sheaf/groovy-lambda).## Theme authors
I recently realized that I am woefully unaware of whether there are any themes with Haskell-specific
rules and how changes to this extension affect such themes. If you are a theme author that wishes to
use Haskell specific rules, or are aware of a theme with Haskell specific rules, feel free to get in
touch.With version `3.0.0` some new tm scopes were added, such that now record and GADT definitions can be
distinguished. Let me know if there are any questions about the scope assignment in this
extension or if there are further scope assigments you'd like to see added.We now publish an automatically generated, complete list of the textmate scopes
used in our grammars. You can find the lists of scopes in the
[scope-lists](/scope-lists) directory.## Contributing
This project currently uses the `YAML-tmLanguage` format for language grammars (Haskell, Cabal, alex, happy, ...).
The grammars can be found in the `syntaxes` directory.
To generate `JSON` grammars (which is the format VS Code expects), we use the Node package `js-yaml` (requires `npx` in PATH):```sh
npx js-yaml haskell.YAML-tmLanguage > haskell.json
```For testing, we use the Node package `vscode-tmgrammar-test`. For instance, to generate/check
the scopes of a Haskell source file, run:```sh
npx vscode-tmgrammar-test "-s" "source.haskell" "-g" "syntaxes/haskell.json" "-t" "myTestFile.hs"
```To run the test-suite, simply call `make test`.
This will build the grammar files and run `vscode-tmgrammar-test` on all the files in the testsuite.