Skip to content

Commit 9fd0202

Browse files
authored
fix(36481): allow renaming private fields (microsoft#36499)
1 parent 6769313 commit 9fd0202

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/services/rename.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ namespace ts.Rename {
9292
function nodeIsEligibleForRename(node: Node): boolean {
9393
switch (node.kind) {
9494
case SyntaxKind.Identifier:
95+
case SyntaxKind.PrivateIdentifier:
9596
case SyntaxKind.StringLiteral:
9697
case SyntaxKind.NoSubstitutionTemplateLiteral:
9798
case SyntaxKind.ThisKeyword:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////class Foo {
4+
//// [|/**/#foo|] = 1;
5+
////
6+
//// getFoo() {
7+
//// return this.#foo;
8+
//// }
9+
////}
10+
11+
goTo.marker("");
12+
verify.renameInfoSucceeded("#foo");
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////class Foo {
4+
//// [|[|{| "contextRangeIndex": 0 |}#foo|] = 1;|]
5+
////
6+
//// getFoo() {
7+
//// return this.[|#foo|];
8+
//// }
9+
////}
10+
11+
verify.rangesWithSameTextAreRenameLocations("#foo");

0 commit comments

Comments
 (0)