Reputation: 9527
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.
code .
.Upvotes: 1
Views: 1699
Reputation: 2515
This won't help resolve your problem, which is probably a Haskell Language server bug, but the quickest way to restart Haskell Language Server in VS Code is:
Haskell: Restart Haskell LSP Server
This resolves a lot of HLS issues, and is unfortunately often neccessary, since HLs is not quite production-stable yet.
Happy Haskelling!
Upvotes: 5