Skip to content

The current HEAD version of HLS won't stop in-progress notifications even after it is done #1374

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

Closed
konn opened this issue Feb 15, 2021 · 2 comments · Fixed by #1377
Closed
Labels
component: lsp type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@konn
Copy link
Collaborator

konn commented Feb 15, 2021

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 0.9.0.0 (GHC: 8.10.4) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server) (GIT hash: 4d431e9a7c51ab1b817476c1fec45c6cbaa676e8)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.5.1
ghc:            8.8.4

Which lsp-client do you use: VSCode

Describe your project (alternative: link to the project): a plain simple project generated by stack new simple, consisting solely of a single executable.

Contents of hie.yaml: No Cradle needed

Steps to reproduce

  • stack new repro simple
  • Configure LSP client to use the custom build of HLS from HEAD
  • Open repro/src/Main.hs.
  • Save File, with or without changes.

Expected behaviour

  • Soon Setting up repro... message disappears, and the code get formatted immediately and no notification persists.

Actual behaviour

  • Even though the module is loaded immediately, Setting up... message persists.
  • Formatting is done successfully, but two notifications of Formatting... appears, and one of it persists.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
850bd/8.10.4/bin/haskell-language-server --debug .   
haskell-language-server version: 0.9.0.0 (GHC: 8.10.4) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server) (GIT hash: 4d431e9a7c51ab1b817476c1fec45c6cbaa676e8)
ghcide setup tester in /Users/hiromi/Documents/Programming/Haskell/git/small-repro.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /Users/hiromi/Documents/Programming/Haskell/git/small-repro
Found 2 files

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

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
2021-02-15 21:17:07.349118 [ThreadId 4] DEBUG hls:      Set files of interest to: [(NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs",OnDisk),(NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/Setup.hs",OnDisk)]
2021-02-15 21:17:07.353244 [ThreadId 54] INFO hls:      Consulting the cradle for "src/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/small-repro", cradleOptsProg = CradleAction: Stack}
> Using main module: 1. Package `small-repro' component small-repro:exe:small-repro with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs
> Building all executables for `small-repro' once. After a successful build of all of them, only specified executables will be rebuilt.
> small-repro> configure (exe)
> Configuring small-repro-0.1.0.0...
> small-repro> initial-build-steps (exe)
> Configuring GHCi with the following packages: small-repro
> /Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/install/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-02-15 21:17:10.705837 [ThreadId 54] DEBUG hls:     Session loading result: Right (ComponentOptions {componentOptions = ["-i","-odir=/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/odir","-hidir=/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/odir","-hide-all-packages","-i/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/small-repro","-i/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src","-i/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/small-repro/autogen","-i/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/global-autogen","-i/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/small-repro/small-repro-tmp","-stubdir=/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build","-package-id=base-4.14.1.0","-optP-include","-optP/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/ghci/aab4ac53/cabal_macros.h","-ghci-script=/private/var/folders/pv/mtbzyjyj229g928n710c9d_40000gn/T/haskell-stack-ghci/3fc992d2/ghci-script","-package-db","/Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/install/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb","-package-db","/Users/hiromi/.stack/snapshots/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb","-package-db","/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4/package.conf.d"], componentRoot = "/Users/hiromi/Documents/Programming/Haskell/git/small-repro", componentDependencies = ["small-repro.cabal","package.yaml","stack.yaml"]},"/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4")
2021-02-15 21:17:10.788049 [ThreadId 54] INFO hls:      Using interface files cache dir: ghcide
2021-02-15 21:17:10.788146 [ThreadId 54] INFO hls:      Making new HscEnv[main]
2021-02-15 21:17:10.793237 [ThreadId 54] DEBUG hls:     New Component Cache HscEnvEq: (([],Just HscEnvEq 14),fromList [("package.yaml",Nothing),("small-repro.cabal",Just 2021-02-15 12:05:43.565552288 UTC),("stack.yaml",Just 2021-02-15 12:05:44.538100624 UTC)])
2021-02-15 21:17:10.793944 [ThreadId 54] DEBUG hls:     Known files updated: fromList [(TargetFile NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs",["/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs"])]
2021-02-15 21:17:10.794425 [ThreadId 54] DEBUG hls:     Restarting build session (aborting the previous one took 0.00s)
2021-02-15 21:17:10.794396 [ThreadId 22] DEBUG hls:     Finishing build session(exception: AsyncCancelled)
2021-02-15 21:17:10.797092 [ThreadId 106] INFO hls:     Consulting the cradle for "Setup.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/small-repro", cradleOptsProg = CradleAction: Stack}
2021-02-15 21:17:10.803079 [ThreadId 106] DEBUG hls:    Session loading result: Left [CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Multi Cradle: No prefixes matched","pwd: /Users/hiromi/Documents/Programming/Haskell/git/small-repro","filepath: /Users/hiromi/Documents/Programming/Haskell/git/small-repro/Setup.hs","prefixes:","(\"./src/Main.hs\",Stack {component = Just \"small-repro:exe:small-repro\", stackYaml = Nothing})"]}]
2021-02-15 21:17:10.804099 [ThreadId 102] INFO hls:     File:     /Users/hiromi/Documents/Programming/Haskell/git/small-repro/Setup.hs
Hidden:   no
Range:    1:1-2:1
Source:   cradle
Severity: DsError
Message: 
  Multi Cradle: No prefixes matched
  pwd: /Users/hiromi/Documents/Programming/Haskell/git/small-repro
  filepath: /Users/hiromi/Documents/Programming/Haskell/git/small-repro/Setup.hs
  prefixes:
  ("./src/Main.hs",Stack {component = Just "small-repro:exe:small-repro", stackYaml = Nothing})
2021-02-15 21:17:10.823176 [ThreadId 192] INFO hls:     finish: User TypeCheck (took 0.03s)
2021-02-15 21:17:10.826268 [ThreadId 204] INFO hls:     finish: GetHie (took 0.00s)
Files that failed:
 * /Users/hiromi/Documents/Programming/Haskell/git/small-repro/Setup.hs
2021-02-15 21:17:10.828038 [ThreadId 213] INFO hls:     finish: GenerateCore (took 0.00s)

Completed (1 file worked, 1 file failed)

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
[client] run command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server --lsp"
[client] debug command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server --lsp"
[client] server cwd: undefined
haskell-language-server version: 0.9.0.0 (GHC: 8.10.4) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server) (GIT hash: 4d431e9a7c51ab1b817476c1fec45c6cbaa676e8)
Starting (haskell-language-server)LSP server...
  with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "brittany",PluginId "class",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide-code-actions",PluginId "ghcide-completions",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-type-lenses",PluginId "haddockComments",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "splice",PluginId "stylish-haskell",PluginId "tactic"]
  in directory: /Users/hiromi/Documents/Programming/Haskell/git/small-repro
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Starting LSP server...
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 2021-02-15 21:16:34.078089 [ThreadId 6] INFO haskell-lsp.runWith:	




haskell-lsp:Starting up server ...
Started LSP server in 0.00s
2021-02-15 21:16:34.916078 [ThreadId 6] INFO hls:	Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-8210021496766687902) "file:///Users/hiromi/Documents/Programming/Haskell/git/small-repro"], clientSettings = hashed Nothing}
2021-02-15 21:16:34.923051 [ThreadId 34] INFO hls:	Configuration changed: Object (fromList [("haskell",Object (fromList [("hlint",Object (fromList [("logLevel",String "info"),("executablePath",String "/Users/hiromi/.local/bin/hlint")])),("logFile",String ""),("updateBehavior",String "keep-up-to-date"),("hlintOn",Bool True),("formatOnImportOn",Bool True),("indentationRules",Object (fromList [("enabled",Bool True)])),("liquidOn",Bool False),("languageServerVariant",String "haskell-language-server"),("serverExecutablePath",String "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/9bf23dc043c65e317fdabc00ce9e283c450724e3fce05276ee9df9b9ace850bd/8.10.4/bin/haskell-language-server"),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "fourmolu"),("trace",Object (fromList [("server",String "off")]))]))])
2021-02-15 21:16:34.924377 [ThreadId 34] INFO hls:	Opened text document: file:///Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs
2021-02-15 21:16:34.925077 [ThreadId 109] INFO hls:	hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs"
2021-02-15 21:16:34.926585 [ThreadId 117] INFO hls:	Consulting the cradle for "src/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/small-repro", cradleOptsProg = CradleAction: Stack}
[Error - 21:16:34] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":1,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

[Error - 21:16:35] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":2,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

> Using main module: 1. Package `small-repro' component small-repro:exe:small-repro with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs
> Building all executables for `small-repro' once. After a successful build of all of them, only specified executables will be rebuilt.
> small-repro> configure (exe)
> Configuring small-repro-0.1.0.0...
> small-repro> initial-build-steps (exe)
> Configuring GHCi with the following packages: small-repro
> /Users/hiromi/Documents/Programming/Haskell/git/small-repro/.stack-work/install/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/558c152a1bb96869716c728ef95f5578695b79c7caaea744a13c987678024fb0/8.10.4/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-02-15 21:16:38.775694 [ThreadId 117] INFO hls:	Using interface files cache dir: ghcide
2021-02-15 21:16:38.775798 [ThreadId 117] INFO hls:	Making new HscEnv[main]
2021-02-15 21:16:38.782806 [ThreadId 255] INFO hls:	hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs"
2021-02-15 21:16:38.783401 [ThreadId 276] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-02-15 21:16:38.783412 [ThreadId 277] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-02-15 21:16:38.784204 [ThreadId 302] INFO hls:	finish: importLens (took 0.00s)
2021-02-15 21:16:38.784229 [ThreadId 303] INFO hls:	finish: Outline (took 0.00s)
2021-02-15 21:16:38.784258 [ThreadId 304] INFO hls:	finish: addPragma (took 0.00s)
2021-02-15 21:16:38.784364 [ThreadId 301] INFO hls:	finish: splice.codeAction.GitHieAst (took 0.00s)
2021-02-15 21:16:38.784537 [ThreadId 299] INFO hls:	finish: parsed (took 0.00s)
2021-02-15 21:16:38.784619 [ThreadId 305] INFO hls:	finish: ModuleName.GetParsedModule (took 0.00s)
2021-02-15 21:16:38.784611 [ThreadId 304] INFO hls:	finish: HaddockComments.GetAnnotatedParsedSource (took 0.00s)
2021-02-15 21:16:38.78465 [ThreadId 302] INFO hls:	finish: ModuleName.GetParsedModule (took 0.00s)
2021-02-15 21:16:38.784552 [ThreadId 307] INFO hls:	finish: Outline (took 0.00s)
2021-02-15 21:16:38.784581 [ThreadId 298] INFO hls:	finish: parsed (took 0.00s)
2021-02-15 21:16:38.810288 [ThreadId 358] INFO hls:	finish: codeLens (took 0.03s)
2021-02-15 21:16:38.810358 [ThreadId 357] INFO hls:	finish: retrie (took 0.03s)
2021-02-15 21:16:38.81037 [ThreadId 361] INFO hls:	finish: codeLens (took 0.03s)
2021-02-15 21:16:38.810584 [ThreadId 368] INFO hls:	finish:  (took 0.03s)
2021-02-15 21:16:38.810636 [ThreadId 369] INFO hls:	finish:  (took 0.03s)
2021-02-15 21:16:38.813376 [ThreadId 381] INFO hls:	finish: tactic (took 0.03s)
2021-02-15 21:16:38.813545 [ThreadId 382] INFO hls:	finish: CodeAction (took 0.03s)
2021-02-15 21:16:38.814355 [ThreadId 389] INFO hls:	finish: tactic (took 0.00s)
2021-02-15 21:16:38.814494 [ThreadId 390] INFO hls:	finish: tactic (took 0.00s)
[Error - 21:16:38] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":3,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

2021-02-15 21:16:45.274188 [ThreadId 398] INFO hls:	finish: Fourmolu (took 0.00s)
[Error - 21:16:45] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":4,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

Loaded Fourmolu config from: /Users/hiromi/.config/fourmolu.yaml
warnings:


parse result:
  comment stream:


2021-02-15 21:16:45.318404 [ThreadId 34] INFO hls:	Saved text document: file:///Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs
2021-02-15 21:16:45.321869 [ThreadId 494] INFO hls:	Typechecking reverse dependencies for NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/small-repro/src/Main.hs": Just []
[Error - 21:16:45] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":5,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

2021-02-15 21:16:46.566875 [ThreadId 517] INFO hls:	finish: codeLens (took 0.00s)
2021-02-15 21:16:46.566981 [ThreadId 519] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-02-15 21:16:46.567304 [ThreadId 528] INFO hls:	finish:  (took 0.00s)
2021-02-15 21:16:46.567484 [ThreadId 530] INFO hls:	finish: parsed (took 0.00s)
2021-02-15 21:16:46.567826 [ThreadId 531] INFO hls:	finish: ModuleName.GetParsedModule (took 0.00s)
2021-02-15 21:17:01.353955 [ThreadId 543] INFO hls:	finish: parsed (took 0.00s)
2021-02-15 21:17:01.35414 [ThreadId 541] INFO hls:	finish: codeLens (took 0.00s)
2021-02-15 21:17:01.354165 [ThreadId 547] INFO hls:	finish:  (took 0.00s)
2021-02-15 21:17:01.354241 [ThreadId 545] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-02-15 21:17:01.355178 [ThreadId 549] INFO hls:	finish: ModuleName.GetParsedModule (took 0.00s)
[Error - 21:17:37] haskell-lsp:no handler for:  SWindowWorkDoneProgressCancel
2021-02-15 21:17:40.306408 [ThreadId 561] INFO hls:	finish: codeLens (took 0.00s)
2021-02-15 21:17:40.306485 [ThreadId 563] INFO hls:	finish: parsed (took 0.00s)
2021-02-15 21:17:40.306503 [ThreadId 559] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-02-15 21:17:40.306534 [ThreadId 565] INFO hls:	finish:  (took 0.00s)
2021-02-15 21:17:40.307363 [ThreadId 567] INFO hls:	finish: ModuleName.GetParsedModule (took 0.00s)

Consideration

The following error seems to appear time after time:

[Error - 21:16:45] haskell-lsp:incoming message parse error. {"jsonrpc":"2.0","id":5,"result":null} Error in $.result: parsing () failed, expected Array, but encountered Null

Hence, it can be due to some incompatibility with LSP, I guess.

@wz1000
Copy link
Collaborator

wz1000 commented Feb 15, 2021

Can you confirm if haskell/lsp#283 fixes the problem?

@konn
Copy link
Collaborator Author

konn commented Feb 15, 2021

@wz1000 I confirmed that using your fix solves this behaviour, building with following settings with stack-8.10.4.yaml:

extra-deps:
  ...
  - github: wz1000/haskell-lsp
    commit: 5200f7b5a9df6abc6121ca28922ee1f306bfe078

Thank you for your rapid fix!

@wz1000 wz1000 mentioned this issue Feb 15, 2021
@jneira jneira added component: lsp type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 16, 2021
@mergify mergify bot closed this as completed in #1377 Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: lsp type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants