Skip to content

Applying HLint Suggestions does not work at all #61

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
otbe opened this issue Apr 1, 2018 · 7 comments
Closed

Applying HLint Suggestions does not work at all #61

otbe opened this issue Apr 1, 2018 · 7 comments
Labels
type: bug A bug or unintended effect

Comments

@otbe
Copy link

otbe commented Apr 1, 2018

Hi,

I saw #33 but in my case applying hlint suggestions does not work at all.
kapture 2018-04-01 at 10 39 54
And this is the output (note the Nothing for _documentChanges)
bildschirmfoto 2018-04-01 um 10 45 43

I use the latest versions of vscode insiders, hie server and engine.
Thanks!

@Tehnix Tehnix added type: bug A bug or unintended effect capability: codeAction labels Apr 8, 2018
@nickolay
Copy link

nickolay commented May 2, 2018

hlint itself doesn't support refactorings for the "Eta reduce" warning (ndmitchell/hlint#253).

What I think https://github.com/haskell/haskell-ide-engine could do is not suggest unsupported refactorings in reply to the codeAction request.

(Some background: microsoft/language-server-protocol#394, codeAction specification)

Note that some improvements were made in the area of applying hints very recently in haskell/haskell-ide-engine#533

@AlexeyRaga
Copy link
Contributor

I guess that we could either filter this diagnostic out on HIE side or maybe it would be possible to supply hlint config to suppress this suggestion...

project-local .hlint.yaml with something like - ignore: {name: Eta reduce} could be used as a workaround.

@zliu41
Copy link

zliu41 commented Jul 27, 2020

HLint now supports eta reduce refactoring (ndmitchell/hlint#1085).

@zenVentzi
Copy link

zenVentzi commented Dec 23, 2020

New to haskell but in a .hs file,

type myFn a = abs a and clicking the Apply hint: Eta reduce does not work. The one below it works but I've seen also other ones that don't that I cannot recall right now. The bottom of the screen stays at(screenshot) + the name of the operation
image

@jneira
Copy link
Member

jneira commented Dec 23, 2020

@zenVentzi thanks for reporting the error. iiuc some refactorings work and others don't, right?
could you share the log of the haskell extension? you can find it in view -> output -> Haskell(project)

imagen

@zenVentzi
Copy link

zenVentzi commented Dec 25, 2020

2020-12-25 22:18:47.5556638 [ThreadId 11660] - GhcIde.hover entered (ideLogger)
2020-12-25 22:18:47.5666414 [ThreadId 11660] - Hover request at position 3:5 in file: c:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:18:47.5976446 [ThreadId 11670] - DocumentHighlight request at position 3:5 in file: c:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:18:47.8272657 [ThreadId 11677] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:47.8282695 [ThreadId 11679] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:47.8322706 [ThreadId 11681] - finish: importLens (took 0.00s)
2020-12-25 22:18:47.8332716 [ThreadId 11683] - finish: addPragma (took 0.00s)
2020-12-25 22:18:47.8352698 [ThreadId 11685] - finish: retrie (took 0.00s)
2020-12-25 22:18:47.8362683 [ThreadId 11687] - finish: tactic (took 0.00s)
2020-12-25 22:18:47.8362683 [ThreadId 11689] - finish: tactic (took 0.00s)
2020-12-25 22:18:47.8372688 [ThreadId 11691] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5081679 [ThreadId 11697] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:51.5081679 [ThreadId 11699] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:51.510159 [ThreadId 11701] - finish: importLens (took 0.00s)
2020-12-25 22:18:51.5111625 [ThreadId 11703] - finish: addPragma (took 0.00s)
2020-12-25 22:18:51.5151587 [ThreadId 11705] - finish: retrie (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11707] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11709] - finish: tactic (took 0.00s)
2020-12-25 22:18:51.5249798 [ThreadId 11711] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.6654331 [ThreadId 11717] - hlint:applyOneCmd:file=NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"
2020-12-25 22:18:56.6664531 [ThreadId 11718] - hlint:getIdeas:file:NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"
2020-12-25 22:18:56.6674521 [ThreadId 11718] - finish: applyHint (took 0.00s)
2020-12-25 22:18:56.6674521 [ThreadId 11717] - applyHint:apply=[("C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs:3:1-14: Warning: Eta reduce\nFound:\n  myFn a = abs a\nPerhaps:\n  myFn = abs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 3, startCol = 1, endLine = 3, endCol = 15}, subts = [("body",SrcSpan {startLine = 3, startCol = 10, endLine = 3, endCol = 13})], orig = "myFn = body"}])]
2020-12-25 22:18:56.7133763 [ThreadId 11720] - finish: hlint (took 0.00s)
haskell-language-server-0.7.1-win32-8.10.1.exe: could not detect mingw toolchain
[Error - 10:18:56 PM] Request workspace/executeCommand failed.
  Message: ExitFailure 1
  Code: -32603 
2020-12-25 22:18:56.7412736 [ThreadId 11726] - finish: CodeAction (took 0.00s)
2020-12-25 22:18:56.7412736 [ThreadId 11728] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:18:56.7433211 [ThreadId 11730] - finish: importLens (took 0.00s)
2020-12-25 22:18:56.7442784 [ThreadId 11732] - finish: addPragma (took 0.00s)
2020-12-25 22:18:56.745272 [ThreadId 11734] - finish: retrie (took 0.00s)
2020-12-25 22:18:56.7464416 [ThreadId 11736] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.7474548 [ThreadId 11740] - finish: tactic (took 0.00s)
2020-12-25 22:18:56.7464416 [ThreadId 11738] - finish: tactic (took 0.00s)

this log is for the Eta reduce not working

2020-12-25 22:22:30.3516328 [ThreadId 11818] - finish: CodeAction (took 0.00s)
2020-12-25 22:22:30.3526188 [ThreadId 11820] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:22:30.3546638 [ThreadId 11822] - finish: importLens (took 0.00s)
2020-12-25 22:22:30.3566304 [ThreadId 11824] - finish: addPragma (took 0.00s)
2020-12-25 22:22:30.3576406 [ThreadId 11826] - finish: retrie (took 0.00s)
2020-12-25 22:22:30.3596595 [ThreadId 11828] - finish: tactic (took 0.00s)
2020-12-25 22:22:30.3606226 [ThreadId 11832] - finish: tactic (took 0.00s)
2020-12-25 22:22:30.3596595 [ThreadId 11830] - finish: tactic (took 0.00s)
fromList [NormalizedFilePath "C:\\Users\\zen_ventzi\\Desktop\\hs\\test.hs"]
2020-12-25 22:22:34.6276789 [ThreadId 11839] - finish: Retrie.GhcSessionDeps (took 0.00s)
2020-12-25 22:22:34.6276789 [ThreadId 11841] - finish: Retrie.getBinds (took 0.00s)
hgIgnorePred: hg: readCreateProcessWithExitCode: does not exist (No such file or directory)
gitIgnorePred: fatal: not a git repository (or any of the parent directories): .git

Reading VCS ignore failed! Continuing without ignoring.
stdin:
C:\Users\zen_ventzi\Desktop\hs\test.hs

shellCmd:
xargs grep -l 'abs'
Files:
Files:
C:\Users\zen_ventzi\Desktop\hs\test.hs
2020-12-25 22:22:34.9151699 [ThreadId 11853] - finish: Retrie.GetFileContents (took 0.00s)
2020-12-25 22:22:35.9082548 [ThreadId 11863] - finish: CodeAction (took 0.00s)
2020-12-25 22:22:35.9082548 [ThreadId 11865] - finish: CodeAction:PackageExports (took 0.00s)
2020-12-25 22:22:35.909257 [ThreadId 11867] - finish: importLens (took 0.00s)
2020-12-25 22:22:35.9103445 [ThreadId 11869] - finish: addPragma (took 0.00s)
2020-12-25 22:22:35.9113302 [ThreadId 11871] - finish: retrie (took 0.00s)
2020-12-25 22:22:35.9123263 [ThreadId 11873] - finish: tactic (took 0.00s)
2020-12-25 22:22:35.9123263 [ThreadId 11875] - finish: tactic (took 0.00s)
2020-12-25 22:22:35.9133288 [ThreadId 11877] - finish: tactic (took 0.00s)

this log is for Fold not working

@jneira
Copy link
Member

jneira commented Dec 25, 2020

Hi, thanks for share the log. Within it we can check the root error: haskell-language-server-0.7.1-win32-8.10.1.exe: could not detect mingw toolchain.
There is a open issue in the haskell-language-server project: haskell/haskell-language-server#615
There you can find the actual situation of the issue and a workaround.

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

7 participants