Skip to content

Applying an hlint quick fix never finishes (better error handling) #646

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
avh4 opened this issue Dec 3, 2020 · 2 comments
Closed

Applying an hlint quick fix never finishes (better error handling) #646

avh4 opened this issue Dec 3, 2020 · 2 comments
Labels
component: hls-hlint-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@avh4
Copy link

avh4 commented Dec 3, 2020

Your environment

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

haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/avh4/.config/VSCodium/User/globalStorage/haskell.haskell/haskell-language-server-0.6.0-linux-8.8.4) (GIT hash: 372a12e797069dc3ac4fa33dcaabe3b992999d7c)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.3.3
ghc:            8.8.4

Which lsp-client do you use: VS Codium 1.51.1
Describe your project (alternative: link to the project): single cabal file
Contents of hie.yaml:

cradle:
  cabal:
    - path: "src"
      component: "lib:filesystem-test"

    - path: "test"
      component: "filesystem-test:test:filesystem-test-test"

Steps to reproduce

  1. Open any haskell project (for example, https://gitlab.com/avh4/avh4-lib/-/tree/a2103a602d279de1d6f925fe2c045bb7ae1ecd62/filesystem-test but this happens with every project I've tried)
  2. find some code with an hlint suggestion (for example, f a = f a
  3. Press Ctrl-<Period> and select "Apply hint: Eta reduce"

Expected behaviour

The hint should be applied within a 1-2 seconds, or show an error message explaining why it cannot be applied.

Actual behaviour

A popup with an indeterminate progress bar appears and the hint is not applied. The popup remains until cancelled (I have waited several minutes and it still does not complete.)
Screenshot from 2020-12-02 20-51-21

Include debug information

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

Debug output:
haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/avh4/.config/VSCodium/User/globalStorage/haskell.haskell/haskell-language-server-0.6.0-linux-8.8.4) (GIT hash: 372a12e797069dc3ac4fa33dcaabe3b992999d7c)
(haskell-language-server)Ghcide setup tester in /home/avh4/workspace/avh4-lib/filesystem-test.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.3.3
ghc:            8.8.4


Step 1/4: Finding files to test in /home/avh4/workspace/avh4-lib/filesystem-test
Found 3 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
[INFO] Consulting the cradle for "src/Test/Filesystem/FileTree.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/avh4/workspace/avh4-lib/filesystem-test", cradleOptsProg = CradleAction: Cabal}
> Warning: The package list for 'hackage.haskell.org' is 16 days old.
> Run 'cabal update' to get the latest list of available packages.
> Resolving dependencies...
> Build profile: -w ghc-8.8.4 -O1
> In order, the following will be built (use -v for more details):
>  - filesystem-test-0.0.0.0 (lib) (configuration changed)
> Configuring library for filesystem-test-0.0.0.0..
> Preprocessing library for filesystem-test-0.0.0.0..
[INFO] Using interface files cache dir: /home/avh4/snap/codium/common/.cache/ghcide/filesystem-test-0.0.0.0-inplace-2c473d8e70ca544b0b36eee06f405cbdc41ca6f9
[INFO] Making new HscEnv[filesystem-test-0.0.0.0-inplace]
[INFO] Consulting the cradle for "test/Spec.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/avh4/workspace/avh4-lib/filesystem-test", cradleOptsProg = CradleAction: Cabal}
> Warning: The package list for 'hackage.haskell.org' is 16 days old.
> Run 'cabal update' to get the latest list of available packages.
> Resolving dependencies...
> Build profile: -w ghc-8.8.4 -O1
> In order, the following will be built (use -v for more details):
>  - filesystem-test-0.0.0.0 (lib) (configuration changed)
>  - filesystem-test-0.0.0.0 (test:filesystem-test-test) (configuration changed)
> Configuring library for filesystem-test-0.0.0.0..
> Preprocessing library for filesystem-test-0.0.0.0..
> Building library for filesystem-test-0.0.0.0..
> [1 of 1] Compiling Test.Filesystem.FileTree
> Configuring test suite 'filesystem-test-test' for filesystem-test-0.0.0.0..
> Warning: The package has an extraneous version range for a dependency on an
> internal library: filesystem-test -any && ==0.0.0.0. This version range
> includes the current package but isn't needed as the current package's library
> will always be used.
> Preprocessing test suite 'filesystem-test-test' for filesystem-test-0.0.0.0..
[INFO] Using interface files cache dir: /home/avh4/snap/codium/common/.cache/ghcide/main-1f542d6f15adbf77e42529f065edba8ccf7e92f1
[INFO] Using interface files cache dir: /home/avh4/snap/codium/common/.cache/ghcide/filesystem-test-0.0.0.0-inplace-bfa0e765cbe921f4bbfecb4232f90e89608f418f
[INFO] Making new HscEnv[main,filesystem-test-0.0.0.0-inplace]
File:     /home/avh4/workspace/avh4-lib/filesystem-test/test/Spec.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server-0.6.0-linux-8.8.4: could not execute: tasty-discover
Files that failed:
 * /home/avh4/workspace/avh4-lib/filesystem-test/test/Spec.hs

Completed (2 files worked, 1 file failed)

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

LSP logs:
2020-12-02 20:55:46.189758041 [ThreadId 12809] - GhcIde.hover entered (ideLogger)
2020-12-02 20:55:46.190183321 [ThreadId 12809] - Hover request at position 92:8 in file: /home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs
2020-12-02 20:55:46.45059151 [ThreadId 12817] - DocumentHighlight request at position 92:7 in file: /home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs
2020-12-02 20:55:46.697539817 [ThreadId 12824] - finish: CodeAction (took 0.00s)
2020-12-02 20:55:46.697998522 [ThreadId 12826] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-02 20:55:46.700173042 [ThreadId 12828] - finish: importLens (took 0.00s)
2020-12-02 20:55:46.701210332 [ThreadId 12830] - finish: retrie (took 0.00s)
2020-12-02 20:55:46.702684206 [ThreadId 12832] - finish: tactic (took 0.00s)
2020-12-02 20:55:46.704227169 [ThreadId 12834] - finish: tactic (took 0.00s)
2020-12-02 20:55:46.704955331 [ThreadId 12836] - finish: tactic (took 0.00s)
2020-12-02 20:55:50.042439129 [ThreadId 12841] - Definition request at position 92:7 in file: /home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs
2020-12-02 20:55:50.157766566 [ThreadId 12850] - finish: CodeAction (took 0.00s)
2020-12-02 20:55:50.158620533 [ThreadId 12852] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-02 20:55:50.160094484 [ThreadId 12854] - finish: importLens (took 0.00s)
2020-12-02 20:55:50.16089724 [ThreadId 12856] - finish: retrie (took 0.00s)
2020-12-02 20:55:50.161749904 [ThreadId 12858] - finish: tactic (took 0.00s)
2020-12-02 20:55:50.162332355 [ThreadId 12860] - finish: tactic (took 0.00s)
2020-12-02 20:55:50.162886828 [ThreadId 12862] - finish: tactic (took 0.00s)
2020-12-02 20:55:52.622035557 [ThreadId 12868] - hlint:applyOneCmd:file=NormalizedFilePath "/home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs"
2020-12-02 20:55:52.62328554 [ThreadId 12869] - hlint:getIdeas:file:NormalizedFilePath "/home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs"
2020-12-02 20:55:52.623870274 [ThreadId 12869] - hlint:getIdeas:setExtensions:[Cpp,OverlappingInstances,UndecidableInstances,IncoherentInstances,UndecidableSuperClasses,MonomorphismRestriction,MonoPatBinds,MonoLocalBinds,RelaxedPolyRec,ExtendedDefaultRules,ForeignFunctionInterface,UnliftedFFITypes,InterruptibleFFI,CApiFFI,GHCForeignImportPrim,JavaScriptFFI,ParallelArrays,TemplateHaskell,TemplateHaskellQuotes,ImplicitParams,ImplicitPrelude,ScopedTypeVariables,AllowAmbiguousTypes,UnliftedNewtypes,BangPatterns,TypeFamilies,TypeFamilyDependencies,TypeInType,OverloadedStrings,OverloadedLists,NumDecimals,DisambiguateRecordFields,RecordWildCards,RecordPuns,ViewPatterns,GADTs,GADTSyntax,NPlusKPatterns,DoAndIfThenElse,BlockArguments,RebindableSyntax,ConstraintKinds,PolyKinds,DataKinds,InstanceSigs,ApplicativeDo,StandaloneDeriving,DeriveDataTypeable,AutoDeriveTypeable,DeriveFunctor,DeriveTraversable,DeriveFoldable,DeriveGeneric,DefaultSignatures,DeriveAnyClass,DeriveLift,DerivingStrategies,DerivingVia,TypeSynonymInstances,FlexibleContexts,FlexibleInstances,ConstrainedClassMethods,MultiParamTypeClasses,NullaryTypeClasses,FunctionalDependencies,UnicodeSyntax,ExistentialQuantification,MagicHash,EmptyDataDecls,KindSignatures,RoleAnnotations,ParallelListComp,MonadComprehensions,GeneralizedNewtypeDeriving,PostfixOperators,TupleSections,PatternGuards,LiberalTypeSynonyms,RankNTypes,ImpredicativeTypes,TypeOperators,ExplicitNamespaces,PackageImports,ExplicitForAll,AlternativeLayoutRuleTransitional,DatatypeContexts,NondecreasingIndentation,RelaxedLayout,TraditionalRecordSyntax,LambdaCase,MultiWayIf,BinaryLiterals,HexFloatLiterals,DuplicateRecordFields,OverloadedLabels,EmptyCase,PatternSynonyms,PartialTypeSignatures,NamedWildCards,TypeApplications,Strict,StrictData,MonadFailDesugaring,EmptyDataDeriving,NumericUnderscores,QuantifiedConstraints,ImportQualifiedPost,CUSKs,StandaloneKindSignatures,StarIsType]
2020-12-02 20:55:52.647110952 [ThreadId 12869] - finish: applyHint (took 0.02s)
2020-12-02 20:55:52.647183303 [ThreadId 12868] - applyHint:apply=[("/home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs:92:1-9: Warning: Eta reduce\nFound:\n  f a = f a\nPerhaps:\n  f = f\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 92, startCol = 1, endLine = 92, endCol = 10}, subts = [("body",SrcSpan {startLine = 92, startCol = 7, endLine = 92, endCol = 8})], orig = "f = body"}])]
2020-12-02 20:55:52.760232763 [ThreadId 12871] - finish: hlint (took 0.00s)
/opt/ghc/8.8.4/lib/ghc-8.8.4/settings: openFile: does not exist (No such file or directory)
[Error - 8:55:52 PM] Request workspace/executeCommand failed.
  Message: ExitFailure 1
  Code: -32603 
2020-12-02 20:55:52.778320812 [ThreadId 12877] - finish: CodeAction (took 0.00s)
2020-12-02 20:55:52.778848286 [ThreadId 12879] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-02 20:55:52.779511983 [ThreadId 12883] - GhcIde.hover entered (ideLogger)
2020-12-02 20:55:52.779781669 [ThreadId 12883] - Hover request at position 92:6 in file: /home/avh4/workspace/avh4-lib/filesystem-test/src/Test/Filesystem/FileTree.hs
2020-12-02 20:55:52.780005508 [ThreadId 12884] - finish: importLens (took 0.00s)
2020-12-02 20:55:52.780675446 [ThreadId 12891] - finish: retrie (took 0.00s)
2020-12-02 20:55:52.781198436 [ThreadId 12893] - finish: tactic (took 0.00s)
2020-12-02 20:55:52.781594097 [ThreadId 12895] - finish: tactic (took 0.00s)
2020-12-02 20:55:52.781867284 [ThreadId 12897] - finish: tactic (took 0.00s)
2020-12-02 20:55:52.998775698 [ThreadId 12903] - finish: CodeAction (took 0.00s)
2020-12-02 20:55:52.999610378 [ThreadId 12905] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-02 20:55:53.003179706 [ThreadId 12907] - finish: importLens (took 0.00s)
2020-12-02 20:55:53.006963219 [ThreadId 12909] - finish: retrie (took 0.00s)
2020-12-02 20:55:53.009803399 [ThreadId 12911] - finish: tactic (took 0.00s)
2020-12-02 20:55:53.015443576 [ThreadId 12913] - finish: tactic (took 0.00s)
2020-12-02 20:55:53.016644205 [ThreadId 12915] - finish: tactic (took 0.00s)
@avh4 avh4 changed the title Applying hlint quick fixes never finishes Applying an hlint quick fix never finishes Dec 3, 2020
@jneira jneira added component: hls-hlint-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Dec 3, 2020
@jneira
Copy link
Member

jneira commented Dec 3, 2020

@avh4 hi, thanks for reporting this. We have two issues here:

  • the application of hint fails with /opt/ghc/8.8.4/lib/ghc-8.8.4/settings: openFile: does not exist (No such file or directory) so the root cause is hlint seeking unavailable file /opt/ghc/8.8.4/lib/ghc-8.8.4/settings #591 (where you can find a workaround)
  • errors make the application of hint never finishes: error handling should be improved, closing the popup and displaying the error

I would keep open this to track the last one, as the title references it

@jneira jneira changed the title Applying an hlint quick fix never finishes Applying an hlint quick fix never finishes (better error handling) Dec 6, 2020
@jneira
Copy link
Member

jneira commented Jan 31, 2022

The concrete error was fixed and we have another issue about generic error handling in plugins: #1231
Feel free to reopen if you continue hitting the bug, thanks!

@jneira jneira closed this as completed Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-hlint-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants