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

After server restart fourmolu uses default config #920

Closed
worm2fed opened this issue Jul 18, 2023 · 12 comments
Closed

After server restart fourmolu uses default config #920

worm2fed opened this issue Jul 18, 2023 · 12 comments
Assignees
Labels
type: bug A bug or unintended effect

Comments

@worm2fed
Copy link

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" ]
@worm2fed worm2fed added status: needs triage type: bug A bug or unintended effect labels Jul 18, 2023
@fendor fendor transferred this issue from haskell/haskell-language-server Jul 18, 2023
@fendor
Copy link
Collaborator

fendor commented Jul 18, 2023

Hi, thank you for the bug report!

Moving the bug report to the VSCode extension repository, which is likely the culprit in this bug.

@fendor
Copy link
Collaborator

fendor commented Jul 24, 2023

Just fyi, I can reproduce the issue. I suspect that we transmit the configuration only on extension startup, and the HLS restart command doesn't send the configuration again.

Maybe we can manually send the configuration again.

@worm2fed
Copy link
Author

@fendor
Note that less the a month ago there was no such issue. I need to restart HLS quite often and formatter worked with proper config

@fendor
Copy link
Collaborator

fendor commented Jul 24, 2023

Oh, very interesting!

Perhaps it is related to our recent upgrade to the latest vscode-languageClient version...

@July541
Copy link
Collaborator

July541 commented Jul 24, 2023

I'll take a look at this later.

@July541
Copy link
Collaborator

July541 commented Aug 1, 2023

Update: After adding log to ormolu, I found hls is going to call ormolu plugin instead of fourmolu...

@scarf005
Copy link

scarf005 commented Aug 1, 2023

can confirm I was getting the same error on HLS 2.0.1 with Vscode Haskell extension v2.4.0.

  1. when project loads initially, fourmolu is used to format the code.
  2. HLS requires project to be built, so i run restart HLS command.
  3. ormolu is used for formatting instead.

image

for an workaround, using v2.2.4 works well.

related discord thread on FP server

@July541
Copy link
Collaborator

July541 commented Aug 1, 2023

Update: The problem is the latest language-client doesn't send workspace/didChangeConfiguration while initializing, which means formattingProvider will be reset to the default value after restarting.

See context here: microsoft/vscode-languageserver-node#524

But we still don't know what makes this change happen, I'll try to investigate it before pushing a fix.

image

fendor added a commit to fendor/vscode-haskell that referenced this issue Aug 9, 2023
It causes troubles due to following the newer LSP spec which HLS is not
ready for. For details, see haskell#920
and haskell/lsp#510, etc...
@July541
Copy link
Collaborator

July541 commented Aug 9, 2023

We published a new release that downgraded vscode-languageclient to fix this temporarily.

@michaelpj
Copy link
Contributor

After building HLS off haskell/haskell-language-server#3773 I'm pretty sure this is now fixed. With version 2.4.0 of the extension, I can see that we're doing the correct negotiation with workspace/configuration and our configuration is getting updated, and I have the correct formatting. If anyone else can check that would be helpful, I'm not 100% sure I'm getting it right.

@michaelpj
Copy link
Contributor

Corresponding lsp PR is here btw: haskell/lsp#512

@worm2fed
Copy link
Author

thanks! seems working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A bug or unintended effect
Projects
None yet
Development

No branches or pull requests

5 participants