Skip to content

getLine in eval code lens causes connection got disposed #2913

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

Open
michaelmesser opened this issue May 20, 2022 · 4 comments
Open

getLine in eval code lens causes connection got disposed #2913

michaelmesser opened this issue May 20, 2022 · 4 comments
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@michaelmesser
Copy link

Your environment

Which OS do you use:

MacOS
Which LSP client (editor/plugin) do you use:

VS Code+vscode-haskell

Describe your project (alternative: link to the project):

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/7.yaml

packages:
- .

Steps to reproduce

{-
>>> getLine
-}

Run the Evaluate code lens

Expected behaviour

Not sure

Actual behaviour

{-
>>> getLine
"Content-Length: 191\r"
-}

VSCode shows error message: Connection got disposed.

Include debug information

@michaelmesser michaelmesser added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels May 20, 2022
@xsebek
Copy link
Contributor

xsebek commented May 20, 2022

Hi @michaelmesser, this is a known limitation of the hls-eval-plugin.

My understanding of the plugin is that it runs in the same process as HLS, so you can not easily redirect its stdout/stderr.
Redirecting stdin seems even trickier than output because it's not clear how you should interact with it from the editor.

If you want, we could use this Issue to discuss what should be the Expected behaviour. 🙂


If you are looking for a workaround, you can get IO String with simple pure "My Input" or you can write your tested functions to accept String and separate the input/output handling. I hope that's helpful. 😉

@michaelpj
Copy link
Collaborator

michaelpj commented May 20, 2022

Maybe we could capture this limitation in the docs? We have a few "Known limitations" sections in the Features page.

@xsebek
Copy link
Contributor

xsebek commented May 21, 2022

Actual behaviour

>>> getLine
"Content-Length: 191\r"

Btw. is the string stolen from the input sent to HLS and making it close the connection? 🤔

@anka-213 pointed out in #1977 that HLS moves its stdout, maybe a similar thing is necessary for stdin here?

@pepeiborra
Copy link
Collaborator

pepeiborra commented May 22, 2022

@anka-213 pointed out in #1977 that HLS moves its stdout, maybe a similar thing is necessary for stdin here

Yes, this is right. The redirection is done in Development.IDE.Main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-eval-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

5 participants