I have the following Visual Studio Code extensions for Haskell installed:
Let's say I create a new stack project:
stack new vscode-red-squiggly-test
And setup Lib.hs
and Main.hs
as follows:
This builds and runs just fine:
stack build
stack exec vscode-red-squiggly-test-exe
Now, if I add an item xyz
to Lib.hs
and reference it in Main.hs
:
as you can see, a red squiggly show up under xyz
.
Now, at this point, I can build and run the program just fine.
The hint when I hover over the squiggly is as follows:
If I close vscode, run stack build
, and relaunch vscode via code .
, the squiggly goes away.
So... is there a way to make the squiggly go away without having to relaunch vscode?
The suggested quick-fix is to add the following to the file:
{-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-}
However, I'd obviously like to avoid that as it turns off the nice feature of detecting truly undefined variables.
Notes
- My Haskell environment is running within WSL on Windows.
- The vscode instance is running on Windows, initiated from within vscode via
code .
.
Update
- I've submitted this as an issue.