Change:
<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --Steps to Reproduce: debugging and try to edit a string variable value containing newline characters in variables debug view. enter (without modifying variable value), observe the value have been modified and the newline characters have been removed. !
Looking into it
we have merged a PR which tackles this issue. Please try it out in tomorrows vscode insiders and let us know if the issue is fixed for you. Thank you
I tested it but it generates the wrong value sometimes ! I did some research and it seems we also need to unscape the string when we get the new value from the input change this line to
Thanks for testing. You want to submit a PR or should I?
go ahead
I did some more testing using the python extension and with both changes (the original PR and my suggestion) it breaks because the python extension also unescapes the newlines. So I think we need to agree where the unescaping is done if inside vscode or the extensions. This is somewhat related to
In theory VSCode should not modify the original values. We only change them for presentation purposes. would you like to provide a PR which cleans this up? And easy starting point would be just looking where the replaceWhitespace function is being used. And it should only be used to make something easier to read, not to change the actual value.
I looked at the places where is being used and I think those are OK. After reading the Debug Adapter Protocol have a few observations: Let's say an additional input widget, for editing a variable's value, exists (could be the case that another editor use this widget) that uses a (instead of a ) then, for this widget, using escaped sequences is not needed while editing the value of a string variable. The new value obtained from this widget is send to the debugging extension and should be used as is (must not unescape the newlines) to update the variable value. In contrast using a , we need to escape newlines and when sending the new value the extension should unescape them. But currently there's no way for an extension to know when to unescaped or not a string. (if this is the case, this should be handled in the editor or update the DAP with an additional parameter in the request) Or strings values returned from the extension must always have newlines, etc, escaped and while editing them we always need to escape newlines,etc. (if this is the case then I'll open an issue in the node extension and I think would no longer be needed)
It seems like the initial state of test3 on the variable pane should be "n" based on how it's printed into the output. Going to reopen as the general issue doesn't seem to be fixed (editing a variable without making a change, changes it).
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details . If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our and guidelines. Thanks for your understanding and happy coding!

Discussion:
}); const styler = attachInputBoxStyler(inputBox, this.themeService); <del> inputBox.value = options.initialValue; </del> <ins> inputBox.value = replaceWhitespace(options.initialValue); </ins> inputBox.focus(); inputBox.select();