Semantic highlighting in haskell language server

Hey guys, I have implemented semantic tokens plugin for haskell language server. It helps to highlight the code semantically.

The plugin is still in development and bug fix, but it is getting better(Thanks to numerous code reviews and suggestions from @michaelpj @wz1000. Also folks like @konn and Bodigrim giving detailed feedback and suggestions). If you like it you can try out the github master head version of haskell language server. Feedbacks and bug report are very much welcome, so I could make it better. Link to feed back

This plugin is not on by default in haskell language server, you need to enable it in your editor.

=======================================================

Some setup guide

You can install it using ghcup.

 ghcup compile hls -g master --git-describe-version --ghc 9.6.4 --cabal-update 

and then enable the plugin in your editor.
The settings I used in vscode:
With color scheme One Dark Pro

    "haskell": {
        "plugin": {
            "semanticTokens": {
                "config": { },
                "globalOn": true
            },
        },
    },
    "editor.semanticTokenColorCustomizations": {
        "enabled": true, // enable for all themes
        "rules": {
            "namespace": {
                "foreground": "#57f049"
            },
            "interface": {
                "foreground": "#daf049"
            },
            "operator": {
                "foreground": "#58e462"
            },
            "type": {
                "foreground": "#f81eba"
            },
            "typeParameter": {
                "foreground": "#cd4ca0"
            },
            "property": {
                "foreground": "#f81e"
            },
            "method": {
                "foreground": "#1ef1f8"
            },
            "class": {
                "foreground": "#ffe100"
            }
        }
    },
17 Likes

Some more snapshot.

15 Likes