Closed
Description
Subject of the issue
If an extension (LambdaCase in my case) is enabled using default-extensions
in the cabal file and a module is using the extension, using the "Apply hint" code action fails with an error like this:
LSP :: Please open an issue in lsp-mode for implementing `98488:hlint:applyAll'.
(error "hlint:applyAll: \"\\\"(RealSrcSpan SrcSpanOneLine \\\\\\\"/tmp/Update98488-114.hs\\\\\\\" 148 23 27,\\\\\\\"Illegal lambda-case (use -XLambdaCase)\\\\\\\")\\\\nCallStack (from HasCallStack):\\\\n error, called at src/Refact/Internal.hs:84:13 in apply-refact-0.8.2.1-e5ada769d1ed74b27020ceda163d33b8a75e91b8939fcd90cc77787a3840b289:Refact.Internal\\\"\"")
Your environment
- Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/axeman/.local/bin/haskell-language-server-8.8.4) Tool versions found on the $PATH cabal: 3.2.0.0 stack: 2.3.3 ghc: 8.8.4
- Which lsp-client do you use
Emacs - Describe your project (alternative: link to the project)
https://github.com/wireapp/wire-server - Contents of
hie.yaml
hie.yaml
cradle:
stack:
- path: ./libs/api-bot/src
component: api-bot:lib
- path: ./libs/api-client/src
component: api-client:lib
- path: ./tools/api-simulations/lib/src
component: api-simulations:lib
- path: ./tools/api-simulations/loadtest/src
component: api-simulations:exe:api-loadtest
- path: ./tools/api-simulations/smoketest/src
component: api-simulations:exe:api-smoketest
- path: ./tools/db/auto-whitelist/src
component: auto-whitelist:exe:auto-whitelist
- path: ./libs/bilge/src
component: bilge:lib
- path: ./tools/db/billing-team-member-backfill/src
component: billing-team-member-backfill:exe:billing-team-member-backfill
- path: ./tools/bonanza/src
component: bonanza:lib
- path: ./tools/bonanza/main/Main.hs
component: bonanza:exe:bonanza
- path: ./tools/bonanza/main/KibanaRaw.hs
component: bonanza:exe:kibana-raw
- path: ./tools/bonanza/main/Kibanana.hs
component: bonanza:exe:kibanana
- path: ./tools/bonanza/test/unit
component: bonanza:test:bonanza-tests
- path: ./services/brig/src
component: brig:lib
- path: ./services/brig/src/Main.hs
component: brig:exe:brig
- path: ./services/brig/index/src/Main.hs
component: brig:exe:brig-index
- path: ./services/brig/test/integration
component: brig:exe:brig-integration
- path: ./services/brig/schema/src
component: brig:exe:brig-schema
- path: ./services/brig/test/unit
component: brig:test:brig-tests
- path: ./libs/brig-types/src
component: brig-types:lib
- path: ./libs/brig-types/test/unit
component: brig-types:test:brig-types-tests
- path: ./services/cannon/src
component: cannon:lib
- path: ./services/cannon/src/Main.hs
component: cannon:exe:cannon
- path: ./services/cannon/test
component: cannon:test:cannon-tests
- path: ./services/cargohold/src
component: cargohold:lib
- path: ./services/cargohold/src/Main.hs
component: cargohold:exe:cargohold
- path: ./services/cargohold/test/integration
component: cargohold:exe:cargohold-integration
- path: ./libs/cargohold-types/src
component: cargohold-types:lib
- path: ./libs/cassandra-util/src
component: cassandra-util:lib
- path: ./libs/dns-util/src
component: dns-util:lib
- path: ./libs/dns-util/test
component: dns-util:test:spec
- path: ./libs/extended/src
component: extended:lib
- path: ./services/federator/src
component: federator:lib
- path: ./services/federator/exec
component: federator:exe:federator
- path: ./tools/db/find-undead/src
component: find-undead:exe:find-undead
- path: ./services/galley/src
component: galley:lib
- path: ./services/galley/src/Main.hs
component: galley:exe:galley
- path: ./services/galley/test/integration
component: galley:exe:galley-integration
- path: ./services/galley/migrate-data/src
component: galley:exe:galley-migrate-data
- path: ./services/galley/schema/src
component: galley:exe:galley-schema
- path: ./services/galley/test/unit
component: galley:test:galley-types-tests
- path: ./libs/galley-types/src
component: galley-types:lib
- path: ./libs/galley-types/test/unit
component: galley-types:test:galley-types-tests
- path: ./services/gundeck/src
component: gundeck:lib
- path: ./services/gundeck/src/Main.hs
component: gundeck:exe:gundeck
- path: ./services/gundeck/test/integration
component: gundeck:exe:gundeck-integration
- path: ./services/gundeck/schema/src
component: gundeck:exe:gundeck-schema
- path: ./services/gundeck/test/unit
component: gundeck:test:gundeck-tests
- path: ./services/gundeck/test/unit
component: gundeck:bench:gundeck-bench
- path: ./libs/gundeck-types/src
component: gundeck-types:lib
- path: ./libs/hscim/src
component: hscim:lib
- path: ./libs/hscim/server
component: hscim:exe:hscim-server
- path: ./libs/hscim/test
component: hscim:test:spec
- path: ./libs/imports/src
component: imports:lib
- path: ./tools/makedeb/src
component: makedeb:lib
- path: ./tools/makedeb/src/Main.hs
component: makedeb:exe:makedeb
- path: ./libs/metrics-core/src
component: metrics-core:lib
- path: ./libs/metrics-wai/src
component: metrics-wai:lib
- path: ./tools/db/migrate-sso-feature-flag/src
component: migrate-sso-feature-flag:exe:migrate-sso-feature-flag
- path: ./services/proxy/src
component: proxy:lib
- path: ./services/proxy/src/Main.hs
component: proxy:exe:proxy
- path: ./libs/ropes/src
component: ropes:lib
- path: ./tools/db/service-backfill/src
component: service-backfill:exe:service-backfill
- path: ./libs/sodium-crypto-sign/src
component: sodium-crypto-sign:lib
- path: ./services/spar/src
component: spar:lib
- path: ./services/spar/exec
component: spar:exe:spar
- path: ./services/spar/test-integration
component: spar:exe:spar-integration
- path: ./services/spar/schema/src
component: spar:exe:spar-schema
- path: ./services/spar/test
component: spar:test:spec
- path: ./libs/ssl-util/src
component: ssl-util:lib
- path: ./tools/stern/src
component: stern:lib
- path: ./tools/stern/src/Main.hs
component: stern:exe:stern
- path: ./libs/tasty-cannon/src
component: tasty-cannon:lib
- path: ./libs/types-common/src
component: types-common:lib
- path: ./libs/types-common/test
component: types-common:test:tests
- path: ./libs/types-common-aws/src
component: types-common-aws:lib
- path: ./libs/types-common-journal/src
component: types-common-journal:lib
- path: ./libs/wai-utilities/src
component: wai-utilities:lib
- path: ./libs/wire-api/src
component: wire-api:lib
- path: ./libs/wire-api/test/unit
component: wire-api:test:wire-api-tests
- path: ./libs/zauth/src
component: zauth:lib
- path: ./libs/zauth/main
component: zauth:exe:zauth
- path: ./libs/zauth/test
component: zauth:test:zauth-unit
Steps to reproduce
- Add
LambdaCase
todefault-extensions
in the cabal file. - Create a module and write a function which uses LambdaCase.
- Create another function which will make hlint provide a hint, maybe a redundant
do
. - Wait for the LSP server to suggest the code action
- Apply the code action
Expected behaviour
The hlint hint should get applied
Actual behaviour
hlint complains about LambdaCase.
Include debug information
LSP logs:
Found "/home/axeman/workspace/wire-server/hie.yaml" for "/home/axeman/workspace/wire-server/a"
Module "/home/axeman/workspace/wire-server/a" is loaded by Cradle: Cradle {cradleRootDir = "/home/axeman/workspace/wire-server", cradleOptsProg = CradleAction: Stack}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 0.6.0.0, Git revision 372a12e797069dc3ac4fa33dcaabe3b992999d7c (dirty) x86_64 ghc-8.10.1
Current directory: /home/axeman/workspace/wire-server
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /home/axeman/workspace/wire-server
Cradle type: Stack
Tool versions found on the $PATH
cabal: 3.0.0.0
stack: 2.3.3
ghc: 8.8.4
Consulting the cradle to get project GHC version...
Project GHC version: 8.8.4
haskell-language-server exe candidates: ["haskell-language-server-8.8.4","haskell-language-server-8.8","haskell-language-server"]
Launching haskell-language-server exe at:/home/axeman/.local/bin/haskell-language-server-8.8.4
haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/axeman/.local/bin/haskell-language-server-8.8.4)
Starting (haskell-language-server)LSP server...
with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "brittany",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "stylish-haskell",PluginId "tactic"]
in directory: /home/axeman/workspace/wire-server
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Started LSP server in 0.00s
Output from setting up the cradle Cradle {cradleRootDir = "/home/axeman/workspace/wire-server", cradleOptsProg = CradleAction: Stack}
> galley> configure (lib)
> Configuring galley-0.83.0...
> galley> initial-build-steps (lib)
> The following GHC options are incompatible with GHCi and have not been passed to it: -O2
> Configuring GHCi with the following packages: galley
> /home/axeman/workspace/wire-server/.stack-work/install/x86_64-linux-nix/730229c219acc762949b1a7da64c266b88463ab6c391a6a622e0cbcb64fca603/8.8.4/pkgdb:/home/axeman/.stack/snapshots/x86_64-linux-nix/730229c219acc762949b1a7da64c266b88463ab6c391a6a622e0cbcb64fca603/8.8.4/pkgdb:/nix/store/w30rhw13ji6vkv0zksms5h7897cxvl90-ghc-8.8.4/lib/ghc-8.8.4/package.conf.d