-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Clearing console in node is not clearing it, instead dumping weird characters #27389
Comments
That's a control code for clearing the terminal, that isn't supported by the console. |
The node2 debug adapter could exectue the following command on the vscode side once it detects this special control code The language agnostic UI should not solve this special node case |
That makes sense. We don't have a way for the debug adapter to send a message to the extension host side right now, right? Just the other way around? |
The console supports the color control codes, right? Should this fall into the same category? Might be relevant for the powershell extension, etc. |
It can fall in the same category as the colors if there is one universal control character that is used across languages to clear the console. Yes, we currently do not have a mechanism for the debug adapter to send messages to the extension host, just the other way around. Though we do have the notion of the adapter sending a request to VSCode, more details here. This could easily be enhanced to cover the case of debug adapter being able to request some commands to be executed. @weinand thoughts? |
If there is a standard (ANSI) code for clearing a terminal we should try to support this for the debug console. I checked and there is an "Erase Display" escape sequence (see: http://ascii-table.com/ansi-escape-sequences.php) |
Thanks @weinand then it makes sense to do it on the vscode side. Assigning to me |
We now support this. |
@isidorn It would be nice to at least omit unsupported escape codes to prevent them from polluting console output. Or is this something I should be fixing with the clear module directly? |
VS Code should omit unsupported escape codes. |
I agree that vs code should omit unsopported escape codes however we currently do not have a nice list of what we support and what we do not and we only have a utility method to remove all ansi escape code. Code pointers: PRs / feature requests welcome |
What does vscode support? I think I can handle that. |
@jens1o you can see what is being used in the replViewer method handleAnsi which I have linked above |
Okay, thanks. |
Before I create a pr which is wrong, is this right? jens1o@9bc68d7 |
There are a couple of things wrong with that approach RemoveUnsopported is only debug specific since the debug framework is currently not supporting them, it is not like we have a general VSCode concenzus that they are not supported. CopyAllACtion shuold not be touched since it shuold remove all ansi escape codes, no matter if they are supported or not. |
Okay, thanks for the feedback. |
I hope this fits your needs: master...jens1o:jens1o-strip-unsupported-ansi |
I've verified that the "Erase Display" escape sequence works (but the unrecognised sequence '[0f' still shows up). @jens1o please create a real PR if you want to have us look into your fix. BTW, I noticed in your change that the way you construct the regular expression "UNSUPPORTED_ANSI_REGEX" looks fishy to me. The result is a string and not a reg exp. So the removeUnsupportedAnsiCodes helper function does not work the way you think it should work. Have you verified that the code from the first comment in this issue really shows no '[0f' at the beginning of the line? |
Unfortunately no, I can't start compiling in an acceptable time, so I can't contribute on this topic. |
Steps to Reproduce:
Install clear using 'npm clear'
Debug a node app that has code like this:
var clear = require('clear');
console.log("Stuff");
clear(true);
console.log("This is all that should display")
Instead, I see stuff like this (notice odd characters):
The text was updated successfully, but these errors were encountered: