Skip to content

Commit b24b6a1

Browse files
authored
fixes #49491 (#49493)
1 parent 8636adb commit b24b6a1

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

Diff for: src/services/utilities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ namespace ts {
26472647
Debug.assert(fileName === renameFilename);
26482648
for (const change of textChanges) {
26492649
const { span, newText } = change;
2650-
const index = indexInTextChange(newText, name);
2650+
const index = indexInTextChange(newText, escapeString(name));
26512651
if (index !== -1) {
26522652
lastPos = span.start + delta + index;
26532653

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @strict: true
4+
5+
////class A {
6+
//// /*a*/"\\foo": "";/*b*/
7+
////}
8+
9+
goTo.select("a", "b");
10+
edit.applyRefactor({
11+
refactorName: "Generate 'get' and 'set' accessors",
12+
actionName: "Generate 'get' and 'set' accessors",
13+
actionDescription: "Generate 'get' and 'set' accessors",
14+
newContent:
15+
`class A {
16+
private /*RENAME*/"_\\\\foo": "";
17+
public get "\\\\foo"(): "" {
18+
return this["_\\\\foo"];
19+
}
20+
public set "\\\\foo"(value: "") {
21+
this["_\\\\foo"] = value;
22+
}
23+
}`
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @strict: true
4+
5+
////class A {
6+
//// /*a*/"\tfoo": "";/*b*/
7+
////}
8+
9+
goTo.select("a", "b");
10+
edit.applyRefactor({
11+
refactorName: "Generate 'get' and 'set' accessors",
12+
actionName: "Generate 'get' and 'set' accessors",
13+
actionDescription: "Generate 'get' and 'set' accessors",
14+
newContent:
15+
`class A {
16+
private /*RENAME*/"_\\tfoo": "";
17+
public get "\\tfoo"(): "" {
18+
return this["_\\tfoo"];
19+
}
20+
public set "\\tfoo"(value: "") {
21+
this["_\\tfoo"] = value;
22+
}
23+
}`
24+
});

0 commit comments

Comments
 (0)