-
-
Notifications
You must be signed in to change notification settings - Fork 389
Capture stdout and stderr in eval plugin #1977
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
I would like to try implementing the In #2775 it was suggested by @pepeiborra to use So far I could not figure out from GHC docs and code what happens to |
I wonder if a simple redirect of stdout using There might also be an issue with this approach if we want to run multiple
haskell-language-server/ghcide/src/Development/IDE/Main.hs Lines 260 to 273 in 6524122
Maybe all that's needed is to redirect |
Hey @anka-213, thanks for pointing the redirection out, I was not aware of it! The "global per process" part is exactly why we would like to use the external interpreter process as GHC and GHCi do. But if we can hack in some |
Using the external interpreter is the right fix, but I think the last time I tried it didn't support graceful restarts. |
One of the reasons why this feature is good to have is to work around the allow one to print non-ASCII characters, which Here is a workaround for this that I found that may be helpful until this gets fixed, or may be helpful in finding a solution. It seems that going via the
|
Another reason why capturing stdout is indeed needed: The workaround mentioned in the docs (i.e. use
(Now, I could add wildcards |
Steps to reproduce
Run the "Evaluate..." code lens on the following code
or
Expected behaviour
It should put
in a comment below, just like it would do with normal return values.
Actual behaviour
In the
stderr
case, the output is sent to the debug output together with the logs.In the
stdout
case I believe the output is sent in the LSP channel directly to the editor as is. If you're lucky, the editor's LSP parser will handle the error gracefully instead of just crashing or something.The text was updated successfully, but these errors were encountered: