-
Notifications
You must be signed in to change notification settings - Fork 763
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
Printing string with '\0' (ascii 0) truncates output #2240
Comments
Thanks for reporting. IIRC we've seen problems like this in the integrated output panel, and it's not straightforward to fix on our end. Unfortunately this is not likely to get fixed soon. Of course, for most use-cases if you have non-printing characters in your string, you may be better off escaped formatting, e.g. CC @hyangah |
@FlyingOnion Have you tried the Test Explorer UI? That uses the vscode terminal, instead of output console. I think that handles '\0' better. This is another strong reason to support #2044 and #1702 work cc @firelizzard18 |
If this does not reproduce with the Test Explorer UI, I'm inclined to say the fix is to use the new UI. If the new UI has the same issue, we could scrub '\0' from the output stream before handing it to VSCode. That would replicate what you see when you run |
@hyangah @firelizzard18 The builtin terminal of vscode outputs normally. So as @findleyr says, is it an issue of vscode rather than the extension? If so, I will pay more attentions to avoid this in writing tests. Thanks all for the reply. |
@FlyingOnion We're referring to using 'run test' vs using the green play button. Under the hood these use two different test support mechanisms. 'run test' and the other pre-1.59 testing UI uses the pre-1.59 test support infrastructure. The green play button uses the VSCode testing API. Pre-1.59 test support prints the output to an output channel and has the problem you describe: Testing API-based test support prints the output to a test console and does not have the problem: I'm interpreting what @findleyr said as meaning that VSCode's output channel API does not handle special characters well. To fix this particular case ( For you, we are recommending that you use the testing API-based test support when you need to deal with special characters. |
Go: 1.17.2 windows/amd64
VSCode: 1.67.1
VSCode-Go-Extention: 0.33.0
Example code:
Click "run test" in VSCode:
Run
go test
command in powershell or Git Bash:Maybe there's a better way to deal with this problem?
The text was updated successfully, but these errors were encountered: