Skip to content

Commit cea49df

Browse files
author
Andy
authored
Completion for tuple index doesn't need to include quotes (microsoft#26750)
1 parent f78dc2a commit cea49df

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/services/completions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ namespace ts.Completions {
264264
}
265265

266266
function quote(text: string, preferences: UserPreferences): string {
267+
if (/^\d+$/.test(text)) {
268+
return text;
269+
}
267270
const quoted = JSON.stringify(text);
268271
switch (preferences.quotePreference) {
269272
case undefined:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////declare const x: [number, number];
4+
////x[|./**/|];
5+
6+
const replacementSpan = test.ranges()[0];
7+
verify.completions({
8+
marker: "",
9+
includes: [
10+
{ name: "0", insertText: '[0]', replacementSpan },
11+
{ name: "1", insertText: '[1]', replacementSpan },
12+
"length",
13+
],
14+
excludes: "2",
15+
preferences: {
16+
includeInsertTextCompletions: true,
17+
},
18+
});

0 commit comments

Comments
 (0)