Enable auto imports in member snippet completions (#46592)

This commit is contained in:
Andrew Branch
2021-10-29 14:43:32 -07:00
committed by GitHub
parent b0ab2a54bb
commit eeaa595196
8 changed files with 128 additions and 22 deletions

View File

@@ -3,13 +3,6 @@ namespace ts.codefix {
const errorCodeToFixes = createMultiMap<CodeFixRegistration>();
const fixIdToRegistration = new Map<string, CodeFixRegistration>();
export type DiagnosticAndArguments = DiagnosticMessage | [DiagnosticMessage, string] | [DiagnosticMessage, string, string];
function diagnosticToString(diag: DiagnosticAndArguments): string {
return isArray(diag)
? formatStringFromArgs(getLocaleSpecificMessage(diag[0]), diag.slice(1) as readonly string[])
: getLocaleSpecificMessage(diag);
}
export function createCodeFixActionWithoutFixAll(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments) {
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
}