-
-
Notifications
You must be signed in to change notification settings - Fork 391
Retrie is broken on Windows #2051
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
Comments
Hi, thanks for the bug report, could you post the module where you are trying to trigger retry (or the relevant pragmas for retrie)? |
Could you also share a repro using VSCode? |
@jneira It fails for every module I’ve tried. (Also, it’s not just retrie either: all Wingman operations fail as well.) @pepeiborra I don’t use VSCode regularly, but I’ll try to reproduce it. |
@pepeiborra VSCode also gives me an error when I attempt to use Retrie or Wingman: |
Thanks @bradrn but we need more details to reproduce. Project, steps, versions of hls, ghc, etc. |
Project: this seems to happen for any project, even just plain Stack GHC version: again, this seems to be independent of GHC version from what I can tell. HLS version:
|
Can you attach a screen recording too please? |
(EDIT: The uploaded video seems to have cut off all the relevant parts of my original recording. I’ll try to upload a better video.) |
@pepeiborra Here’s a better recording: hls-error.mp4As shown towards the end of the video most parts of HLS are working correctly; it is only retrie and parts of Wingman which are buggy. |
hmm from the path of the call to hls in the cli it seems you are on windows, no? |
Correct, I am on Windows 10. |
ok, there is a existing issue about retrie and windows, although the symptoms are not the same afaics #533 |
Interesting… not sure if this is the same issue, but they certainly could be related. Do you know of any further tests I could try to diagnose this? (Though it’s getting late here and I don’t have time to do anything just right now.) |
I just tried a retrie |
Sorry, I’m not sure what you mean… are you saying that I should try removing |
no, no, I think maybe you already have xargs in scope and the error you are getting is the next one |
However wingman works correctly in my end |
Logs for the wingman actions would be helpful as well. Thanks! |
@isovector Sorry, which logs do you want? Because as far as I can tell the logs are the same for Retrie and Wingman — both give similar parse errors. |
@bradrn maybe just the whole log! |
Mmm, one thing that share retrie and wingman is ghc-exactprint usage iirc. No evidence to back the intuition though |
Curiouser and curiouser. I tried to test the various code actions available to confirm what does and doesn’t work, On the other hand, Retrie is still not working, but it seems to give different errors depending on which command I use:
@isovector I tried collecting logs while testing, but I doubt you’ll be interested in all 70000+ lines! I’m not even sure where I would share a file of that size. |
OK, now I’m thoroughly stumped. I decided to try Wingman in another project, and this time round it failed, with an absolutely bizarre error message:
Any ideas? |
Ugh, do you have the package installed in that location? |
I think all lines emitted by wingman would have the plugin name, maybe extracting them from the log while reproducing the error (they should not be so much) would help |
The path
Good idea, I’ll try this. |
very interesting, those paths could be hardcoded while assembling the executable (although they are not directly in the source code as you suspect), how did you got the hls executable? did the vscode extension download for you? |
As mentioned already I’m using Emacs; the executables are simply downloaded from the GitHub releases page. |
oh, right, vscode downloads the executable from the same location. To investigate. I will try to dust off my emacs installation in my windows 10 laptop if i have time. |
You're running into #2015 on the Wingman side |
Thanks @isovector! |
I've been meaning to look into retrie on windows. My current thinking is that this is an escaping issues when passing backslash-based paths as stdin to xargs
Something similar happens when running this in powershell, but weirdly not in cmd.exe . This command is build when retrie tries to filter down a list of paths here. This command eventually runs this function in System.Process so maybe the comment is related. The quickest fix probably would be to substitute \ with / in the paths in the plugin. |
@Tarmean wow, thanks for the further investigation, the fix could be convert the windows paths to unix style ones and does not seem to be too complex, would you be interested in make a pr? |
The path conversion was really easy. Unfortunately the current System.Process implementation (well, hPutStr) also seems to mangle newlines in the stdin channel of the created process on windows by turning '\n' into '\r\n'. This also breaks xargs. The stdin handle is created as 'intPtrToPtr (-1)' and I don't know enough about how this magic works to say how badly things would break if one were to call hSetNewlineMode. An more palatable
into
Either way I'm currently out of time so I will have to experiment more later. |
I had to add a function to try to avoid that: haskell-language-server/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs Lines 437 to 441 in 2fef041
|
Replacing the usage of getTargetFiles with this version works on windows, the additions are This is a gist and not a pullrequest to retrie because I noticed a couple of oddities and want to double check they aren't my fault. I think the weirdness are existing bugs in retrie, though
Here is an example of weird operator behavior
|
Cross-posted from emacs-lsp/lsp-haskell#128 on the recommendation of @michaelpj:
And the relevant part of the log from LSP:
The text was updated successfully, but these errors were encountered: