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: broken spacing #11321

Closed
weinand opened this issue Aug 31, 2016 · 12 comments
Closed

debug console: broken spacing #11321

weinand opened this issue Aug 31, 2016 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Aug 31, 2016

  • VSCode Version: 1.5 insiders
  • OS Version: macOS

The line spacing has changed in the latest:

2016-08-31_17-50-21

Here is the spacing in stable:
2016-08-31_17-53-19

@weinand weinand added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Aug 31, 2016
@weinand weinand added this to the August 2016 milestone Aug 31, 2016
@isidorn
Copy link
Contributor

isidorn commented Aug 31, 2016

@roblourens this was probably introduced by your PR. Do you want to look into to (I can also fix it tomorrow morning)? I think it is not a big issue, we just need to ignore the last '\n' when spliting lines

To repro:

@roblourens
Copy link
Member

I debugged this and I see that every console.log in node produces an extra line - but the problem is that since the node adapter is listening to logs from stdout, there will be an extra newline at the end. e.g. -

console.log('test') produces an OutputEvent with value 'test\n'. And console.log('test\n') -> 'test\n\n'.

So I assume we should just remove the last newline here https://github.com/Microsoft/vscode-node-debug/blob/master/src/node/nodeDebug.ts#L913 but I also see this line that explicitly adds a newline - do you want all OutputEvents to be newline-terminated?

@isidorn
Copy link
Contributor

isidorn commented Sep 1, 2016

@roblourens @weinand since we are wrapping up the release I am fine with also filtering the last new line on the vscode since we were doing that previously. Though the right fix seems to be to handle this on the node debug side imho. Since 'hello' and 'hello\n' should produce different results on the vscode side.
@weinand let me know what you think, maybe I am missing something specified in the protocol

@weinand
Copy link
Contributor Author

weinand commented Sep 1, 2016

console.log('test') produces a '\n' at the end by definition of log():

Console.prototype.log = function() {
  this._stdout.write(util.format.apply(this, arguments) + '\n');
};

It is not node-debug that introduces any characters.

VS Code should not modify the data received through the OutputEvents in any way.
If a node program decides to use process.stdout.write("test") (which does not append a newline), VS Code should not add a newline on itself.

The best way to verify the behaviour of the debug console is to run a program that produced output both in the debug console and the integrated terminal.

@isidorn isidorn closed this as completed in f20867b Sep 1, 2016
@weinand
Copy link
Contributor Author

weinand commented Sep 1, 2016

Here is an example that shows the difference:

process.stdout.write("hello");
process.stderr.write("world");

Expected output from Integrated Terminal:
2016-09-01_11-16-33

Wrong output in Debug Console:
2016-09-01_11-15-35

@isidorn
Copy link
Contributor

isidorn commented Sep 1, 2016

That is not a regression so I have created a seperate issue to track this #11376

@roblourens
Copy link
Member

Wanted to point this out in case you didn't notice it- I see the extra line fixed between logs, but not between logs and console input:
image

@octref
Copy link
Contributor

octref commented Sep 1, 2016

Verified fix by building the latest from master. Here is the output for running tests in vscode-node-debug:

image

However, it's producing empty lines for strings much shorter than one line length, like for this line:

✓ should stop on a breakpoint in source (all files top level, missing sourceMappingURL) (424ms)

When the window is resized the problem is more severe.

image

My guess is color code like \033[0;31m are taken into account for counting line-width.

@isidorn

Should I add verified and open this bug as a new issue?

@isidorn
Copy link
Contributor

isidorn commented Sep 2, 2016

@octref yes, please add the verified and open the new issue. Good guess, color codes are probably the root cause fo the height measuring issue!

@joaomoreno
Copy link
Member

@octref Good guess

@isidorn
Copy link
Contributor

isidorn commented Sep 2, 2016

Adding verified instead of @octref just to get this out of our 'to-verify' query today

@isidorn isidorn added the verified Verification succeeded label Sep 2, 2016
@octref
Copy link
Contributor

octref commented Sep 2, 2016

Sorry just see it here. Thanks for adding it. I'll open an issue when I'm in office.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants