TypeLenses soft-crashes when opening this file #2004
Labels
component: ghcide
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:haskell-language-server version: 1.2.0.0 (GHC: 8.10.4) (PATH: /Users/admin/.ghcup/bin/haskell-language-server-wrapper-1.2.0) (GIT hash: 8cfe8b2dbdef965ed735a66de38af425809ae48d) Tool versions found on the $PATH cabal: 3.4.0.0 stack: 2.5.1.1 ghc: Not found
Which OS do you use: MacOS
Which lsp-client do you use: VS Code
Describe your project (alternative: link to the project):
package.yaml (excerpt):
stack.yaml
Contents of
hie.yaml
:Steps to reproduce
Open my stack project.
As long as Build.hs is not an open tab, the HLS loads the project just fine.
If Build.hs is already open, or once I open it, almost immediately HLS will stop working.
Type lenses must be turned on in the config.
Here's Build.hs in its entirety.
And Prelouder.hs
```haskell module Prelouder ( module Exports , fprintln , makeGettable , print , putStr , putStrLn ) where-- Exports
import Prelude as Exports
hiding ( fail
, print
, putStr
, putStrLn
, readFile
, uncons
, writeFile
)
import Control.Applicative as Exports
import Control.Arrow as Exports
import Control.Exception.Safe as Exports
import Control.Lens as Exports
hiding ( (<.>)
, element
)
import Control.Lens.Operators as Exports
hiding ( (<.>) )
import Control.Monad as Exports
hiding ( fail )
import Control.Monad.Extra as Exports
( whenJust )
import Control.Monad.Fail as Exports
( MonadFail(..) )
import Control.Monad.IO.Class as Exports
import Control.Monad.Trans.Except as Exports
( Except
, ExceptT(ExceptT)
, except
, mapExcept
, mapExceptT
, runExcept
, runExceptT
, withExcept
, withExceptT
)
import Data.Bool as Exports
import Data.Either as Exports
import Data.Foldable as Exports
import Data.Functor as Exports
import Data.Hashable as Exports
import Data.Int as Exports
import Data.List as Exports
hiding ( uncons )
import Data.Maybe as Exports
import Data.Monoid as Exports
import Data.Scientific as Exports
( Scientific )
import qualified Data.Scientific as Exports.Sci
import Data.String as Exports
import Data.Text as Exports
( Text
, pack
, unpack
)
import qualified Data.Text.Lazy
import Data.Traversable as Exports
import Data.Tuple as Exports
import GHC.Generics as Exports
( Generic )
import System.Directory as Exports
import System.FilePath as Exports
import Text.Printf as Exports
-- Trialling formatting library
import Formatting as Exports
hiding ( left
, right
)
import Formatting.Formatters as Exports
( commas
, fixed
, ords
, plural
, sci
, shortest
, shown
, stext
, string
)
-- Aeson re-exports
import Data.Aeson as Exports
hiding ( (.=) )
import Data.Aeson.Types as Exports
( (.:)
, (.:?)
, FromJSON(..)
, ToJSON(..)
, Value(..)
, withArray
, withObject
)
-- Internal
import qualified Data.Text.IO
import qualified Data.Text.Lazy.Builder as T
import qualified Data.Text.Lazy.IO as T
import qualified Prelude as P
hiding ( fail )
-- Some lens stuff
makeGettable = makeLensesWith (lensRules & generateUpdateableOptics .~ False)
-- IO
putStr :: MonadIO m => Text -> m ()
putStr = liftIO . Data.Text.IO.putStr
putStrLn :: MonadIO m => Text -> m ()
putStrLn = liftIO . Data.Text.IO.putStrLn
print :: (MonadIO m, Show a) => a -> m ()
print = liftIO . P.print
fprintln :: MonadIO m => Format (m ()) a -> a
fprintln m = runFormat m (liftIO . T.putStrLn . T.toLazyText)
haskell-language-server-8.10.4: Maybe.fromJust: Nothing
CallStack (from HasCallStack):
error, called at libraries/base/Data/Maybe.hs:148:21 in base:Data.Maybe
fromJust, called at src/Development/IDE/Plugin/TypeLenses.hs:283:18 in ghcide-1.4.0.0-inplace:Development.IDE.Plugin.TypeLenses
2021-07-06 00:29:19.740563 [ThreadId 1293] INFO hls: File: /Users/admin/code/deep-value/Setup.hs
Hidden: no
Range: 1:8-1:27
Source: not found
Severity: DsError
Message:
Could not load module ‘Distribution.Simple’
It is a member of the hidden package ‘Cabal-3.2.1.0’.
You can run ‘:set -package Cabal’ to expose it.
(Note: this unloads all the modules in the current scope.)
...
2021-07-06 00:29:23.878926 [ThreadId 2106] INFO hls: finish: GetHie (took 0.03s)
Files that failed:
2021-07-06 00:29:23.879824 [ThreadId 2107] INFO hls: finish: GenerateCore (took 0.00s)
Completed (43 files worked, 9 files failed)
haskell-language-server-wrapper: callProcess: /Users/admin/.ghcup/bin/haskell-language-server-8.10.4 "--debug" "." (exit 9): failed
[client] run command: "haskell-language-server-wrapper --lsp"
[client] debug command: "haskell-language-server-wrapper --lsp"
[client] server cwd: undefined
Found "/Users/admin/code/deep-value/hie.yaml" for "/Users/admin/code/deep-value/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.2.0.0, Git revision 8cfe8b2 (dirty) x86_64 ghc-8.10.4
Current directory: /Users/admin/code/deep-value
Operating system: darwin
Arguments: ["--lsp"]
Cradle directory: /Users/admin/code/deep-value
Cradle type: Stack
Tool versions found on the $PATH
cabal: 3.4.0.0
stack: 2.5.1.1
ghc: Not found
Consulting the cradle to get project GHC version...
Project GHC version: 8.10.4
haskell-language-server exe candidates: ["haskell-language-server-8.10.4","haskell-language-server"]
Launching haskell-language-server exe at:/Users/admin/.ghcup/bin/haskell-language-server-8.10.4
haskell-language-server version: 1.2.0.0 (GHC: 8.10.4) (PATH: /Users/admin/.ghcup/bin/haskell-language-server-8.10.4~1.2.0) (GIT hash: 8cfe8b2)
Starting (haskell-language-server)LSP server...
with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"]
in directory: /Users/admin/code/deep-value
Starting LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
Started LSP server in 0.00s
setInitialDynFlags cradle: Cradle {cradleRootDir = "/Users/admin/code/deep-value", cradleOptsProg = CradleAction: Stack}
2021-07-06 00:21:58.947494 [ThreadId 5] INFO hls: Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-4486092460564443533) "file:///Users/admin/code/deep-value"], clientSettings = hashed Nothing}
2021-07-06 00:21:58.962617 [ThreadId 106] INFO hls: Consulting the cradle for "src/Build.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/code/deep-value", cradleOptsProg = CradleAction: Stack}
The text was updated successfully, but these errors were encountered: