Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck in "Processing: 1/2" for newly created project #1187

Open
allxiao opened this issue Jan 10, 2025 · 4 comments
Open

Stuck in "Processing: 1/2" for newly created project #1187

allxiao opened this issue Jan 10, 2025 · 4 comments

Comments

@allxiao
Copy link

allxiao commented Jan 10, 2025

When starting the VS Code session from the directory of a newly created project by stack with the following command, the extension is stuck in "Processing: 1/2" status, and all subsequent actions will be blocked, e.g., files cannot be saved because the save hook cannot be executed.

stack new hello-world new-template

It seems adding a hie.yaml file to the root of the project with the following contents will fix the error. It was mentioned in the Stack and Visual Studio Code documentation.

# hie.yaml
cradle:
  stack:

Cradle
HLS may need a 'cradle' - an hie.yaml file - in the project's root directory in order to work well.

The gen-hie tool can help generate such a cradle.

I'm wondering if we can add this tip to the extension documentation.

Your environment

Which OS do you use:

Windows

Steps to reproduce

  1. GHCup toolsets, all using the recommended version
    • GHCup: 0.1.40.0
    • Stack: 3.1.1
    • HLS: 2.9.0.1
    • cabal: 3.12.1.0
    • GHC: 9.4.8, base-4.17.2.1
  2. Stack global configuration entry: system-ghc: true, default-init-snapshot: ghc-9.4.8
  3. Create project with stack new hello-world new-template
  4. cd hello-world && code .
  5. In extension settings, set "Manage HLS" to GHCup
  6. Open a .hs file to activate the extension

Expected behaviour

The extension should complete the initialization and start working

Actual behaviour

The extension was stuck in "Processing: 1/2" status, and blocked further actions.

Include debug information

Execute in the root of your project the command haskell-language-server-wrapper --debug . and paste the logs here (you can find the executable location here):

Debug output:
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper-2.9.0.1.exe) Version 2.9.0.1 x86_64 ghc-9.8.2
Current directory: D:\Code\Haskell\hello-world
Operating system: mingw32
Arguments: ["--debug","."]
Cradle directory: D:\Code\Haskell\hello-world
Cradle type: Stack

Tool versions found on the $PATH
cabal:          3.12.1.0
stack:          3.1.1
ghc:            9.4.8


Consulting the cradle to get project GHC version...
2025-01-14T02:20:08.230119Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml setup --silent
2025-01-14T02:20:08.531209Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml exec ghc -- --numeric-version
Project GHC version: 9.4.8
haskell-language-server exe candidates: ["haskell-language-server-9.4.8.exe","haskell-language-server.exe"]
Launching haskell-language-server exe at:C:\ghcup\bin\haskell-language-server-9.4.8.exe
2025-01-14T02:20:08.598906Z | Info | haskell-language-server version: 2.9.0.1 (GHC: 9.4.8) (PATH: C:\ghcup\bin\haskell-language-server-9.4.8~2.9.0.1.exe)
2025-01-14T02:20:08.609767Z | Info | Directory: D:\Code\Haskell\hello-world
2025-01-14T02:20:08.609767Z | Info | Logging heap statistics every 60.00s
 ghcide setup tester in D:\Code\Haskell\hello-world.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in D:\Code\Haskell\hello-world
Found 4 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE
2025-01-14T02:20:08.625069Z | Debug | Initializing exports map from hiedb
2025-01-14T02:20:08.625069Z | Debug | Shake session initialized

2025-01-14T02:20:08.625069Z | Debug | Done initializing exports map from hiedb. Size: 1
Step 4/4: Type checking the files
2025-01-14T02:20:08.640732Z | Info | Cradle path: app\Main.hs
2025-01-14T02:20:08.640732Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for app\Main.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.
2025-01-14T02:20:08.645552Z | Debug | Cradle: Cradle{ cradleRootDir = "D:\\Code\\Haskell\\hello-world", cradleOptsProg = CradleAction: Stack}
2025-01-14T02:20:08.645552Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-01-14T02:20:08.645552Z | Debug | Requested to load Stack cradle using single file mode
2025-01-14T02:20:08.648584Z | Info | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml repl --no-nix-pure --with-ghc C:\Users\xxx\AppData\Local\hie-bios\wrapper-340ffcbd9b6dc8c3bed91eb5c533e4e3.exe hello-world:exe:hello-world-exe
  Environment Variables
    HIE_BIOS_OUTPUT: C:\Users\xxx\AppData\Local\Temp\HIE473B
2025-01-14T02:20:09.161862Z | Debug | Using main module:
2025-01-14T02:20:09.161862Z | Debug | 1.  Package hello-world, component hello-world:exe:hello-world-exe, with main-is file:
2025-01-14T02:20:09.161862Z | Debug |     D:\Code\Haskell\hello-world\app\Main.hs.
2025-01-14T02:20:09.161862Z | Debug |
2025-01-14T02:20:09.427208Z | Debug | hello-world> initial-build-steps (lib + exe)
2025-01-14T02:20:10.292300Z | Debug |
2025-01-14T02:20:10.292300Z | Debug | Warning: The following GHC options are incompatible with GHCi and have not been passed to it:
2025-01-14T02:20:10.292853Z | Debug |          -threaded.
2025-01-14T02:20:10.292853Z | Debug |
2025-01-14T02:20:10.292853Z | Debug | Configuring GHCi with the following packages: hello-world.
2025-01-14T02:20:10.736373Z | Info | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml path --ghc-package-path
  Environment Variables
    HIE_BIOS_OUTPUT: C:\Users\xxx\AppData\Local\Temp\HIE4F5A
2025-01-14T02:20:10.972645Z | Debug | D:\Code\Haskell\hello-world\.stack-work\install\f517039b\pkgdb;C:\sr\snapshots\f09993a3\pkgdb;C:\ghcup\ghc\9.4.8\lib\package.conf.d
2025-01-14T02:20:11.210104Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml setup --silent
2025-01-14T02:20:11.542100Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml exec ghc -- --print-libdir
2025-01-14T02:20:11.763483Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml setup --silent
2025-01-14T02:20:12.068924Z | Debug | stack --stack-yaml D:\Code\Haskell\hello-world\stack.yaml exec ghc -- --numeric-version
2025-01-14T02:20:12.068924Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-i","-odir=D:\\Code\\Haskell\\hello-world\\.stack-work\\odir","-hidir=D:\\Code\\Haskell\\hello-world\\.stack-work\\odir","-hide-all-packages","-XHaskell2010","-iD:\\Code\\Haskell\\hello-world\\.stack-work\\dist\\f1a1ac53\\build\\hello-world-exe","-iD:\\Code\\Haskell\\hello-world\\app","-iD:\\Code\\Haskell\\hello-world\\.stack-work\\dist\\f1a1ac53\\build\\hello-world-exe\\autogen","-iD:\\Code\\Haskell\\hello-world\\.stack-work\\dist\\f1a1ac53\\build\\global-autogen","-iD:\\Code\\Haskell\\hello-world\\.stack-work\\dist\\f1a1ac53\\build\\hello-world-exe\\hello-world-exe-tmp","-stubdir=D:\\Code\\Haskell\\hello-world\\.stack-work\\dist\\f1a1ac53\\build","-IC:\\Users\\xxx\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20210604\\mingw64\\include","-LC:\\Users\\xxx\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20210604\\mingw64\\lib","-LC:\\Users\\xxx\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20210604\\mingw64\\bin","-package-id=base-4.17.2.1","-package=hello-world-0.1.0.0","-Wall","-Wcompat","-Widentities","-Wincomplete-record-updates","-Wincomplete-uni-patterns","-Wmissing-export-lists","-Wmissing-home-modules","-Wpartial-fields","-Wredundant-constraints","-rtsopts","-with-rtsopts=-N","-optP-include","-optPD:\\Code\\Haskell\\hello-world\\.stack-work\\ghci\\54010912\\cabal_macros.h","-ghci-script=C:\\Users\\xxx\\AppData\\Local\\stack\\ghci-script\\b98e252a\\ghci-script","-package-db","D:\\Code\\Haskell\\hello-world\\.stack-work\\install\\f517039b\\pkgdb","-package-db","C:\\sr\\snapshots\\f09993a3\\pkgdb","-package-db","C:\\ghcup\\ghc\\9.4.8\\lib\\package.conf.d"], componentRoot = "D:\\Code\\Haskell\\hello-world", componentDependencies = ["hello-world.cabal","package.yaml","D:\\Code\\Haskell\\hello-world\\stack.yaml"]},"C:\\ghcup\\ghc\\9.4.8\\lib","9.4.8")
2025-01-14T02:20:12.079536Z | Info | Interface files cache directory: C:\Users\xxx\AppData\Local\ghcide\main-27e7d14d636e615e90989bcc81034992671daed0-27e7d14d636e615e90989bcc81034992671daed0
2025-01-14T02:20:12.094757Z | Info | Making new HscEnv. In-place unit ids: [ main-27e7d14d636e615e90989bcc81034992671daed0 ]

Paste the contents of extension specific log, you can check instructions about how to find it here

Extension log:
2025-01-10T02:20:37.282702Z | Info | Cradle path: Setup.hs
2025-01-10T02:20:37.282702Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\src\\Lib.hs"
2025-01-10T02:20:37.282702Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\test\\Spec.hs"
2025-01-10T02:20:37.282702Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\Setup.hs"
2025-01-10T02:20:37.282702Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\app\\Main.hs"
2025-01-10T02:20:37.282702Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.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.
2025-01-10T02:20:37.282702Z | Debug | Cradle: Cradle{ cradleRootDir = "D:\\Code\\Haskell\\hello-world", cradleOptsProg = CradleAction: Stack}
2025-01-10T02:20:37.282702Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-01-10T02:20:37.282702Z | Debug | Session loading result: Left [CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Multi Cradle: No prefixes matched","pwd: D:\\Code\\Haskell\\hello-world","filepath: D:\\Code\\Haskell\\hello-world\\Setup.hs","prefixes:","(\"D:\\\\Code\\\\Haskell\\\\hello-world\\\\test\",Stack)","(\"D:\\\\Code\\\\Haskell\\\\hello-world\\\\src\",Stack)","(\"D:\\\\Code\\\\Haskell\\\\hello-world\\\\app\\\\Main.hs\",Stack)"]}]
2025-01-10T02:20:37.297955Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     D:\Code\Haskell\hello-world\Setup.hs
Hidden:   no
Range:    1:1-2:1
Source:   cradle
Severity: DiagnosticSeverity_Error
Message:
  Multi Cradle: No prefixes matched
  pwd: D:\Code\Haskell\hello-world
  filepath: D:\Code\Haskell\hello-world\Setup.hs
  prefixes:
  ("D:\\Code\\Haskell\\hello-world\\test",Stack)
  ("D:\\Code\\Haskell\\hello-world\\src",Stack)
  ("D:\\Code\\Haskell\\hello-world\\app\\Main.hs",Stack)
2025-01-10T02:20:37.297955Z | Debug | hlint: Using extensions for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\src\\Lib.hs": [ MonomorphismRestriction
                                                                                               , DeepSubsumption
                                                                                               , RelaxedPolyRec
                                                                                               , ForeignFunctionInterface
                                                                                               , ImplicitPrelude
                                                                                               , DoAndIfThenElse
                                                                                               , EmptyDataDecls
                                                                                               , PatternGuards
                                                                                               , DatatypeContexts
                                                                                               , TraditionalRecordSyntax
                                                                                               , StarIsType
                                                                                               , CUSKs
                                                                                               , FieldSelectors ]
2025-01-10T02:20:37.297955Z | Debug | hlint: Using extensions for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\app\\Main.hs": [ MonomorphismRestriction
                                                                                                , DeepSubsumption
                                                                                                , RelaxedPolyRec
                                                                                                , ForeignFunctionInterface
                                                                                                , ImplicitPrelude
                                                                                                , DoAndIfThenElse
                                                                                                , EmptyDataDecls
                                                                                                , PatternGuards
                                                                                                , DatatypeContexts
                                                                                                , TraditionalRecordSyntax
                                                                                                , StarIsType
                                                                                                , CUSKs
                                                                                                , FieldSelectors ]
2025-01-10T02:20:37.297955Z | Debug | hlint: Using extensions for  NormalizedFilePath "D:\\Code\\Haskell\\hello-world\\test\\Spec.hs": [ MonomorphismRestriction
                                                                                                 , DeepSubsumption
                                                                                                 , RelaxedPolyRec
                                                                                                 , ForeignFunctionInterface
                                                                                                 , ImplicitPrelude
                                                                                                 , DoAndIfThenElse
                                                                                                 , EmptyDataDecls
                                                                                                 , PatternGuards
                                                                                                 , DatatypeContexts
                                                                                                 , TraditionalRecordSyntax
                                                                                                 , StarIsType
                                                                                                 , CUSKs
                                                                                                 , FieldSelectors ]
2025-01-10T02:20:37.659307Z | Debug | Finished: User TypeCheck Took: 0.38s
2025-01-10T02:20:37.684930Z | Debug | Finished: GetHie Took: 0.02s
2025-01-10T02:20:37.684930Z | Debug | Finished: GenerateCore Took: 0.00s
File2025-01-10T02:20:37.684930Z | Debug | LOOKUP PERSISTENT FOR: GetModSummaryWithoutTimestamps
s2025-01-10T02:20:37.684930Z | Debug | LOOKUP PERSISTENT FOR: GhcSessionDeps
 that failed:
 * D:\Code\Haskell\hello-world\Setup.hs

Completed (3 files worked, 1 file failed)
haskell-language-server-wrapper-2.9.0.1.exe: callProcess: C:\ghcup\bin\haskell-language-server-9.4.8.exe "--debug" (exit 1): failed
@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

Hi, thank you for your bug report!

Yeah, this tip (which is only required for stack nowadays) would be a nice addition to the documentation!

The logs you sent look fine, we currently do not support loading of Setup.hs files (often you can delete that file anyway) and the rest of the files were loaded successfully. Does HLS work even though the progress notification at the bottom of the Editor is never cleared?

Note, the hie.yaml you link and the hie.yaml used by haskell-language-server-wrapper --debug . are not the same.

I think the extension logs would be interesting as well if something doesn't work, could you please follow the instructions at https://github.com/haskell/vscode-haskell?tab=readme-ov-file#investigating-and-reporting-problems and share the logs?

@allxiao
Copy link
Author

allxiao commented Jan 14, 2025

The HLS did not work in that case. I did not get autocompletion suggestions.
Another observation was that followed actions will be blocked in queue. For example, if I updated a file and save, the post save hooks would be blocked. The status line displayed "Processing: 1/5". The save could not proceed and the file title tab always showed the dirty state.

I updated the haskell-language-server-wrapper --debug . log in the issue description. The previously captured error was from the vscode output when I enable the --debug option of the HLS in the plugin settings.

@fendor
Copy link
Collaborator

fendor commented Jan 14, 2025

Can you describe what you did for the progress notification to show up? Following your instructions, my HLS works out of the box:

Image

Also, I am not sure what you mean by "Save Hook". What is that? It is not part of vscode-haskell nor HLS. Strictly speaking, I don't think saving can even be blocked by the extension or HLS, it would be the first time seeing that. You don't happen to have interference with other extensions?

@allxiao
Copy link
Author

allxiao commented Jan 15, 2025

@fendor I'm not sure if it is because of the tool version combination. I listed my tool versions in the issue description. I'm on the recommended ghc-9.4.8, while I see you are using ghc-9.8.4. I'm not sure if there is any other difference in tool version.

This is the "Processing: 1/2" status after I started a project without hie.yaml.

Image

Try make some changes and save. It blocks on Getting code actions from 'Haskell'. The file cannot be saved.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants