Skip to content

Remove extraneous string escape from convert to template string refactor #37743

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

Merged
merged 3 commits into from
Apr 9, 2020

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Apr 1, 2020

Fixes #37330

String literal text should be transferred to template head/tail text without modification—it gets escaped in the printer.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one tiny style comment

@andrewbranch
Copy link
Member Author

@orta, playwright failed to install all of a sudden on node 8 both in Actions and in Pipelines. Have you seen this before? 🤔

@andrewbranch andrewbranch merged commit 57f9076 into microsoft:master Apr 9, 2020
@orta
Copy link
Contributor

orta commented Apr 9, 2020

No, this sounds like the first time it's failed full stop

@orta
Copy link
Contributor

orta commented Apr 9, 2020

Because the dep isn't locked, it looks like it needs bumping to node 10

@thw0rted
Copy link

I can't tell if this is supposed to have landed in production yet. I'm running VSCode 1.49.0, which I think is TS 4.0 under the hood. Should I expect the behavior I'm seeing to include this PR?

I came here because I just converted "\b" + query + "\b" to a template and got "missing character" unicode boxes, i.e. `�${query}�`, as the result.

The missing character I pasted in there looks like an empty square in the GH Markdown editor but a question-mark inside a black diamond in the preview. I copied the character, then pasted into the Chrome dev tools console as "{paste}".charCodeAt(0), which returns 8 -- so it's converting the nice readable backspace escape sequence into a literal backspace character.

Obviously, in my case I actually meant to write "\\b" + query + "\\b" -- it was an oversight in the original code. But the TS convert-to-template refactoring feature is changing the escape sequence to a literal. I checked and this happens for all escape sequences: newline, form-feed, etc. I'm pretty sure it shouldn't, and I'm trying to figure out if it was fixed by this PR, or if the PR introduced the bug.

I guess what I'm asking is, should I open a new issue?

@andrewbranch andrewbranch deleted the bug/37330 branch September 17, 2020 17:52
@andrewbranch
Copy link
Member Author

@thw0rted yes, if you could open a new issue, that would be great. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Convert to template string incorrectly adds escaped backslashes
5 participants