Skip to content

HLint actions fail for Debian(WSL) and Coc #1163

Closed
@davorklju

Description

@davorklju

Your environment

Debian 10 running though WSL

haskell-language-server-wrapper --probe-tools
haskell-language-server version: 0.7.1.0 (GHC: 8.10.1) (PATH: /home/davor/.ghcup/bin/haskell-language-server-wrapper-0.7.1) (GIT hash: e4f677e)
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:
Neovim with CoC

Steps to reproduce

clone https://github.com/davorklju/hsl-issue
Open vim and enter :CocConfig.
Copy the contents of hls-test/coc-setting.json into the buffer and save.
Open hsl-issue/src/Foo.hs
Move the cursor over foo, when the hlint message pops up enter :CocAction
Select "Apply hint: Eta reduce" and hit enter.

Expected behaviour

The code changes from "foo x = foo x" to "foo = foo"

Actual behaviour

The code stays the same.

Include debug information

Debug output:
2021-01-06 22:44:50.6299249 [ThreadId 5] - ---> {"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///home/davor/hls-issue/src/Foo.hs"},"position":{"line":2,"character":0}}}
2021-01-06 22:44:50.6302658 [ThreadId 487] - DocumentHighlight request at position 3:1 in file: /home/davor/hls-issue/src/Foo.hs
2021-01-06 22:44:50.6305675 [ThreadId 489] - finish: C:GetHieAst (took 0.00s)
2021-01-06 22:44:50.6308276 [ThreadId 7] - <--2--{"result":[{"kind":3,"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":3}}},{"kind":2,"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":11}}}],"jsonrpc":"2.0","id":1}
2021-01-06 22:44:53.6238148 [ThreadId 5] - ---> {"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///home/davor/hls-issue/src/Foo.hs"},"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":13}},"context":{"diagnostics":[{"severity":3,"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":13}},"code":"refact:Eta reduce","source":"hlint","message":"Eta reduce\nFound:\n  foo x = foo x\nWhy not:\n  foo = foo\n"}]}}}
2021-01-06 22:44:53.6245271 [ThreadId 494] - finish: CodeAction (took 0.00s)
2021-01-06 22:44:53.8419578 [ThreadId 500] - finish: CodeAction:PackageExports (took 0.22s)
2021-01-06 22:44:53.8426448 [ThreadId 501] - finish: importLens (took 0.00s)
2021-01-06 22:44:53.8429971 [ThreadId 503] - finish: addPragma (took 0.00s)
2021-01-06 22:44:53.8433519 [ThreadId 505] - finish: retrie (took 0.00s)
2021-01-06 22:44:53.8437911 [ThreadId 507] - finish: tactic (took 0.00s)
2021-01-06 22:44:53.8443071 [ThreadId 512] - finish: tactic (took 0.00s)
2021-01-06 22:44:53.8445941 [ThreadId 513] - finish: tactic (took 0.00s)
2021-01-06 22:44:53.8556092 [ThreadId 7] - <--2--{"result":[{"command":{"command":"11513:hlint:applyOne","arguments":[{"hintTitle":"Eta reduce","start_pos":{"line":2,"character":0},"file":"file:///home/davor/hls-issue/src/Foo.hs"}],"title":"Apply hint: Eta reduce"},"kind":"quickfix","diagnostics":[{"severity":3,"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":13}},"code":"refact:Eta reduce","source":"hlint","message":"Eta reduce\nFound:\n  foo x = foo x\nWhy not:\n  foo = foo\n"}],"title":"Apply hint: Eta reduce"},{"command":{"command":"11513:retrie:retrieCommand","arguments":[{"restrictToOriginatingFile":false,"rewrites":[{"tag":"Unfold","contents":"Foo.foo"}],"originatingFile":[2495434174900889004,"file:///home/davor/hls-issue/src/Foo.hs"],"description":"Unfold foo"}],"title":"Unfold foo"},"kind":"refactor.inline","title":"Unfold foo"},{"command":{"command":"11513:retrie:retrieCommand","arguments":[{"restrictToOriginatingFile":true,"rewrites":[{"tag":"Unfold","contents":"Foo.foo"}],"originatingFile":[2495434174900889004,"file:///home/davor/hls-issue/src/Foo.hs"],"description":"Unfold foo in current file"}],"title":"Unfold foo in current file"},"kind":"refactor.inline","title":"Unfold foo in current file"},{"command":{"command":"11513:retrie:retrieCommand","arguments":[{"restrictToOriginatingFile":false,"rewrites":[{"tag":"Fold","contents":"Foo.foo"}],"originatingFile":[2495434174900889004,"file:///home/davor/hls-issue/src/Foo.hs"],"description":"Fold foo"}],"title":"Fold foo"},"kind":"refactor.extract","title":"Fold foo"},{"command":{"command":"11513:retrie:retrieCommand","arguments":[{"restrictToOriginatingFile":true,"rewrites":[{"tag":"Fold","contents":"Foo.foo"}],"originatingFile":[2495434174900889004,"file:///home/davor/hls-issue/src/Foo.hs"],"description":"Fold foo in current file"}],"title":"Fold foo in current file"},"kind":"refactor.extract","title":"Fold foo in current file"}],"jsonrpc":"2.0","id":2}
2021-01-06 22:44:54.8835931 [ThreadId 5] - ---> {"jsonrpc":"2.0","id":3,"method":"workspace/executeCommand","params":{"command":"11513:hlint:applyOne","arguments":[{"hintTitle":"Eta reduce","start_pos":{"line":2,"character":0},"file":"file:///home/davor/hls-issue/src/Foo.hs"}]}}
2021-01-06 22:44:54.8840451 [ThreadId 7] - <--2--{"jsonrpc":"2.0","params":{"token":1},"method":"window/workDoneProgress/create","id":3}
2021-01-06 22:44:54.883993 [ThreadId 519] - hlint:applyOneCmd:file=NormalizedFilePath "/home/davor/hls-issue/src/Foo.hs"
2021-01-06 22:44:54.8842174 [ThreadId 7] - <--2--{"jsonrpc":"2.0","params":{"value":{"kind":"begin","cancellable":true,"title":"Applying hint: Eta reduce"},"token":1},"method":"$/progress"}
2021-01-06 22:44:54.8843628 [ThreadId 520] - hlint:getIdeas:file:NormalizedFilePath "/home/davor/hls-issue/src/Foo.hs"
2021-01-06 22:44:54.8844978 [ThreadId 520] - 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]
2021-01-06 22:44:54.8855166 [ThreadId 5] - ---> {"jsonrpc":"2.0","id":3,"result":null}
2021-01-06 22:44:54.8855653 [ThreadId 520] - finish: applyHint (took 0.00s)
2021-01-06 22:44:54.8855929 [ThreadId 5] - haskell-lsp:Got reply message:"{\"jsonrpc\":\"2.0\",\"id\":3,\"result\":null}"
2021-01-06 22:44:54.8856055 [ThreadId 519] - applyHint:apply=[("/home/davor/hls-issue/src/Foo.hs:3:1-13: Warning: Eta reduce\nFound:\n  foo x = foo x\nPerhaps:\n  foo = foo\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 3, startCol = 1, endLine = 3, endCol = 14}, subts = [("body",SrcSpan {startLine = 3, startCol = 9, endLine = 3, endCol = 12})], orig = "foo = body"}])]
2021-01-06 22:44:54.8877648 [ThreadId 522] - finish: hlint (took 0.00s)
2021-01-06 22:44:54.8895101 [ThreadId 7] - <--2--{"error":{"code":-32603,"message":"ExitFailure 1"},"jsonrpc":"2.0","id":3}
LSP logs:
2021-01-06T22:48:00.453 WARN (pid:11762) [attach] - Plugin not ready when received "highlight" []
2021-01-06T22:48:00.526 INFO (pid:11762) [services] - registered service "languageserver.haskell"
2021-01-06T22:48:00.532 INFO (pid:11762) [services] - haskell state change: stopped => starting
2021-01-06T22:48:00.547 INFO (pid:11762) [services] - registered service "highlight"
2021-01-06T22:48:00.551 INFO (pid:11762) [plugin] - coc.nvim 0.0.80-c47ed1d31a initialized with node: v10.21.0 after 86ms
2021-01-06T22:48:00.557 INFO (pid:11762) [language-client-index] - Language server "languageserver.haskell" started with 11773
2021-01-06T22:48:00.582 INFO (pid:11762) [language-client-index] - highlight started with 11778
2021-01-06T22:48:01.041 INFO (pid:11762) [services] - haskell state change: starting => running
2021-01-06T22:48:01.051 INFO (pid:11762) [services] - service languageserver.haskell started
2021-01-06T22:48:04.124 INFO (pid:11762) [attach] - receive notification: highlight []
2021-01-06T22:48:06.216 INFO (pid:11762) [attach] - receive notification: codeActionRange [ 3, 3 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions