Skip to content

After server restart fourmolu uses default config #920

Closed
@worm2fed

Description

@worm2fed

Your environment

Which OS do you use?

❯ uname -a
Darwin vega.Home 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64

Which version of GHC do you use and how did you install it?
9.2.8 from ghcup

How is your project built (alternative: link to the project)?
via stack

Which LSP client (editor/plugin) do you use?
vs code

Which version of HLS do you use and how did you install it?
2.0.0.1 from ghcup

Have you configured HLS in any way (especially: a hie.yaml file)?

  • hie.yaml
cradle:
  stack:
    - path: "./src"
      component: "union:lib"

    - path: "./app"
      component: "union:exe:union-server"

    - path: "./app/Paths_union.hs"
      component: "union:exe:union-server"

    - path: "./tests/base"
      component: "union:test:union-base-tests"

    - path: "./tests/e2e"
      component: "union:test:union-e2e-tests"

dependencies:
  - ./package.yaml
  - ./stack.yaml

and vs code settings:

...
  "haskell.plugin.ghcide-completions.config.autoExtendOn": false,
  "haskell.trace.client": "error",
  "haskell.manageHLS": "GHCup",
  "haskell.plugin.rename.config.crossModule": true,
  "haskell.serverExecutablePath": "haskell-language-server-wrapper",
  "haskell.checkProject": false,
  "haskell.plugin.eval.config.exception": true,
  "haskell.formattingProvider": "fourmolu",
  "haskell.plugin.hlint.config.flags": [
      "-j",
    ],
    "haskell.plugin.fourmolu.config.external": true,
...

Steps to reproduce

  1. restart HLS via vs code command
  2. save file

Expected behaviour

Fourmolu will continue to use custom config as it was before HLS restart

Actual behaviour

Fourmolu will use it's default config instead of I have in root

Debug information

Tested without "haskell.plugin.fourmolu.config.external": true - same behaviour.
When I reload window - it works as expected.

Also, at recent HLS version there was no such problem.

HLS output with expected behaviour (BEFORE restart)
2023-07-18 11:18:50.2970000 [client] DEBUG Environment variables:
2023-07-18 11:18:50.2970000 [client] DEBUG   PATH: /Users/worm2fed/.opam/default/bin:/Users/worm2fed/.cargo/bin:/opt/homebrew/opt/llvm@13/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/worm2fed/workspace/flutter/bin:/Users/worm2fed/workspace/scripts:/Users/worm2fed/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Applications/Postgres.app/Contents/Versions/latest/lib:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/worm2fed/.cabal/bin:/Users/worm2fed/.ghcup/bin
2023-07-18 11:18:50.2970000 [client] INFO Finding haskell-language-server
2023-07-18 11:18:50.2970000 [client] INFO Trying to find the server executable in: haskell-language-server-wrapper
2023-07-18 11:18:50.2970000 [client] DEBUG Location after path variables substitution: haskell-language-server-wrapper
2023-07-18 11:18:50.3000000 [client] INFO Activating the language server in working dir: /Users/worm2fed/workspace/union/union-server (the workspace folder)
2023-07-18 11:18:50.3000000 [client] INFO run command: haskell-language-server-wrapper --lsp
2023-07-18 11:18:50.3000000 [client] INFO debug command: haskell-language-server-wrapper --lsp
2023-07-18 11:18:50.3000000 [client] INFO server environment variables:
2023-07-18 11:18:50.3000000 [client] DEBUG document selector patten: /Users/worm2fed/workspace/union/union-server/**/*
2023-07-18 11:18:50.3040000 [client] INFO Starting language server
Found "/Users/worm2fed/workspace/union/union-server/hie.yaml" for "/Users/worm2fed/workspace/union/union-server/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.0.0.1 aarch64 ghc-8.10.7
Current directory: /Users/worm2fed/workspace/union/union-server
Operating system: darwin
Arguments: ["--lsp"]
Cradle directory: /Users/worm2fed/workspace/union/union-server
Cradle type: Stack

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


