Skip to content

Commit 1e7889c

Browse files
authored
Enable existing commit characters in certain locations where isNewIdentifier is true (#59523)
1 parent 936a79b commit 1e7889c

14 files changed

+91403
-55
lines changed

src/harness/fourslashImpl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ export class TestState {
10371037

10381038
if (ts.hasProperty(options, "defaultCommitCharacters")) {
10391039
assert.deepEqual(
1040-
actualCompletions.defaultCommitCharacters?.sort(),
1041-
options.defaultCommitCharacters?.sort(),
1040+
actualCompletions.defaultCommitCharacters?.slice().sort(),
1041+
options.defaultCommitCharacters?.slice().sort(),
10421042
"Expected 'defaultCommitCharacters' properties to match",
10431043
);
10441044
}
@@ -1191,8 +1191,8 @@ export class TestState {
11911191
assert.equal(actual.sortText, expected.sortText || ts.Completions.SortText.LocationPriority, `At entry ${actual.name}: Expected 'sortText' properties to match`);
11921192
if (ts.hasProperty(expected, "commitCharacters")) {
11931193
assert.deepEqual(
1194-
actual.commitCharacters?.sort(),
1195-
expected.commitCharacters?.sort(),
1194+
actual.commitCharacters?.slice().sort(),
1195+
expected.commitCharacters?.slice().sort(),
11961196
`At entry ${actual.name}: Expected 'commitCharacters' values to match`,
11971197
);
11981198
}

src/services/completions.ts

Lines changed: 115 additions & 40 deletions
Large diffs are not rendered by default.

tests/baselines/reference/completionsCommentsClassMembers.baseline

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15330,7 +15330,11 @@
1533015330
]
1533115331
}
1533215332
],
15333-
"defaultCommitCharacters": []
15333+
"defaultCommitCharacters": [
15334+
".",
15335+
",",
15336+
";"
15337+
]
1533415338
}
1533515339
},
1533615340
{
@@ -27308,7 +27312,11 @@
2730827312
]
2730927313
}
2731027314
],
27311-
"defaultCommitCharacters": []
27315+
"defaultCommitCharacters": [
27316+
".",
27317+
",",
27318+
";"
27319+
]
2731227320
}
2731327321
},
2731427322
{
@@ -45958,7 +45966,11 @@
4595845966
]
4595945967
}
4596045968
],
45961-
"defaultCommitCharacters": []
45969+
"defaultCommitCharacters": [
45970+
".",
45971+
",",
45972+
";"
45973+
]
4596245974
}
4596345975
},
4596445976
{
@@ -56488,7 +56500,11 @@
5648856500
]
5648956501
}
5649056502
],
56491-
"defaultCommitCharacters": []
56503+
"defaultCommitCharacters": [
56504+
".",
56505+
",",
56506+
";"
56507+
]
5649256508
}
5649356509
},
5649456510
{
@@ -61751,7 +61767,11 @@
6175161767
]
6175261768
}
6175361769
],
61754-
"defaultCommitCharacters": []
61770+
"defaultCommitCharacters": [
61771+
".",
61772+
",",
61773+
";"
61774+
]
6175561775
}
6175661776
},
6175761777
{
@@ -69949,7 +69969,11 @@
6994969969
]
6995069970
}
6995169971
],
69952-
"defaultCommitCharacters": []
69972+
"defaultCommitCharacters": [
69973+
".",
69974+
",",
69975+
";"
69976+
]
6995369977
}
6995469978
},
6995569979
{
@@ -78147,7 +78171,11 @@
7814778171
]
7814878172
}
7814978173
],
78150-
"defaultCommitCharacters": []
78174+
"defaultCommitCharacters": [
78175+
".",
78176+
",",
78177+
";"
78178+
]
7815178179
}
7815278180
},
7815378181
{
@@ -86345,7 +86373,11 @@
8634586373
]
8634686374
}
8634786375
],
86348-
"defaultCommitCharacters": []
86376+
"defaultCommitCharacters": [
86377+
".",
86378+
",",
86379+
";"
86380+
]
8634986381
}
8635086382
},
8635186383
{
@@ -90932,7 +90964,11 @@
9093290964
]
9093390965
}
9093490966
],
90935-
"defaultCommitCharacters": []
90967+
"defaultCommitCharacters": [
90968+
".",
90969+
",",
90970+
";"
90971+
]
9093690972
}
9093790973
},
9093890974
{
@@ -100829,7 +100865,11 @@
100829100865
]
100830100866
}
100831100867
],
100832-
"defaultCommitCharacters": []
100868+
"defaultCommitCharacters": [
100869+
".",
100870+
",",
100871+
";"
100872+
]
100833100873
}
100834100874
}
100835100875
]

tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8290,7 +8290,11 @@
82908290
]
82918291
}
82928292
],
8293-
"defaultCommitCharacters": []
8293+
"defaultCommitCharacters": [
8294+
".",
8295+
",",
8296+
";"
8297+
]
82948298
}
82958299
},
82968300
{

0 commit comments

Comments
 (0)