Lint Haskell code with HLint in Visual Studio Code.
To add hlint to a stack project run
To apply suggestions apply-refact 0.3 or newer must be available in the current stack project. If it's missing you'll see a warning message and the light bulb feature won't be available for HLint suggestions, but linting will continue to work just fine.
To add apply-refact to a stack project run
Just open or save a Haskell file. HLint will automatically check your file.
In some cases HLint can automatically fix issues. In these cases a code action is available on the problematic expression; just click on the light bulb in the left margin.
Note: By default most HLint hints are "suggestions". VSCode doesn't show these in the editor; you'll need to summon the "Problems" window explicitly to see those. You can configure HLint to change the severity of hints if you like.
I wrote this extension because the above does not currently work with HLint 2, and I found the implementation overly verbose and clumsy when trying to address the issue. If I may say this extension has the better code: Less mutable state, much simpler implementation, and better documentation :blush: It also uses