Consulting the cradle to get project GHC version...
2023-07-18T11:18:50.411046Z | Debug | executing command: stack setup --silent
2023-07-18T11:18:50.428854Z | Debug | executing command: stack exec ghc -- --numeric-version
Project GHC version: 9.2.8
haskell-language-server exe candidates: ["haskell-language-server-9.2.8","haskell-language-server"]
Launching haskell-language-server exe at:/Users/worm2fed/.ghcup/bin/haskell-language-server-9.2.8
2023-07-18T11:18:50.674333Z | Debug | executing command: stack setup --silent
2023-07-18T11:18:50.693563Z | Debug | executing command: stack exec ghc -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-07-18T11:18:51.207215Z | Debug | executing command: stack setup --silent
2023-07-18T11:18:51.226359Z | Debug | executing command: stack exec ghc -- --print-libdir
2023-07-18T11:18:52.855705Z | Info | No log file specified; using stderr.
2023-07-18T11:18:52.856054Z | Info | haskell-language-server version: 2.0.0.1 (GHC: 9.2.8) (PATH: /Users/worm2fed/.ghcup/hls/2.0.0.1/lib/haskell-language-server-2.0.0.1/bin/haskell-language-server-9.2.8)
2023-07-18T11:18:52.856412Z | Info | Directory: /Users/worm2fed/workspace/union/union-server
2023-07-18T11:18:52.856560Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
2023-07-18T11:18:52.858518Z | Info | Logging heap statistics every 60.00s
 2023-07-18T11:18:52.897361Z | Info | Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
2023-07-18T11:18:52.897960Z | Info | Starting server
2023-07-18T11:18:52.899298Z | Info | Started LSP server in 0.00s
2023-07-18T11:18:53.182222Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7119994970564872818) "file:///Users/worm2fed/workspace/union/union-server"], clientSettings = hashed Nothing}
[Info  - 12:18:53] haskell-language-server version: 2.0.0.1 (GHC: 9.2.8) (PATH: /Users/worm2fed/.ghcup/hls/2.0.0.1/lib/haskell-language-server-2.0.0.1/bin/haskell-language-server-9.2.8)
[Info  - 12:18:53] Directory: /Users/worm2fed/workspace/union/union-server
[Info  - 12:18:53] Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
[Info  - 12:18:53] Logging heap statistics every 60.00s
[Info  - 12:18:53] Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
[Info  - 12:18:53] Starting server
[Info  - 12:18:53] Started LSP server in 0.00s
[Info  - 12:18:53] Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7119994970564872818) "file:///Users/worm2fed/workspace/union/union-server"], clientSettings = hashed Nothing}
2023-07-18T11:18:53.190115Z | Info | Cradle path: src/Service/Base/Aws.hs
2023-07-18T11:18:53.190861Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
[Info  - 12:18:53] Cradle path: src/Service/Base/Aws.hs
[Info  - 12:18:53] invoking build tool to determine build flags (this may take some time depending on the cache)
2023-07-18T11:18:55.146297Z | Info | Interface files cache directory: /Users/worm2fed/.cache/ghcide/main-8e33b1e8063e499f2863d563f2f67fb8323e8e82
2023-07-18T11:18:55.146839Z | Info | Making new HscEnv. In-place unit ids: [main]
[Info  - 12:18:55] Interface files cache directory: /Users/worm2fed/.cache/ghcide/main-8e33b1e8063e499f2863d563f2f67fb8323e8e82
[Info  - 12:18:55] Making new HscEnv. In-place unit ids: [main]
2023-07-18T11:19:02.905545Z | Info | Typechecking reverse dependencies for NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Base/Aws.hs": [ NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Application.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Uploader.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Sender.hs" ]
[Info  - 12:19:02] Typechecking reverse dependencies for NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Base/Aws.hs": [ NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Application.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Uploader.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Sender.hs" ]
HLS output with UNexpected behaviour (AFTER restart)
[Info  - 12:14:49] Stopping the server
[Info  - 12:14:49] Starting the server
Found "/Users/worm2fed/workspace/union/union-server/hie.yaml" for "/Users/worm2fed/workspace/union/union-server/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.0.0.1 aarch64 ghc-8.10.7
Current directory: /Users/worm2fed/workspace/union/union-server
Operating system: darwin
Arguments: ["--lsp"]
Cradle directory: /Users/worm2fed/workspace/union/union-server
Cradle type: Stack

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


Consulting the cradle to get project GHC version...
2023-07-18T11:14:49.337257Z | Debug | executing command: stack setup --silent
2023-07-18T11:14:49.357377Z | Debug | executing command: stack exec ghc -- --numeric-version
Project GHC version: 9.2.8
haskell-language-server exe candidates: ["haskell-language-server-9.2.8","haskell-language-server"]
Launching haskell-language-server exe at:/Users/worm2fed/.ghcup/bin/haskell-language-server-9.2.8
2023-07-18T11:14:49.589551Z | Debug | executing command: stack setup --silent
2023-07-18T11:14:49.609577Z | Debug | executing command: stack exec ghc -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2023-07-18T11:14:50.093550Z | Debug | executing command: stack setup --silent
2023-07-18T11:14:50.113869Z | Debug | executing command: stack exec ghc -- --print-libdir
2023-07-18T11:14:51.666513Z | Info | No log file specified; using stderr.
2023-07-18T11:14:51.666818Z | Info | haskell-language-server version: 2.0.0.1 (GHC: 9.2.8) (PATH: /Users/worm2fed/.ghcup/hls/2.0.0.1/lib/haskell-language-server-2.0.0.1/bin/haskell-language-server-9.2.8)
2023-07-18T11:14:51.667147Z | Info | Directory: /Users/worm2fed/workspace/union/union-server
2023-07-18T11:14:51.667297Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
2023-07-18T11:14:51.669271Z | Info | Logging heap statistics every 60.00s
 2023-07-18T11:14:51.706943Z | Info | Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
2023-07-18T11:14:51.707430Z | Info | Starting server
2023-07-18T11:14:51.708745Z | Info | Started LSP server in 0.00s
2023-07-18T11:14:51.955142Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7119994970564872818) "file:///Users/worm2fed/workspace/union/union-server"], clientSettings = hashed Nothing}
[Info  - 12:14:51] haskell-language-server version: 2.0.0.1 (GHC: 9.2.8) (PATH: /Users/worm2fed/.ghcup/hls/2.0.0.1/lib/haskell-language-server-2.0.0.1/bin/haskell-language-server-9.2.8)
[Info  - 12:14:51] Directory: /Users/worm2fed/workspace/union/union-server
[Info  - 12:14:51] Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
[Info  - 12:14:51] Logging heap statistics every 60.00s
[Info  - 12:14:51] Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas
             , LSPRecorderCallback
             , rename
             , ghcide-completions
             , class
             , refineImports
             , splice
             , cabal
             , changeTypeSignature
             , qualifyImportedNames
             , alternateNumberFormat
             , hlint
             , cabalfmt
             , explicit-fields
             , ghcide-code-actions-fill-holes
             , overloaded-record-dot
             , floskell
             , ghcide-extend-import-action
             , codeRange
             , importLens
             , retrie
             , ghcide-type-lenses
             , ghcide-code-actions-imports-exports
             , ghcide-hover-and-symbols
             , eval
             , gadt
             , fourmolu
             , callHierarchy
             , stylish-haskell
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-bindings
             , moduleName
             , ormolu
             , ghcide-core
             , explicit-fixity ]
[Info  - 12:14:51] Starting server
[Info  - 12:14:51] Started LSP server in 0.00s
[Info  - 12:14:51] Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7119994970564872818) "file:///Users/worm2fed/workspace/union/union-server"], clientSettings = hashed Nothing}
2023-07-18T11:14:51.965124Z | Info | Cradle path: src/Service/Base/Aws.hs
[Info  - 12:14:51] Cradle path: src/Service/Base/Aws.hs
2023-07-18T11:14:51.965536Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
[Info  - 12:14:51] invoking build tool to determine build flags (this may take some time depending on the cache)
2023-07-18T11:14:54.765679Z | Info | Interface files cache directory: /Users/worm2fed/.cache/ghcide/main-8e33b1e8063e499f2863d563f2f67fb8323e8e82
2023-07-18T11:14:54.766190Z | Info | Making new HscEnv. In-place unit ids: [main]
[Info  - 12:14:54] Interface files cache directory: /Users/worm2fed/.cache/ghcide/main-8e33b1e8063e499f2863d563f2f67fb8323e8e82
[Info  - 12:14:54] Making new HscEnv. In-place unit ids: [main]
2023-07-18T11:14:58.685094Z | Info | Typechecking reverse dependencies for NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Base/Aws.hs": [ NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Application.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Uploader.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Sender.hs" ]
[Info  - 12:14:58] Typechecking reverse dependencies for NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Base/Aws.hs": [ NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Application.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Uploader.hs"
                                                                                                                                 , NormalizedFilePath "/Users/worm2fed/workspace/union/union-server/src/Service/Sender.hs" ]

Metadata

Metadata

Assignees

Labels

type: bugA bug or unintended effect

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions