Skip to content

Commit 13ef487

Browse files
Fix Self-check
1 parent 416f31f commit 13ef487

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/compiler/utilities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8205,7 +8205,7 @@ export function setObjectAllocator(alloc: ObjectAllocator) {
82058205

82068206
/** @internal */
82078207
export function formatStringFromArgs(text: string, args: DiagnosticArguments): string {
8208-
return text.replace(/{(\d+)}/g, (_match, index: string) => "" + Debug.checkDefined(args[+index]));
8208+
return text.replace(/\{(\d+)\}/g, (_match, index: string) => "" + Debug.checkDefined(args[+index]));
82098209
}
82108210

82118211
let localizedDiagnosticMessages: MapLike<string> | undefined;

src/harness/fourslashImpl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2699,7 +2699,7 @@ export class TestState {
26992699
},
27002700
});
27012701
}
2702-
else if (prevChar === " " && /A-Za-z_/.test(ch)) {
2702+
else if (prevChar === " " && /[A-Za-z_]/.test(ch)) {
27032703
/* Completions */
27042704
this.languageService.getCompletionsAtPosition(this.activeFile.fileName, offset, ts.emptyOptions);
27052705
}

src/harness/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function removeTestPathPrefixes(text: string, retainTrailingDirectorySepa
1010
}
1111

1212
function createDiagnosticMessageReplacer<R extends (messageArgs: string[], ...args: string[]) => string[]>(diagnosticMessage: ts.DiagnosticMessage, replacer: R) {
13-
const messageParts = diagnosticMessage.message.split(/{\d+}/g);
13+
const messageParts = diagnosticMessage.message.split(/\{\d+\}/g);
1414
const regExp = new RegExp(`^(?:${messageParts.map(ts.regExpEscape).join("(.*?)")})$`);
1515
type Args<R> = R extends (messageArgs: string[], ...args: infer A) => string[] ? A : [];
1616
return (text: string, ...args: Args<R>) => text.replace(regExp, (_, ...fixedArgs) => ts.formatStringFromArgs(diagnosticMessage.message, replacer(fixedArgs, ...args)));

0 commit comments

Comments
 (0)