Skip to content
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

Debug Console in VS Code with Java support erroneously splits lines in output for sysout.printf/format #560

Closed
vitrums opened this issue Apr 9, 2019 · 3 comments

Comments

@vitrums
Copy link

vitrums commented Apr 9, 2019

Initially the ticket was opened under redhat-developer/vscode-java at redhat-developer/vscode-java#872 .
The question is also on stackoverflow: https://stackoverflow.com/questions/55588019/debug-console-in-vs-code-with-java-support-erroneously-splits-lines-in-output-fo. However this looks more like an issue with vscode-java-debug extension and therefore the question might as well belong here.

Basically System.out.format() and System.out.printf() split lines in unexpected positions and also treat %n inconsistently. From run to run it produces different results. Therefore notice, that the Current Result provided here is just one of many possible random outcomes.

Environment
Operating System: Windows 10 x64
JDK version: 1.8.0_181
Visual Studio Code version: 1.33.0 (user setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:28.026Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134
Java extension version: Version: 0.6.0 (according to changelog)
Steps To Reproduce
Create a file PrintfTest.java and open it with VS Code
Run
PrintfTest.java:
import java.util.stream.IntStream;

public class PrintfTest {
public static void main(String[] args) {
IntStream.range(0, 10).forEach(it ->
System.out.format("This is iteration %d. Hello VS Code! Hello RedHat!%n", it));
}
}

Current Result
This is iteration
0. Hello VS Code! Hello RedHat!
This is iteration 1. Hello VS Code! Hello RedHat!
This is iteration 2. Hello VS Code! Hello RedHat!
This is iteration 3. Hello VS Code! Hello RedHat!
This is iteration
4. Hello VS Code! Hello RedHat!
This is iteration
5
. Hello VS Code! Hello RedHat!
This is iteration
6. Hello VS Code! Hello RedHat!
This is iteration
6. Hello VS Code! Hello RedHat!
This is iteration
7
. Hello VS Code! Hello RedHat!
This is iteration 8. Hello VS Code! Hello RedHat!
This is iteration
9. Hello VS Code! Hello RedHat!

Expected Result
Just 10 solid lines like in any observable terminal or IDE's console?

Additional Informations
none

@testforstephen
Copy link
Contributor

Reproduced this issue. Looks like a vscode bug. Open a bug there. microsoft/vscode#72110

@testforstephen
Copy link
Contributor

The issue is fixed in the upstream vscode. Have a try in the latest vscode-insider version.
In the standard vscode, you may need wait it ready in the next vscode version.

@vitrums
Copy link
Author

vitrums commented Apr 12, 2019

This bug can no longer be reproduced in the latest nightly build:
Version: 1.34.0-insider (user setup)
Commit: b7c5e104a44b65e937408a10cbb8b49d6dfd19bf
Date: 2019-04-12T11:20:43.178Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134

Therefore closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants