Skip to content

Changes to cabal file is lost when saving using default formatter haskell.haskell and formatOnSave=true #945

Closed
@konnik

Description

@konnik

I don't know if this is an issue with the VSCode extension or HLS?

Your environment

Ubuntu
VSCode Haskell extension v2.5.0 (pre-release)
HLS 2.1.0.0 (GHC: 9.6.2)

VSCode configured with:

  • default formatter = haskell.haskell
  • formatOnSave=true

Tool versions found on the $PATH
cabal: 3.10.1.0
stack: 2.11.1
ghc: 9.6.2

Steps to reproduce

Open cabal file in vscode and make some changes followed by CTRL-S

Expected behaviour

The cabal file should be formatted with changes persisted.

Actual behaviour

All changes are lost and the file is saved.

Include debug information

$  haskell-language-server-wrapper --debug
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.1.0.0 x86_64 ghc-8.10.7
Current directory: /xyz
Operating system: linux
Arguments: ["--debug"]
Cradle directory: /xyz
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.10.1.0
stack:          2.11.1
ghc:            9.6.2


Consulting the cradle to get project GHC version...
2023-08-25T14:06:50.554575Z | Debug | executing command: cabal exec -v0 -- ghc --print-libdir
2023-08-25T14:06:51.575066Z | Debug | executing command: cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:51.667382Z | Debug | executing command: cabal --builddir=/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64 v2-exec --with-compiler /home/korv/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/korv/.cache/hie-bios/ghc-pkg-d0ef7fb9996698a6ab43e1943b6d37be ghc -v0 -- --numeric-version
Project GHC version: 9.6.2
haskell-language-server exe candidates: ["haskell-language-server-9.6.2","haskell-language-server"]
Launching haskell-language-server exe at:/home/korv/.ghcup/bin/haskell-language-server-9.6.2
2023-08-25T14:06:51.861966Z | Debug | executing command: cabal exec -v0 -- ghc --print-libdir
2023-08-25T14:06:51.914646Z | Debug | executing command: cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:52.007180Z | Debug | executing command: cabal --builddir=/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64 v2-exec --with-compiler /home/korv/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/korv/.cache/hie-bios/ghc-pkg-d0ef7fb9996698a6ab43e1943b6d37be ghc -v0 -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:52.110502Z | Debug | executing command: cabal exec -v0 -- ghc --print-libdir
2023-08-25T14:06:52.163058Z | Debug | executing command: cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:52.245400Z | Debug | executing command: cabal --builddir=/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64 v2-exec --with-compiler /home/korv/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/korv/.cache/hie-bios/ghc-pkg-d0ef7fb9996698a6ab43e1943b6d37be ghc -v0 -- --print-libdir
2023-08-25T14:06:53.467157Z | Info | haskell-language-server version: 2.1.0.0 (GHC: 9.6.2) (PATH: /home/korv/.ghcup/hls/2.1.0.0/lib/haskell-language-server-2.1.0.0/bin/haskell-language-server-9.6.2)
2023-08-25T14:06:53.467734Z | Info | Directory: /xyz
2023-08-25T14:06:53.467921Z | Info | Logging heap statistics every 60.00s
 ghcide setup tester in /xyz.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /xyz
Found 2 files

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

Step 3/4: Initializing the IDE
2023-08-25T14:06:53.470464Z | Debug | Initializing exports map from hiedb
2023-08-25T14:06:53.470788Z | Debug | Shake session initialized

Step 4/42023-08-25T14:06:53.471048Z | Debug | Done initializing exports map from hiedb. Size: 3
: Type checking the files
2023-08-25T14:06:53.471797Z | Info | Cradle path: app/Main.hs
2023-08-25T14:06:53.471871Z | 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.
2023-08-25T14:06:53.474803Z | Debug | Cradle: Cradle {cradleRootDir = "/xyz", cradleOptsProg = CradleAction: Cabal}
2023-08-25T14:06:53.474857Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2023-08-25T14:06:53.475031Z | Debug | executing command: cabal exec -v0 -- ghc --print-libdir
2023-08-25T14:06:53.527595Z | Debug | executing command: cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:53.630495Z | Debug | executing command: cabal --builddir=/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64 v2-repl --with-compiler /home/korv/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/korv/.cache/hie-bios/ghc-pkg-d0ef7fb9996698a6ab43e1943b6d37be korv-haskell-backend:exe:korv-haskell-backend
2023-08-25T14:06:53.645724Z | Debug | Build profile: -w ghc-9.6.2 -O1
2023-08-25T14:06:53.645820Z | Debug | In order, the following will be built (use -v for more details):
2023-08-25T14:06:53.645864Z | Debug |  - korv-haskell-backend-0.1.0.0 (exe:korv-haskell-backend) (first run)
2023-08-25T14:06:53.682502Z | Debug | Preprocessing executable 'korv-haskell-backend' for korv-haskell-backend-0.1.0.0..
2023-08-25T14:06:53.705151Z | Debug | executing command: cabal exec -v0 -- ghc --print-libdir
2023-08-25T14:06:53.758834Z | Debug | executing command: cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-08-25T14:06:53.861346Z | Debug | executing command: cabal --builddir=/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64 v2-exec --with-compiler /home/korv/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/korv/.cache/hie-bios/ghc-pkg-d0ef7fb9996698a6ab43e1943b6d37be ghc -v0 -- --print-libdir
2023-08-25T14:06:53.913725Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-odir","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-hidir","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-stubdir","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-i","-i/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-iapp","-i/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/autogen","-i/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/global-autogen","-I/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/autogen","-I/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/global-autogen","-I/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/korv-haskell-backend-tmp","-optP-include","-optP/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/build/korv-haskell-backend/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/korv/.cabal/store/ghc-9.6.2/package.db","-package-db","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/packagedb/ghc-9.6.2","-package-db","/home/korv/.cache/hie-bios/dist-korv-haskell-backend-caeb3c3869eb6ff57d29ef82a4b7ed64/build/x86_64-linux/ghc-9.6.2/korv-haskell-backend-0.1.0.0/x/korv-haskell-backend/package.conf.inplace","-package-id","base-4.18.0.0","-XGHC2021","app/Main.hs","Apa","-Wall","-hide-all-packages"], componentRoot = "/xyz", componentDependencies = ["korv-haskell-backend.cabal","cabal.project","cabal.project.local"]},"/home/korv/.ghcup/ghc/9.6.2/lib/ghc-9.6.2/lib")
2023-08-25T14:06:53.944705Z | Info | Interface files cache directory: /home/korv/.cache/ghcide/main-4749d05677fa81583fbd1f3201ff6944765f77bd-4749d05677fa81583fbd1f3201ff6944765f77bd
2023-08-25T14:06:53.944789Z | Info | Making new HscEnv. In-place unit ids: [ main-4749d05677fa81583fbd1f3201ff6944765f77bd ]
2023-08-25T14:06:53.959310Z | Debug | New component cache HscEnvEq: (([],Just HscEnvEq 4),fromList [("cabal.project",Nothing),("cabal.project.local",Nothing),("korv-haskell-backend.cabal",Just 2023-08-25 14:01:56.775270182 UTC)])
2023-08-25T14:06:53.960900Z | Debug | Known files updated:
  fromList [(TargetFile NormalizedFilePath "/xyz/app/Main.hs",fromList ["/xyz/app/Main.hs"]),(TargetModule (ModuleName "Apa"),fromList ["/xyz/app/Apa.hs"])]
2023-08-25T14:06:53.961181Z | Debug | Finished build session
AsyncCancelled
2023-08-25T14:06:53.961235Z | Debug | Restarting build session due to new component
Action Queue: [User TypeCheck]
Keys: [GhcSessionIO; , GetKnownTargets; ]
Aborting previous build session took 0.00s 
2023-08-25T14:06:53.961599Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "/xyz/app/Apa.hs"
2023-08-25T14:06:53.965558Z | Debug | hlint: Getting hlint ideas for  NormalizedFilePath "/xyz/app/Main.hs"
2023-08-25T14:06:54.123891Z | Debug | hlint: Using extensions for  NormalizedFilePath "/xyz/app/Apa.hs": [ MonomorphismRestriction
                                                                                                                  , RelaxedPolyRec
                                                                                                                  , ForeignFunctionInterface
                                                                                                                  , ImplicitPrelude
                                                                                                                  , ScopedTypeVariables
                                                                                                                  , BangPatterns
                                                                                                                  , NamedFieldPuns
                                                                                                                  , GADTSyntax
                                                                                                                  , DoAndIfThenElse
                                                                                                                  , ConstraintKinds
                                                                                                                  , PolyKinds
                                                                                                                  , InstanceSigs
                                                                                                                  , StandaloneDeriving
                                                                                                                  , DeriveDataTypeable
                                                                                                                  , DeriveFunctor
                                                                                                                  , DeriveTraversable
                                                                                                                  , DeriveFoldable
                                                                                                                  , DeriveGeneric
                                                                                                                  , DeriveLift
                                                                                                                  , TypeSynonymInstances
                                                                                                                  , FlexibleContexts
                                                                                                                  , FlexibleInstances
                                                                                                                  , ConstrainedClassMethods
                                                                                                                  , MultiParamTypeClasses
                                                                                                                  , ExistentialQuantification
                                                                                                                  , EmptyDataDecls
                                                                                                                  , KindSignatures
                                                                                                                  , GeneralizedNewtypeDeriving
                                                                                                                  , PostfixOperators
                                                                                                                  , TupleSections
                                                                                                                  , PatternGuards
                                                                                                                  , RankNTypes
                                                                                                                  , TypeOperators
                                                                                                                  , ExplicitForAll
                                                                                                                  , TraditionalRecordSyntax
                                                                                                                  , BinaryLiterals
                                                                                                                  , HexFloatLiterals
                                                                                                                  , EmptyCase
                                                                                                                  , NamedWildCards
                                                                                                                  , TypeApplications
                                                                                                                  , EmptyDataDeriving
                                                                                                                  , NumericUnderscores
                                                                                                                  , StarIsType
                                                                                                                  , ImportQualifiedPost
                                                                                                                  , StandaloneKindSignatures
                                                                                                                  , FieldSelectors ]
2023-08-25T14:06:54.124111Z | Debug | hlint: Using extensions for  NormalizedFilePath "/xyz/app/Main.hs": [ MonomorphismRestriction
                                                                                                                   , RelaxedPolyRec
                                                                                                                   , ForeignFunctionInterface
                                                                                                                   , ImplicitPrelude
                                                                                                                   , ScopedTypeVariables
                                                                                                                   , BangPatterns
                                                                                                                   , NamedFieldPuns
                                                                                                                   , GADTSyntax
                                                                                                                   , DoAndIfThenElse
                                                                                                                   , ConstraintKinds
                                                                                                                   , PolyKinds
                                                                                                                   , InstanceSigs
                                                                                                                   , StandaloneDeriving
                                                                                                                   , DeriveDataTypeable
                                                                                                                   , DeriveFunctor
                                                                                                                   , DeriveTraversable
                                                                                                                   , DeriveFoldable
                                                                                                                   , DeriveGeneric
                                                                                                                   , DeriveLift
                                                                                                                   , TypeSynonymInstances
                                                                                                                   , FlexibleContexts
                                                                                                                   , FlexibleInstances
                                                                                                                   , ConstrainedClassMethods
                                                                                                                   , MultiParamTypeClasses
                                                                                                                   , ExistentialQuantification
                                                                                                                   , EmptyDataDecls
                                                                                                                   , KindSignatures
                                                                                                                   , GeneralizedNewtypeDeriving
                                                                                                                   , PostfixOperators
                                                                                                                   , TupleSections
                                                                                                                   , PatternGuards
                                                                                                                   , RankNTypes
                                                                                                                   , TypeOperators
                                                                                                                   , ExplicitForAll
                                                                                                                   , TraditionalRecordSyntax
                                                                                                                   , BinaryLiterals
                                                                                                                   , HexFloatLiterals
                                                                                                                   , EmptyCase
                                                                                                                   , NamedWildCards
                                                                                                                   , TypeApplications
                                                                                                                   , EmptyDataDeriving
                                                                                                                   , NumericUnderscores
                                                                                                                   , StarIsType
                                                                                                                   , ImportQualifiedPost
                                                                                                                   , StandaloneKindSignatures
                                                                                                                   , FieldSelectors ]
2023-08-25T14:06:54.151760Z | Debug | Finished: User TypeCheck Took: 0.19s
2023-08-25T14:06:54.153570Z | Debug | Finished: GetHie Took: 0.00s

Completed (2 files worked, 0 files f2023-08-25T14:06:54.153818Z | Debug | Finished: GenerateCore Took: 0.00s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions