-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Editing string variable value removes newline characters '\n' in variables debug view #73975
Comments
Looking into it |
@jeanp413 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 |
@isidorn @NizamLZ 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 export function replaceWhitespace(value: string): string {
const map: { [x: string]: string } = { '\n': '\\n', '\r': '\\r', '\t': '\\t', '\b': '\\b', '\v': '\\v', '\f': '\\f' };
return value.replace(/[\n\r\t\b\v\f]/g, char => map[char]);
}
function replaceEscapedWhitespace(value: string): string {
const map: { [x: string]: string } = { '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\b': '\b', '\\v': '\v', '\\f': '\f' };
return value.replace(/\\[nrtbvf]/g, escapedWhitespace => map[escapedWhitespace]);
}
change this line ⬆️ to options.onFinish(replaceEscapedWhitespace(inputBox.value), renamed); |
@jeanp413 Thanks for testing. You want to submit a PR or should I? |
@NizamLZ go ahead 👍 |
@isidorn @NizamLZ 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. |
In theory VSCode should not modify the original values. |
@isidorn I looked at the places where
|
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 here. 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 roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
Steps to Reproduce:
'\n'
in variables debug view.'\n'
have been removed.The text was updated successfully, but these errors were encountered: