haskell / vscode-haskell

VS Code extension for Haskell, powered by haskell-language-server
https://marketplace.visualstudio.com/items?itemName=haskell.haskell
Other
553 stars 90 forks source link

[Prerelease 2.1.2] ERROR Internal Error: n.forEach is not a function #586

Closed Abastro closed 2 years ago

Abastro commented 2 years ago

Your environment

Which OS do you use: Ubuntu

Steps to reproduce

Requires Prerelease 2.1.2. Occurs even on simplest setup with *.cabal on executable, whether hie.yaml exists or not.

Expected behaviour

Haskell extension should not crash while loading haskell files.

Actual behaviour

ERROR Internal Error: n.forEach is not a function and then any capability of haskell extension does not work.

i.e.

2022-04-20 01:13:19.3260000 [client] ERROR Internal Error: n.forEach is not a function
2022-04-20 01:13:19.3270000 [client] ERROR TypeError: n.forEach is not a function
    at R (/home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:436088)
    at /home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:441419
    at Generator.next (<anonymous>)
    at s (/home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:430656)

Include debug information

Debug output (`haskell-language-server --debug`): ``` No 'hie.yaml' found. Try to discover the project type! Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.6.1.1 x86_64 ghc-9.2.2 Current directory: /home/abastro/Documents/Projects/DiscreteRecipe Operating system: linux Arguments: ["--debug"] Cradle directory: /home/abastro/Documents/Projects/DiscreteRecipe Cradle type: Cabal Tool versions found on the $PATH cabal: 3.6.2.0 stack: 2.7.5 ghc: 9.2.2 Consulting the cradle to get project GHC version... Project GHC version: 9.2.2 haskell-language-server exe candidates: ["haskell-language-server-9.2.2","haskell-language-server"] Launching haskell-language-server exe at:/home/abastro/.ghcup/bin/haskell-language-server-9.2.2 2022-04-20T01:21:04.940594Z | Info | No log file specified; using stderr. 2022-04-20T01:21:04.941531Z | Info | haskell-language-server version: 1.6.1.1 (GHC: 9.2.2) (PATH: /home/abastro/.ghcup/bin/haskell-language-server-9.2.2~1.6.1.1) 2022-04-20T01:21:04.942370Z | Info | Directory: /home/abastro/Documents/Projects/DiscreteRecipe 2022-04-20T01:21:04.942964Z | Info | Logging heap statistics every 60.00s ghcide setup tester in /home/abastro/Documents/Projects/DiscreteRecipe. Report bugs at https://github.com/haskell/haskell-language-server/issues Step 1/4: Finding files to test in /home/abastro/Documents/Projects/DiscreteRecipe Found 3 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle () Step 3/4: Initializing the IDE 2022-04-20T01:21:04.951960Z | Debug | Initializing exports map from hiedb 2022-04-20T01:21:04.952901Z | Debug | Shake session initialized Step 4/4: Type checking the files 2022-04-20T01:21:04.954574Z | Debug | Done initializing exports map from hiedb. Size: 6 2022-04-20T01:21:04.956350Z | Info | Cradle path: src/Stack/Process.hs 2022-04-20T01:21:04.956567Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Stack/Process.hs. Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie). You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error. 2022-04-20T01:21:04.961022Z | Debug | Cradle: Cradle {cradleRootDir = "/home/abastro/Documents/Projects/DiscreteRecipe", cradleOptsProg = CradleAction: Cabal} 2022-04-20 10:21:05.241250521 [ThreadId 43] INFO hie-bios: Build profile: -w ghc-9.2.2 -O1 2022-04-20 10:21:05.241606805 [ThreadId 43] INFO hie-bios: In order, the following will be built (use -v for more details): 2022-04-20 10:21:05.241761933 [ThreadId 43] INFO hie-bios: - DiscreteRecipe-0.1.0.0 (exe:DiscreteRecipe) (configuration changed) 2022-04-20 10:21:05.250912943 [ThreadId 43] INFO hie-bios: Configuring executable 'DiscreteRecipe' for DiscreteRecipe-0.1.0.0.. 2022-04-20 10:21:07.282124335 [ThreadId 43] INFO hie-bios: Preprocessing executable 'DiscreteRecipe' for DiscreteRecipe-0.1.0.0.. 2022-04-20T01:21:07.628080Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-odir","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-hidir","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-stubdir","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-i","-i/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-isrc","-i/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/autogen","-i/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/global-autogen","-I/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/autogen","-I/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/global-autogen","-I/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/DiscreteRecipe-tmp","-optP-include","-optP/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/build/DiscreteRecipe/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/abastro/.cabal/store/ghc-9.2.2/package.db","-package-db","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/packagedb/ghc-9.2.2","-package-db","/home/abastro/.cache/hie-bios/dist-DiscreteRecipe-aa0d1898b3d8a1ecd3515cea19613d0b/build/x86_64-linux/ghc-9.2.2/DiscreteRecipe-0.1.0.0/x/DiscreteRecipe/package.conf.inplace","-package-id","base-4.16.1.0","-package-id","containers-0.6.5.1","-package-id","mtl-2.2.2","-package-id","transformers-0.5.6.2","-package-id","vector-0.12.3.1-177b9924380e76a5e3d568ee8ddaf231109e72753376411c9ca13918b8319a21","-XGHC2021","-XFunctionalDependencies","src/Main.hs","Stack.Repeat","Stack.Process","-Wall","-hide-all-packages","-haddock"], componentRoot = "/home/abastro/Documents/Projects/DiscreteRecipe", componentDependencies = ["DiscreteRecipe.cabal","cabal.project","cabal.project.local"]},"/home/abastro/.ghcup/ghc/9.2.2/lib/ghc-9.2.2") 2022-04-20T01:21:07.746405Z | Info | Interface files cache directory: /home/abastro/.cache/ghcide/main-fa477ac25b555d81f210eeaa55947511b0dd7134 2022-04-20T01:21:07.746661Z | Info | Making new HscEnv. In-place unit ids: [main] 2022-04-20T01:21:07.866965Z | Debug | New component cache HscEnvEq: (([],Just HscEnvEq 5),fromList [("DiscreteRecipe.cabal",Just 2022-04-13 11:09:18.43887533 UTC),("cabal.project",Just 2022-03-24 04:53:44.494236545 UTC),("cabal.project.local",Just 2021-09-24 12:26:24 UTC)]) 2022-04-20T01:21:07.869454Z | Debug | Known files updated: fromList [(TargetFile NormalizedFilePath "/home/abastro/Documents/Projects/DiscreteRecipe/src/Main.hs",fromList ["/home/abastro/Documents/Projects/DiscreteRecipe/src/Main.hs"]),(TargetModule (ModuleName "Stack.Process"),fromList ["/home/abastro/Documents/Projects/DiscreteRecipe/src/Stack/Process.hs"]),(TargetModule (ModuleName "Stack.Repeat"),fromList ["/home/abastro/Documents/Projects/DiscreteRecipe/src/Stack/Repeat.hs"]),(TargetFile NormalizedFilePath "/home/abastro/Documents/Projects/DiscreteRecipe/src/Stack/Process.hs",fromList ["/home/abastro/Documents/Projects/DiscreteRecipe/src/Stack/Process.hs"])] 2022-04-20T01:21:07.869880Z | Debug | Finished build session AsyncCancelled 2022-04-20T01:21:07.869983Z | Debug | Restarting build session due to new component Action Queue: [User TypeCheck] Keys: [GhcSessionIO; , GetKnownTargets; ] Aborting previous build session took 0.00s 2022-04-20T01:21:07.924094Z | Debug | Finished: User TypeCheck Took: 0.05s 2022-04-20T01:21:07.992921Z | Debug | Finished: GetHie Took: 0.06s 2022-04-20T01:21:07.993879Z | Debug | Finished: GenerateCore Took: 0.00s Completed (3 files worked, 0 files failed) ```
Extension log (Haskell extension's debug output): ``` 2022-04-20 01:29:38.8230000 [client] DEBUG Environment variables: 2022-04-20 01:29:38.8230000 [client] DEBUG PATH: /home/abastro/.opam/default/bin:/usr/local/texlive/2021/bin/x86_64-linux:/home/abastro/.nvm/versions/node/v17.5.0/bin:/home/abastro/.cabal/bin:/home/abastro/.ghcup/bin:/home/abastro/.opam/default/bin:/usr/local/texlive/2021/bin/x86_64-linux:/home/abastro/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/abastro/.cabal/bin:/home/abastro/.ghcup/bin 2022-04-20 01:29:38.8230000 [client] INFO Finding haskell-language-server 2022-04-20 01:29:38.8240000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:38.8240000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:38.8320000 [client] INFO Executing 'ghcup --no-verbose upgrade' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.2200000 [client] DEBUG Execution of 'ghcup --no-verbose upgrade' terminated with code 0 2022-04-20 01:29:39.2210000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.2210000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.2300000 [client] INFO Executing 'ghcup --no-verbose list -t hls -c installed -r' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.2880000 [client] DEBUG Execution of 'ghcup --no-verbose list -t hls -c installed -r' terminated with code 0 2022-04-20 01:29:39.2890000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.2890000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.2990000 [client] INFO Executing 'ghcup --no-verbose list -t cabal -c installed -r' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.3580000 [client] DEBUG Execution of 'ghcup --no-verbose list -t cabal -c installed -r' terminated with code 0 2022-04-20 01:29:39.3590000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.3590000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.3680000 [client] INFO Executing 'ghcup --no-verbose list -t stack -c installed -r' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.4260000 [client] DEBUG Execution of 'ghcup --no-verbose list -t stack -c installed -r' terminated with code 0 2022-04-20 01:29:39.4360000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.4360000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.4450000 [client] INFO Executing 'ghcup --no-verbose whereis hls 1.6.1.1' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.4620000 [client] DEBUG Execution of 'ghcup --no-verbose whereis hls 1.6.1.1' terminated with code 0 2022-04-20 01:29:39.4630000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.4630000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.4720000 [client] INFO Executing 'ghcup --no-verbose whereis cabal 3.6.2.0' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.4900000 [client] DEBUG Execution of 'ghcup --no-verbose whereis cabal 3.6.2.0' terminated with code 0 2022-04-20 01:29:39.4910000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.4910000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.5000000 [client] INFO Executing 'ghcup --no-verbose whereis stack 2.7.5' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.5180000 [client] DEBUG Execution of 'ghcup --no-verbose whereis stack 2.7.5' terminated with code 0 2022-04-20 01:29:39.5260000 [client] INFO Checking for ghcup installation 2022-04-20 01:29:39.5260000 [client] INFO found ghcup at ghcup 2022-04-20 01:29:39.5350000 [client] INFO Executing 'ghcup --no-verbose run --hls 1.6.1.1 --cabal 3.6.2.0 --stack 2.7.5 --install' in cwd '/home/abastro/xmonad-profiles' 2022-04-20 01:29:39.5920000 [client] DEBUG Execution of 'ghcup --no-verbose run --hls 1.6.1.1 --cabal 3.6.2.0 --stack 2.7.5 --install' terminated with code 0 2022-04-20 01:29:39.5920000 [client] INFO Working out the project GHC version. This might take a while... 2022-04-20 01:29:39.5930000 [client] INFO Executing 'haskell-language-server-wrapper --project-ghc-version' in cwd '/home/abastro/Documents/Projects/DiscreteRecipe' 2022-04-20 01:29:40.5800000 [client] DEBUG Execution of 'haskell-language-server-wrapper --project-ghc-version' terminated with code 0 2022-04-20 01:29:40.5800000 [client] INFO The GHC version for the project or file: 9.2.2 2022-04-20 01:29:40.9060000 [client] INFO Platform constants: Linux_UnknownLinux, A_64 2022-04-20 01:29:40.9060000 [client] ERROR Internal Error: n.forEach is not a function 2022-04-20 01:29:40.9070000 [client] ERROR TypeError: n.forEach is not a function at R (/home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:436088) at /home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:441419 at Generator.next () at s (/home/abastro/.vscode/extensions/haskell.haskell-2.1.2/dist/extension.js:2:430656) ```

It does seem like the extension side is having problems.

Abastro commented 2 years ago

Also I am curious.. Why is n.forEach is not a function a TypeError???

fendor commented 2 years ago

Yeah, I was curious, too, fix is in #585 The issue is that a JSON value was improperly handled as a Map

fendor commented 2 years ago

New pre-release is out

Abastro commented 2 years ago

Thanks! Did you have some fun with JS?

fendor commented 2 years ago

yes :heart:

wolverian commented 2 years ago

I'm not seeing the new pre-release in VS Code extensions - do I need to install it separately? (Edit: I have 2.1.2 installed currently.)

fendor commented 2 years ago

I think the VSCode Marketplace might have issues at the moment. Response time seems to be high...

Anyway, it looks like the version is availabloe: https://marketplace.visualstudio.com/items?itemName=haskell.haskell

fendor commented 2 years ago

It might take a while, VSX is also not updated yet

Abastro commented 2 years ago

I just realized that VSC marketplace does not let me view new versions until I refresh vscode. Hmmm

fendor commented 2 years ago

Something seems busted on VSC marketplace. I was able to download the version 2.1.3 on VSX though.

Sorry for the inconvenience, and thank you to everyone who tests the pre-release!

Abastro commented 2 years ago

Great kudos for you fendor! Other than hiccups like this, it works astonishingly well! I was able to install new version on VSCode, it just did not display the new version until I restarted VSCode.

fendor commented 2 years ago

Thank you, but we have to shift most kudos (and blame ;)) to hasufell who pioneered and implemented the whole switch to ghcup :)