Skip to content

Convert to template string incorrectly adds escaped backslashes #37330

Closed
@mjcrouch

Description

@mjcrouch

TS Template added by @mjbvz

TypeScript Version: 3.8.3

Search Terms

  • refactor
  • refactoring

  • VSCode Version: 1.43.0
  • OS Version: Windows 7 Pro

Steps to Reproduce:

  1. Add the following text to a typescript file (have not tried javascript):
return "\\[[" + text + "](" + link + ")\\]";
  1. Choose refactor -> Convert to template string
  2. Observe the following output:
return `\\\\[[${text}](${link})\\\\]`;

This contains too many backslashes - there should only be one escaped slash in each location, i.e.

return `\\[[${text}](${link})\\]`;

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions