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

Can't get FixIt to add import #4467

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

Can't get FixIt to add import #4467

Aster89 opened this issue Dec 17, 2024 · 11 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.)

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