Skip to content

Can't get FixIt to add import #4467

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

Open
Aster89 opened this issue Dec 17, 2024 · 24 comments
Open

Can't get FixIt to add import #4467

Aster89 opened this issue Dec 17, 2024 · 24 comments
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@Aster89
Copy link

Aster89 commented Dec 17, 2024

Your environment

Which OS do you use?
ArchLinux

Which version of GHC do you use and how did you install it?
9.8.2, managed via GHCup

How is your project built (alternative: link to the project)?
Just created a project via cabal init --simple, answering 2) Executable to the first and only question.

Which LSP client (editor/plugin) do you use?
Terminal Vim + YCM

Which version of HLS do you use and how did you install it?
Should be 2.9.0.1, if I understand correctly (see debug info).

Have you configured HLS in any way (especially: a hie.yaml file)?
Not that I'm aware of (and log says definitely I don't have a hie.yaml file), but please ask specific question if anything makes you think I have.

Steps to reproduce

  1. Initialize a project with cabal init --simple,
  2. add the line f = when,
  3. ask for FixIt on when,
  4. choose 4, i.e. import Control.Monad (when) (any other will do I guess)

Expected behaviour

import Control.Monad (when) should be added in the preamble of the file.

Actual behaviour

Expected behavior does not happen, and this error is triggered instead:

ResponseFailedException: Request failed: -32601: No plugins are available to handle this SMethod_CodeActionResolve request.
 Plugins installed for this method, but not available to handle this request are:
explicit-fields does not handle resolve requests for (unable to determine resolve owner)).
hlint does not handle resolve requests for (unable to determine resolve owner)).
overloaded-record-dot does not handle resolve requests for (unable to determine resolve owner)).
importLens does not handle resolve requests for (unable to determine resolve owner)).

Debug information

This is the log of the HLS:

No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.9.0.1 x86_64 ghc-9.10.1
Current directory: /home/enrico/deleteme
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/enrico/deleteme
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.12.1.0
stack:          Not found
ghc:            9.8.2


Consulting the cradle to get project GHC version...
2024-12-17T16:50:16.704393Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-17T16:50:16.877467Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-17T16:50:16.951529Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
Project GHC version: 9.8.2
haskell-language-server exe candidates: ["haskell-language-server-9.8.2","haskell-language-server"]
Launching haskell-language-server exe at:/home/enrico/.ghcup/bin/haskell-language-server-9.8.2
2024-12-17T16:50:17.014191Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-17T16:50:17.154485Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-17T16:50:17.326941Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-17T16:50:17.393004Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-17T16:50:17.541355Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-17T16:50:17.615097Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --print-libdir
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-17T16:50:19.074650Z | Info | haskell-language-server version: 2.9.0.1 (GHC: 9.8.2) (PATH: /home/enrico/.ghcup/hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin/haskell-language-server-9.8.2)
2024-12-17T16:50:19.075576Z | Info | Directory: /home/enrico/deleteme
2024-12-17T16:50:19.075750Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Info, argsLogFile = Nothing, argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , ghcide-extend-import-action
             , retrie
             , stylish-haskell
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , hlint
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , floskell
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , splice
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2024-12-17T16:50:19.078922Z | Info | Logging heap statistics every 60.00s
 2024-12-17T16:50:19.114935Z | Info | Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , ghcide-extend-import-action
             , retrie
             , stylish-haskell
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , hlint
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , floskell
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , splice
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2024-12-17T16:50:19.115439Z | Info | Starting server
2024-12-17T16:50:19.117428Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 3429100310501239661 "file:///home/enrico/deleteme"], clientSettings = hashed (Just (Object (fromList [])))}
2024-12-17T16:50:19.124235Z | Info | Started LSP server in 0.01s
2024-12-17T16:50:19.465468Z | Warning | LSP: can't register dynamically for: "workspace/didChangeConfiguration"
2024-12-17T16:50:19.471055Z | Info | Cradle path: app/Main.hs
2024-12-17T16:50:19.471207Z | 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.
2024-12-17T16:50:19.473468Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2024-12-17T16:50:19.843868Z | Info | Load cabal cradle using single file
2024-12-17T16:50:20.160300Z | Info | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-repl --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 /home/enrico/deleteme/app/Main.hs
  Environment Variables
    HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT457387-0
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-17T16:50:22.061086Z | Info | Interface files cache directory: /home/enrico/.cache/ghcide/deleteme-0.1.0.0-inplace-deleteme-c38452dbce672bbfc236ac73975e156b42d15720
2024-12-17T16:50:22.070915Z | Info | Making new HscEnv. In-place unit ids: [deleteme-0.1.0.0-inplace-deleteme]
2024-12-17T16:50:27.362922Z | Warning | No plugin handles this "codeAction/resolve" request.
@Aster89 Aster89 added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Dec 17, 2024
@fendor
Copy link
Collaborator

fendor commented Dec 17, 2024

Hi, thank you for the bug report!

Unfortunately, I can not reproduce the described issue on GHC 9.6.6 or 9.8.2.
Perhaps something else is broken in addition?
Try running HLS with --debug and please share the logs of HLS, showing that the CodeAction failed.

The --log-file option might be handy for obtaining the logs.

@Aster89
Copy link
Author

Aster89 commented Dec 18, 2024

Content of the log file after executing

haskell-language-server-9.8.2 --debug --log-file log

is

2024-12-18T05:43:40.539010Z | Info | haskell-language-server version: 2.9.0.1 (GHC: 9.8.2) (PATH: /home/enrico/.ghcup/hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin/haskell-language-server-9.8.2)
2024-12-18T05:43:40.540443Z | Info | Directory: /home/enrico/deleteme
2024-12-18T05:43:40.541007Z | Info | Logging heap statistics every 60.00s
2024-12-18T05:43:40.549981Z | Debug | Initializing exports map from hiedb
2024-12-18T05:43:40.550893Z | Debug | Shake session initialized
2024-12-18T05:43:40.550983Z | Debug | Done initializing exports map from hiedb. Size: 1
2024-12-18T05:43:40.552415Z | Info | Cradle path: app/Main.hs
2024-12-18T05:43:40.552559Z | 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.
2024-12-18T05:43:40.553925Z | Debug | Cradle: Cradle{ cradleRootDir = "/home/enrico/deleteme", cradleOptsProg = CradleAction: Cabal}
2024-12-18T05:43:40.554036Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2024-12-18T05:43:40.554141Z | Debug | Requested to load Cabal cradle using single file mode
2024-12-18T05:43:40.570547Z | Debug | cabal --numeric-version
2024-12-18T05:43:40.643976Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-18T05:43:40.814754Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-18T05:43:40.893639Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-18T05:43:40.894044Z | Info | Load cabal cradle using single file
2024-12-18T05:43:40.967535Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-18T05:43:41.142553Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-18T05:43:41.143869Z | Info | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-repl --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 /home/enrico/deleteme/app/Main.hs
  Environment Variables
    HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT531385-0
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-18T05:43:41.180003Z | Debug | Build profile: -w ghc-9.8.2 -O1
2024-12-18T05:43:41.180269Z | Debug | In order, the following will be built (use -v for more details):
2024-12-18T05:43:41.180488Z | Debug |  - deleteme-0.1.0.0 (interactive) (exe:deleteme) (first run)
2024-12-18T05:43:41.229324Z | Debug | Preprocessing executable 'deleteme' for deleteme-0.1.0.0...
2024-12-18T05:43:41.319062Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-18T05:43:41.502514Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-18T05:43:41.576949Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --print-libdir
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-18T05:43:41.648805Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-18T05:43:41.805443Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-18T05:43:41.881264Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-18T05:43:41.881694Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-odir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-hidir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-hiedir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp/extra-compilation-artifacts/hie","-stubdir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-i","-iapp","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/global-autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/global-autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-optP-include","-optP/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen/cabal_macros.h","-this-unit-id","deleteme-0.1.0.0-inplace-deleteme","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/enrico/.cabal/store/ghc-9.8.2-32bd/package.db","-package-db","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/packagedb/ghc-9.8.2","-package-db","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/package.conf.inplace","-package-id","base-4.19.1.0-9254","-XHaskell2010","app/Main.hs","-Wall","-hide-all-packages"], componentRoot = "/home/enrico/deleteme", componentDependencies = ["deleteme.cabal","cabal.project","cabal.project.local"]},"/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib","9.8.2")
2024-12-18T05:43:41.899007Z | Info | Interface files cache directory: /home/enrico/.cache/ghcide/deleteme-0.1.0.0-inplace-deleteme-c38452dbce672bbfc236ac73975e156b42d15720
2024-12-18T05:43:41.908514Z | Info | Making new HscEnv. In-place unit ids: [deleteme-0.1.0.0-inplace-deleteme]
2024-12-18T05:43:41.933924Z | Debug | New component cache HscEnvEq: (([],Just HscEnvEq 4),fromList [("cabal.project",Nothing),("cabal.project.local",Nothing),("deleteme.cabal",Just 2024-12-18 05:42:51.5519241 UTC)])
2024-12-18T05:43:41.934762Z | Debug | Finished build session
AsyncCancelled
2024-12-18T05:43:41.935025Z | Debug | Known files updated:
  fromList [(TargetFile NormalizedFilePath "/home/enrico/deleteme/app/Main.hs",fromList ["/home/enrico/deleteme/app/Main.hs"])]
2024-12-18T05:43:41.935194Z | Debug | Restarting build session due to new component
Action Queue: [User TypeCheck]
Keys: [GhcSessionIO; , GetKnownTargets; ]
Aborting previous build session took 0.00s 
2024-12-18T05:43:41.935575Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "/home/enrico/deleteme/app/Main.hs"
2024-12-18T05:43:42.186122Z | Debug | hlint: Using extensions for  NormalizedFilePath "/home/enrico/deleteme/app/Main.hs": [ MonomorphismRestriction
                                                                                     , DeepSubsumption
                                                                                     , RelaxedPolyRec
                                                                                     , ForeignFunctionInterface
                                                                                     , ImplicitPrelude
                                                                                     , DoAndIfThenElse
                                                                                     , EmptyDataDecls
                                                                                     , PatternGuards
                                                                                     , DatatypeContexts
                                                                                     , TraditionalRecordSyntax
                                                                                     , StarIsType
                                                                                     , CUSKs
                                                                                     , FieldSelectors ]
2024-12-18T05:43:42.226668Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /home/enrico/deleteme/app/Main.hs
Hidden:   no
Range:    6:1-6:2
Source:   typecheck
Severity: DiagnosticSeverity_Warning
Message:  �[0;93mTop-level binding with no type signature: f :: p�[0m
File:     /home/enrico/deleteme/app/Main.hs
Hidden:   no
Range:    6:5-6:9
Source:   typecheck
Severity: DiagnosticSeverity_Error
Message:  �[0;91mVariable not in scope: when�[0m
2024-12-18T05:43:42.226940Z | Debug | Finished: User TypeCheck Took: 0.29s
2024-12-18T05:43:42.228840Z | Debug | Finished: GetHie Took: 0.00s
2024-12-18T05:43:42.233762Z | Debug | Finished: GenerateCore Took: 0.00s

@fendor
Copy link
Collaborator

fendor commented Dec 18, 2024

Can you try to execute the CodeAction in your editor while passing these flags to HLS?

@Aster89
Copy link
Author

Aster89 commented Dec 18, 2024

@fendor , would you mind clarifying which flags?

@fendor
Copy link
Collaborator

fendor commented Dec 18, 2024

The flags --debug and --log-file :) If you run it in CLI mode, we can't see whether the code action execution failed in any way. So, ideally we get the logs of a real IDE run, with the additional logging output, where you try to use the code action, but HLS throws an error unexpectedly.

@Aster89
Copy link
Author

Aster89 commented Dec 19, 2024

I've passed those options to HLS via the IDE (Vim+YCM); here's the log:

2024-12-19T16:02:59.672766Z | Info | haskell-language-server version: 2.9.0.1 (GHC: 9.8.2) (PATH: /home/enrico/.ghcup/hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin/haskell-language-server-9.8.2)
2024-12-19T16:02:59.674051Z | Info | Directory: /home/enrico/deleteme
2024-12-19T16:02:59.674318Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Debug, argsLogFile = Just "/home/enrico/log", argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , ghcide-extend-import-action
             , retrie
             , stylish-haskell
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , hlint
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , floskell
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , splice
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2024-12-19T16:02:59.677953Z | Info | Logging heap statistics every 60.00s
2024-12-19T16:02:59.709605Z | Info | Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , ghcide-extend-import-action
             , retrie
             , stylish-haskell
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , hlint
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , floskell
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , splice
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2024-12-19T16:02:59.710212Z | Info | Starting server
2024-12-19T16:02:59.711451Z | Debug | LSP: set new config: {  }
2024-12-19T16:02:59.712056Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 3429100310501239661 "file:///home/enrico/deleteme"], clientSettings = hashed (Just (Object (fromList [])))}
2024-12-19T16:02:59.723196Z | Info | Started LSP server in 0.01s
2024-12-19T16:02:59.794511Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-19T16:02:59.960429Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-19T16:03:00.039383Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --print-libdir
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-19T16:03:00.042270Z | Debug | Setting initial dynflags...
2024-12-19T16:03:00.042498Z | Debug | shouldRunSubset: True
2024-12-19T16:03:00.042685Z | Debug | Initializing exports map from hiedb
2024-12-19T16:03:00.043948Z | Debug | Done initializing exports map from hiedb. Size: 2
2024-12-19T16:03:00.044252Z | Warning | LSP: can't register dynamically for: "workspace/didChangeConfiguration"
2024-12-19T16:03:00.044440Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2024-12-19T16:03:00.044629Z | Debug | LSP: set new config: {  }
2024-12-19T16:03:00.044962Z | Debug | Shake session initialized
2024-12-19T16:03:00.044999Z | Debug | Configuration changed: Config {checkParents = CheckOnSave, checkProject = True, formattingProvider = "ormolu", cabalFormattingProvider = "cabal-gild", maxCompletions = 40, sessionLoading = PreferSingleComponentLoading, plugins = fromList []}
2024-12-19T16:03:00.045425Z | Debug | Restarting build session due to config change
Action Queue: []
Keys: [GetClientSettings; ]
Aborting previous build session took 0.00s 
2024-12-19T16:03:00.045770Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2024-12-19T16:03:00.046275Z | Debug | VFS: opening file:///home/enrico/deleteme/app/Main.hs
2024-12-19T16:03:00.047323Z | Debug | Finished build session
AsyncCancelled
2024-12-19T16:03:00.047404Z | Debug | Set files of interst to
    [(/home/enrico/deleteme/app/Main.hs, Modified {firstOpen = True})]
2024-12-19T16:03:00.047733Z | Debug | Restarting build session due to /home/enrico/deleteme/app/Main.hs (modified)
Action Queue: []
Keys: [ GetClientSettings; 
      , GetModificationTime; /home/enrico/deleteme/app/Main.hs
      , IsFileOfInterest; /home/enrico/deleteme/app/Main.hs ]
Aborting previous build session took 0.00s 
2024-12-19T16:03:00.047946Z | Debug | Opened text document: file:///home/enrico/deleteme/app/Main.hs
2024-12-19T16:03:00.048673Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "/home/enrico/deleteme/app/Main.hs"
2024-12-19T16:03:00.049613Z | Info | Cradle path: app/Main.hs
2024-12-19T16:03:00.049858Z | 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.
2024-12-19T16:03:00.052313Z | Debug | Cradle: Cradle{ cradleRootDir = "/home/enrico/deleteme", cradleOptsProg = CradleAction: Cabal}
2024-12-19T16:03:00.052524Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2024-12-19T16:03:00.052703Z | Debug | Requested to load Cabal cradle using single file mode
2024-12-19T16:03:00.083256Z | Debug | cabal --numeric-version
2024-12-19T16:03:00.181085Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-19T16:03:00.387014Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-19T16:03:00.505294Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-19T16:03:00.505665Z | Info | Load cabal cradle using single file
2024-12-19T16:03:00.637088Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-19T16:03:00.863638Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-19T16:03:00.865227Z | Info | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-repl --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 /home/enrico/deleteme/app/Main.hs
  Environment Variables
    HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT778723-0
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-19T16:03:00.950556Z | Debug | Build profile: -w ghc-9.8.2 -O1
2024-12-19T16:03:00.951139Z | Debug | In order, the following will be built (use -v for more details):
2024-12-19T16:03:00.951334Z | Debug |  - deleteme-0.1.0.0 (interactive) (exe:deleteme) (first run)
2024-12-19T16:03:00.996675Z | Debug | Preprocessing executable 'deleteme' for deleteme-0.1.0.0...
2024-12-19T16:03:01.148927Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-19T16:03:01.379033Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-19T16:03:01.522133Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --print-libdir
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-19T16:03:01.655450Z | Debug | cabal exec -v0 -- ghc --print-libdir
2024-12-19T16:03:01.880311Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2024-12-19T16:03:02.007988Z | Debug | cabal --builddir=/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d v2-exec --with-compiler /home/enrico/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/enrico/.cache/hie-bios/ghc-pkg-4dd077f01ab89a1f905d2fbf68335958 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
    HIE_BIOS_GHC_ARGS: -B/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-12-19T16:03:02.008762Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-odir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-hidir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-hiedir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp/extra-compilation-artifacts/hie","-stubdir","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-i","-iapp","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen","-i/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/global-autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/global-autogen","-I/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/deleteme-tmp","-optP-include","-optP/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/build/deleteme/autogen/cabal_macros.h","-this-unit-id","deleteme-0.1.0.0-inplace-deleteme","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/enrico/.cabal/store/ghc-9.8.2-32bd/package.db","-package-db","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/packagedb/ghc-9.8.2","-package-db","/home/enrico/.cache/hie-bios/dist-deleteme-2ffc2a9ada40f7066b50bcbb85df6a6d/build/x86_64-linux/ghc-9.8.2/deleteme-0.1.0.0/x/deleteme/package.conf.inplace","-package-id","base-4.19.1.0-9254","-XHaskell2010","app/Main.hs","-Wall","-hide-all-packages"], componentRoot = "/home/enrico/deleteme", componentDependencies = ["deleteme.cabal","cabal.project","cabal.project.local"]},"/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib","9.8.2")
2024-12-19T16:03:02.020281Z | Info | Interface files cache directory: /home/enrico/.cache/ghcide/deleteme-0.1.0.0-inplace-deleteme-c38452dbce672bbfc236ac73975e156b42d15720
2024-12-19T16:03:02.026159Z | Info | Making new HscEnv. In-place unit ids: [deleteme-0.1.0.0-inplace-deleteme]
2024-12-19T16:03:02.043955Z | Debug | New component cache HscEnvEq: (([],Just HscEnvEq 4),fromList [("cabal.project",Nothing),("cabal.project.local",Nothing),("deleteme.cabal",Just 2024-12-18 05:42:51.5519241 UTC)])
2024-12-19T16:03:02.045181Z | Debug | Finished build session
AsyncCancelled
2024-12-19T16:03:02.045323Z | Debug | Known files updated:
  fromList [(TargetFile NormalizedFilePath "/home/enrico/deleteme/app/Main.hs",fromList ["/home/enrico/deleteme/app/Main.hs"])]
2024-12-19T16:03:02.045887Z | Debug | Restarting build session due to new component
Action Queue: []
Keys: [ IsFileOfInterest; /home/enrico/deleteme/app/Main.hs
      , GhcSessionIO; 
      , GetKnownTargets;  ]
Aborting previous build session took 0.00s 
2024-12-19T16:03:02.046677Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "/home/enrico/deleteme/app/Main.hs"
2024-12-19T16:03:02.049684Z | Debug | hlint: Using extensions for  NormalizedFilePath "/home/enrico/deleteme/app/Main.hs": [ MonomorphismRestriction
                                                                                     , DeepSubsumption
                                                                                     , RelaxedPolyRec
                                                                                     , ForeignFunctionInterface
                                                                                     , ImplicitPrelude
                                                                                     , DoAndIfThenElse
                                                                                     , EmptyDataDecls
                                                                                     , PatternGuards
                                                                                     , DatatypeContexts
                                                                                     , TraditionalRecordSyntax
                                                                                     , StarIsType
                                                                                     , CUSKs
                                                                                     , FieldSelectors ]
2024-12-19T16:03:02.083820Z | Debug | Finished: InitialLoad Took: 0.04s
2024-12-19T16:03:16.612140Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2024-12-19T16:03:16.612303Z | Debug | Finished: Pragmas.GhcSession Took: 0.00s
2024-12-19T16:03:16.612638Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2024-12-19T16:03:16.612800Z | Debug | Finished: changeTypeSignature.GetParsedModule Took: 0.00s
2024-12-19T16:03:16.612804Z | Debug | Finished: retrie Took: 0.00s
2024-12-19T16:03:16.612837Z | Debug | Finished:  Took: 0.00s
2024-12-19T16:03:16.612841Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2024-12-19T16:03:16.612984Z | Debug | Finished: Pragmas.GetFileContents Took: 0.00s
2024-12-19T16:03:16.613048Z | Debug | Finished: GADT.GetParsedModuleWithComments Took: 0.00s
2024-12-19T16:03:16.613171Z | Debug | Finished: QualifyImportedNames.TypeCheck Took: 0.00s
2024-12-19T16:03:16.613256Z | Debug | Finished: Pragmas.GetParsedModule Took: 0.00s
2024-12-19T16:03:16.613460Z | Debug | Finished: splice.codeAction.GitHieAst Took: 0.00s
2024-12-19T16:03:16.613568Z | Debug | Finished: Pragmas.GhcSession Took: 0.00s
2024-12-19T16:03:16.613862Z | Debug | Finished: Pragmas.GetFileContents Took: 0.00s
2024-12-19T16:03:16.614123Z | Debug | Finished: Pragmas.GetParsedModule Took: 0.00s
2024-12-19T16:03:16.614188Z | Debug | Finished: GhcideCodeActions.GetGlobalBindingTypeSigs Took: 0.00s
2024-12-19T16:03:16.614275Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2024-12-19T16:03:16.614400Z | Debug | overloaded-record-dot: Collected record selectors: []
2024-12-19T16:03:16.614440Z | Debug | Finished: ImportActions Took: 0.00s
2024-12-19T16:03:16.614639Z | Debug | Finished: alternateNumberFormat.CollectLiterals Took: 0.00s
2024-12-19T16:03:16.614758Z | Debug | Finished: alternateNumberFormat.GhcSession Took: 0.00s
2024-12-19T16:03:16.614828Z | Debug | Finished: alternateNumberFormat.GetFileContents Took: 0.00s
2024-12-19T16:03:16.614851Z | Debug | explicit-fields: Collected records with wildcards: []
2024-12-19T16:03:16.615055Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2024-12-19T16:03:16.615065Z | Debug | Finished: GhcideCodeActions.getIdeOptions Took: 0.00s
2024-12-19T16:03:16.615153Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2024-12-19T16:03:16.615154Z | Debug | Finished: GhcideCodeActions.GhcSession Took: 0.00s
2024-12-19T16:03:16.615779Z | Debug | Finished: overloadedRecordDot.collectRecordSelectors Took: 0.00s
2024-12-19T16:03:16.616595Z | Debug | Finished: ExplicitFields.CollectRecords Took: 0.00s
2024-12-19T16:03:16.620814Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2024-12-19T16:03:16.620865Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2024-12-19T16:03:16.766740Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2024-12-19T16:03:16.768981Z | Debug | Finished: GhcideCodeActions.TypeCheck Took: 0.00s
2024-12-19T16:03:16.769058Z | Debug | Finished: GhcideCodeActions.GetHieAst Took: 0.00s
2024-12-19T16:03:16.857605Z | Debug | Finished: GhcideCodeActions.getParsedModule Took: 0.00s
2024-12-19T16:03:22.067741Z | Warning | No plugin handles this "codeAction/resolve" request.
2024-12-19T16:03:59.716841Z | Info | Live bytes: 0.00MB Heap size: 0.00MB

@fendor
Copy link
Collaborator

fendor commented Dec 20, 2024

Thanks! I am wondering whether this is related to #4451...
I still can't reproduce, so I guess this bug might be specific to vim and YCM.

@Aster89
Copy link
Author

Aster89 commented Dec 26, 2024

@fendor , would you mind helping understand what I should expect from HLS, in this case? I mean, how can I use it in a standalone way so that I can see what messages it sends to the IDE?

I mean, 2024-12-17T16:50:27.362922Z | Warning | No plugin handles this "codeAction/resolve" request. sounds a lot like YCM sends some request to HLS, and HLS doesn't find a plugin for it.

@fendor
Copy link
Collaborator

fendor commented Dec 28, 2024

It looks like HLS supports codeAction/resolve, so vim always sends a codeAction/resolve request to HLS. However, not all plugins and not all CodeActions have an associated codeAction/resolve handler. For example, if the CodeAction is cheap, there is no reason to do the roundtrip to the server.
However, it looks like some clients added support for */resolve requests and unconditionally asks for codeAction/resolve. HLS rejects this request in some instances, perhaps this leads to vim not applying the codefix it already has around locally.

Presumably, you can tell your client to log the lsp messages. However, I am not sure how to do that with vim.

@fendor
Copy link
Collaborator

fendor commented Jan 6, 2025

@Aster89 In #4478, I implemented a fallback handler for resolve requests. To my understanding, this should fix your issue, could you give it a try?

If you are using ghcup, then the following should work: ghcup compile hls -g enhance/plugins/handle-resolves --ghc <ghc-ver> and then make sure vim is using that binary.

@Aster89
Copy link
Author

Aster89 commented Jan 9, 2025

I just tried. I had my finger crossed for 20 minutes:

$ ghcup compile hls -g enhance/plugins/handle-resolves --ghc 9.8.2
[ Warn  ] New ghc version available. If you want to install this latest version, run 'ghcup install ghc 9.12.1'
[ Warn  ] New cabal version available. If you want to install this latest version, run 'ghcup install cabal 3.14.1.1'
[ Info  ] Fetching git repo https://github.com/haskell/haskell-language-server.git at ref enhance/plugins/handle-resolves (this may take a while)
[ Info  ] Examining git ref enhance/plugins/handle-resolves
[ ...   ]   HLS version (from cabal file): 2.9.0.1
[ ...   ]   branch: enhance/plugins/handle-resolves
[ ...   ]   commit hash: 788f389b5ae825ad875a65f55a2d2ec3c9cc027f
[ Info  ] Building HLS 2.9.0.1 for GHC version 9.8.2

but it didn't end well 😢

[ cabal ] 13 | cabalWrapper = $(makeRelativeToProject "wrappers/cabal" >>= embedStringFile)
[ cabal ]    |                  ^^^^^^^^^^^^^^^^^^^^^
[ cabal ] [16 of 16] Compiling Paths_hie_bios   ( dist/build/autogen/Paths_hie_bios.hs, dist/build/Paths_hie_bios....
[ cabal ] Error: [Cabal-7125]
[ cabal ] Failed to build hie-bios-0.14.0 (which is required by exe:haskell-language-server-wrapper from haskell-l...
[ cabal ] 
[ Error ] [GHCup-08841] BuildFailed failed in dir /home/enrico/.ghcup/tmp/ghcup-ed20c45632fcf139: Process "cabal" with arguments ["v2-install",
[ ...   ]                                                                                                           "-w",
[ ...   ]                                                                                                           "ghc-9.8.2",
[ ...   ]                                                                                                           "--install-method=copy",
[ ...   ]                                                                                                           "--overwrite-policy=always",
[ ...   ]                                                                                                           "--disable-profiling",
[ ...   ]                                                                                                           "--disable-tests",
[ ...   ]                                                                                                           "--installdir=/home/enrico/.ghcup/tmp/ghcup-ed20c45632fcf139/out/9.8.2",
[ ...   ]                                                                                                           "--project-file=cabal.project",
[ ...   ]                                                                                                           "exe:haskell-language-server",
[ ...   ]                                                                                                           "exe:haskell-language-server-wrapper"] failed with exit code 1.
[ ...   ] Check the logs at /home/enrico/.ghcup/logs and the build directory /home/enrico/.ghcup/tmp/ghcup-ed20c45632fcf139 for more clues.
[ ...   ] Make sure to clean up /home/enrico/.ghcup/tmp/ghcup-ed20c45632fcf139 afterwards.

(Make sure to scroll the snippet above to the right to see all of the message.)

@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

Thank you for trying!
This is very weird, I am also on Arch Linux and Template Haskell shouldn't be a problem... I tried it as well and didn't get this error. A real head scratcher :)

But running something like cabal repl -z -w ghc-9.8.2 -b hie-bios works fine, right?

@Aster89
Copy link
Author

Aster89 commented Jan 10, 2025

This is the whole output of that very command:

Resolving dependencies...
Build profile: -w ghc-9.8.2 -O1
In order, the following will be built (use -v for more details):
 - co-log-core-0.3.2.4 (lib) (requires download & build)
 - cryptohash-sha1-0.11.101.0 (lib) (requires build)
 - file-embed-0.0.16.0 (lib) (requires build)
 - libyaml-clib-0.2.5 (lib) (requires build)
 - prettyprinter-1.7.1 (lib) (requires build)
 - temporary-1.3 (lib) (requires build)
 - unix-compat-0.7.3 (lib) (requires build)
 - libyaml-0.1.4 (lib) (requires build)
 - yaml-0.11.11.2 (lib) (requires build)
 - hie-bios-0.14.0 (lib) (requires build)
 - fake-package-0 (interactive) (lib) (first run)
Downloading  co-log-core-0.3.2.4
Starting     file-embed-0.0.16.0 (lib)
Starting     temporary-1.3 (lib)
Starting     unix-compat-0.7.3 (lib)
Starting     prettyprinter-1.7.1 (lib)
Starting     cryptohash-sha1-0.11.101.0 (lib)
Starting     libyaml-clib-0.2.5 (lib)
Downloaded   co-log-core-0.3.2.4
Starting     co-log-core-0.3.2.4 (lib)
Building     temporary-1.3 (lib)
Building     unix-compat-0.7.3 (lib)
Building     cryptohash-sha1-0.11.101.0 (lib)
Building     file-embed-0.0.16.0 (lib)
Building     prettyprinter-1.7.1 (lib)
Building     libyaml-clib-0.2.5 (lib)
Building     co-log-core-0.3.2.4 (lib)
Installing   temporary-1.3 (lib)
Installing   unix-compat-0.7.3 (lib)
Installing   file-embed-0.0.16.0 (lib)
Completed    temporary-1.3 (lib)
Completed    unix-compat-0.7.3 (lib)
Installing   co-log-core-0.3.2.4 (lib)
Installing   cryptohash-sha1-0.11.101.0 (lib)
Completed    file-embed-0.0.16.0 (lib)
Completed    co-log-core-0.3.2.4 (lib)
Completed    cryptohash-sha1-0.11.101.0 (lib)
Installing   libyaml-clib-0.2.5 (lib)
Completed    libyaml-clib-0.2.5 (lib)
Starting     libyaml-0.1.4 (lib)
Building     libyaml-0.1.4 (lib)
Installing   prettyprinter-1.7.1 (lib)
Completed    prettyprinter-1.7.1 (lib)
Installing   libyaml-0.1.4 (lib)
Completed    libyaml-0.1.4 (lib)
Starting     yaml-0.11.11.2 (lib)
Building     yaml-0.11.11.2 (lib)
Installing   yaml-0.11.11.2 (lib)
Completed    yaml-0.11.11.2 (lib)
Starting     hie-bios-0.14.0 (lib)
Building     hie-bios-0.14.0 (lib)

Failed to build hie-bios-0.14.0.
Build log (
/home/enrico/.cache/cabal/logs/ghc-9.8.2/hie-bios-0.14.0-c46efd4852a279bf3e5ae5ebc8c09edfa7e69d7320c7e256168454071c787043.log
):
Configuring library for hie-bios-0.14.0...
Preprocessing library for hie-bios-0.14.0...
Building library for hie-bios-0.14.0...
[ 1 of 16] Compiling HIE.Bios.Config.YAML ( src/HIE/Bios/Config/YAML.hs, dist/build/HIE/Bios/Config/YAML.o, dist/build/HIE/Bios/Config/YAML.dyn_o )
[ 2 of 16] Compiling HIE.Bios.Config  ( src/HIE/Bios/Config.hs, dist/build/HIE/Bios/Config.o, dist/build/HIE/Bios/Config.dyn_o )
[ 3 of 16] Compiling HIE.Bios.Ghc.Gap ( src/HIE/Bios/Ghc/Gap.hs, dist/build/HIE/Bios/Ghc/Gap.o, dist/build/HIE/Bios/Ghc/Gap.dyn_o )

src/HIE/Bios/Ghc/Gap.hs:131:31: error: [GHC-76037]
    Not in scope: data constructor ‘G.NoBackend’
    NB: neither ‘GHC’, ‘GHC.Driver.Env’, ‘GHC.Driver.Main’,
                ‘GHC.Driver.Make’,
                ‘GHC.Driver.Monad’ nor ‘GHC.Driver.Session’ export ‘NoBackend’.
    Suggested fix:
      Perhaps use one of these:
        variable ‘G.noBackend’ (imported from GHC),
        record field of DynFlags ‘G.backend’ (imported from GHC.Driver.Session),
        record field of DynFlags ‘G.backend’ (imported from GHC)
    |
131 | setNoCode d = d { G.backend = G.NoBackend }
    |                               ^^^^^^^^^^^

src/HIE/Bios/Ghc/Gap.hs:160:30: error: [GHC-76037]
    Not in scope: type constructor or class ‘PrintUnqualified’
    |
160 | makeUserStyle :: DynFlags -> PrintUnqualified -> PprStyle
    |                              ^^^^^^^^^^^^^^^^

src/HIE/Bios/Ghc/Gap.hs:223:29: error: [GHC-76037]
    Not in scope: ‘Plugins.plugins’
    NB: the module ‘GHC.Driver.Plugins’ does not export ‘plugins’.
    Suggested fix:
      Perhaps use one of these:
        data constructor ‘Plugins.Plugins’ (imported from GHC.Driver.Plugins),
        data constructor ‘Plugins.Plugin’ (imported from GHC.Driver.Plugins),
        record field of ExternalPlugin ‘Plugins.epPlugin’ (imported from GHC.Driver.Plugins)
    |
223 | numLoadedPlugins = length . Plugins.plugins
    |                             ^^^^^^^^^^^^^^^
[ 6 of 16] Compiling HIE.Bios.Types   ( src/HIE/Bios/Types.hs, dist/build/HIE/Bios/Types.o, dist/build/HIE/Bios/Types.dyn_o )
[ 7 of 16] Compiling HIE.Bios.Flags   ( src/HIE/Bios/Flags.hs, dist/build/HIE/Bios/Flags.o, dist/build/HIE/Bios/Flags.dyn_o )
[12 of 16] Compiling HIE.Bios.Wrappers ( src/HIE/Bios/Wrappers.hs, dist/build/HIE/Bios/Wrappers.o, dist/build/HIE/Bios/Wrappers.dyn_o )

src/HIE/Bios/Wrappers.hs:13:18: error: [GHC-87543]
    • Ambiguous occurrence ‘makeRelativeToProject’.
      It could refer to
         either ‘Data.FileEmbed.makeRelativeToProject’,
                imported from ‘Data.FileEmbed’ at src/HIE/Bios/Wrappers.hs:6:1-21,
             or ‘Language.Haskell.TH.Syntax.makeRelativeToProject’,
                imported from ‘Language.Haskell.TH.Syntax’ at src/HIE/Bios/Wrappers.hs:10:1-33.
    • In the untyped splice:
        $(makeRelativeToProject "wrappers/cabal" >>= embedStringFile)
   |
13 | cabalWrapper = $(makeRelativeToProject "wrappers/cabal" >>= embedStringFile)
   |                  ^^^^^^^^^^^^^^^^^^^^^
[16 of 16] Compiling Paths_hie_bios   ( dist/build/autogen/Paths_hie_bios.hs, dist/build/Paths_hie_bios.o, dist/build/Paths_hie_bios.dyn_o )
Error: [Cabal-7125]
Failed to build hie-bios-0.14.0 (which is required by fake-package-0). See the build log above for details.

@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

I have proof that this should compile fine 😆 https://github.com/haskell/hie-bios/actions/runs/12251791249/job/34177104070

Did you by any chance ever run cabal install --lib? Like, does the file ~/.ghc/x86_64-linux-9.8.2/environments/default exist? If so, delete it, it is almost definitely not what you want.

Also, I have no idea what's going on, I can see that 9.8.2 is used for compiling, but the error message mentions G.NoBackend which is guarded by a CPP statement:

setNoCode :: DynFlags -> DynFlags
#if __GLASGOW_HASKELL__ >= 905
setNoCode d = d { G.backend = G.noBackend }
#else
setNoCode d = d { G.backend = G.NoBackend }
#endif

That's a big what?

@Aster89
Copy link
Author

Aster89 commented Jan 10, 2025

Did you by any chance ever run cabal install --lib?

There's no way I can prove or confute that I've run that in the past (my memory is just bad). I might assume I have, because cabal is still a bit of black magic for me.

Like, does the file ~/.ghc/x86_64-linux-9.8.2/environments/default exist? If so, delete it, it is almost definitely not what you want.

But no, such a file doesn't exist. Or do you mean I should delete one/more/all of the following?

$ tree .ghc/
.ghc/
├── ghci_history
├── x86_64-linux-8.10.3
│   └── environments
│       └── default
├── x86_64-linux-8.10.4
│   └── environments
│       └── default
├── x86_64-linux-8.10.7
│   └── environments
│       └── default
├── x86_64-linux-9.0.1
│   └── environments
│       └── default
├── x86_64-linux-9.2.8
│   └── environments
│       └── default
├── x86_64-linux-9.4.8
│   └── environments
│       └── default
└── x86_64-linux-9.6.1
    └── environments
        └── default

15 directories, 8 files

@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

Presumably, you should delete all of these (except ghci_history), as they probably affect how your program is being built. Fyi, don't run cabal install --lib, if you really need something like it, run cabal install --lib --package-env ., but I digress.

I have no idea right now why the build of hie-bios is failing...

@Aster89
Copy link
Author

Aster89 commented Jan 10, 2025

Thinking back to your question

Did you by any chance ever run cabal install --lib?

and considering that none of those directories is for 9.8.2 nor 9.10.1, the only two versions of GHC installed on my system via GHCup, I assume I could have run that command, but not recently.

Anyway, done rm -r ~/.ghc/!(ghci_history).

ghcup compile hls -g enhance/plugins/handle-resolves --ghc 9.8.2 gives the same error as before, and cabal repl -z -w ghc-9.8.2 -b hie-bios as well, same error.

@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

Hm, and you are sure ghc-9.8.2 was installed via ghcup and not some other way?
Very puzzling.

@Aster89
Copy link
Author

Aster89 commented Jan 10, 2025

Hm, and you are sure ghc-9.8.2 was installed via ghcup and not some other way? Very puzzling.

Yeah, I'm pretty sure. (Updated comment above: still got the same errors.)

@fendor
Copy link
Collaborator

fendor commented Jan 10, 2025

Hm, what is the output of ghc-9.8.2 --info?

@Aster89
Copy link
Author

Aster89 commented Jan 10, 2025

 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("C compiler command","gcc")
 ,("C compiler flags","")
 ,("C++ compiler command","g++")
 ,("C++ compiler flags","")
 ,("C compiler link flags","-fuse-ld=gold")
 ,("C compiler supports -no-pie","YES")
 ,("Haskell CPP command","gcc")
 ,("Haskell CPP flags","-E -undef -traditional")
 ,("ld command","ld.gold")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports filelist","NO")
 ,("ld supports response files","YES")
 ,("ld supports single module","NO")
 ,("ld is GNU ld","YES")
 ,("Merge objects command","ld.gold")
 ,("Merge objects flags","-r")
 ,("ar command","ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("ar supports -L","NO")
 ,("ranlib command","ranlib")
 ,("otool command","otool")
 ,("install_name_tool command","install_name_tool")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("unlit command","/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib/bin/unlit")
 ,("cross compiling","NO")
 ,("target platform string","x86_64-unknown-linux")
 ,("target os","OSLinux")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target word big endian","NO")
 ,("target has GNU nonexec stack","YES")
 ,("target has .ident directive","YES")
 ,("target has subsections via symbols","NO")
 ,("target has libm","YES")
 ,("Unregisterised","NO")
 ,("LLVM target","x86_64-unknown-linux")
 ,("LLVM llc command","llc-14")
 ,("LLVM opt command","opt-14")
 ,("LLVM clang command","clang")
 ,("Use inplace MinGW toolchain","NO")
 ,("Use interpreter","YES")
 ,("Support SMP","YES")
 ,("RTS ways","debug thr thr_debug thr_p dyn debug_dyn thr_dyn thr_debug_dyn thr_debug_p debug_p")
 ,("Tables next to code","YES")
 ,("Leading underscore","NO")
 ,("Use LibFFI","NO")
 ,("RTS expects libdw","NO")
 ,("Project version","9.8.2")
 ,("Project Git commit id","f3225ed4b3f3c4309f9342c5e40643eeb0cc45da")
 ,("Project Version Int","908")
 ,("Project Patch Level","2")
 ,("Project Patch Level1","2")
 ,("Project Patch Level2","0")
 ,("Project Unit Id","ghc-9.8.2-32bd")
 ,("Booter version","9.4.5")
 ,("Stage","2")
 ,("Build platform","x86_64-unknown-linux")
 ,("Host platform","x86_64-unknown-linux")
 ,("Target platform","x86_64-unknown-linux")
 ,("Have interpreter","YES")
 ,("Object splitting supported","NO")
 ,("Have native code generator","YES")
 ,("target has RTS linker","YES")
 ,("Target default backend","native code generator")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Support Backpack","YES")
 ,("Requires unified installed package IDs","YES")
 ,("Uses package keys","YES")
 ,("Uses unit IDs","YES")
 ,("GHC Dynamic","YES")
 ,("GHC Profiled","NO")
 ,("Debug on","NO")
 ,("LibDir","/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib")
 ,("Global Package DB","/home/enrico/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib/package.conf.d")
 ]

@fendor
Copy link
Collaborator

fendor commented Jan 26, 2025

One more idea, can you try to provide the output of cabal repl -v2 -z -b hie-bios ? It is a lot of output, but might help us identify the issue.

@Aster89
Copy link
Author

Aster89 commented Jan 27, 2025

Here's the output: https://gist.github.com/Aster89/2f5463c6e7c3e10d7b267c1a72fe4ca0

Does it help? 😺

@fendor
Copy link
Collaborator

fendor commented Jan 28, 2025

Not as much as I hoped... I am out of ideas, your installation seems to be busted one way or another, or there is some global state which we are overlooking and it causes your build to.... do something completely unhinged.

I can't explain it at all, but it seems, although you are using ghc-9.8.2, the CPP #ifs are ignored.

setNoCode :: DynFlags -> DynFlags
#if __GLASGOW_HASKELL__ >= 905
setNoCode d = d { G.backend = G.noBackend }
#else
setNoCode d = d { G.backend = G.NoBackend }
#endif

Your code reaches the #else which is "impossible".

Did you perhaps install a custom gcc version or something like that? :D
E.g. I have

> gcc --version
gcc (GCC) 14.2.1 20240910

Otherwise, maybe try nuking your ghcup installation ghcup nuke and reinstall?

Maybe @wz1000 has an idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants