From 5a41201340e7c53600d82a4034a356f72aeca8ba Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Tue, 7 Jul 2020 17:00:37 +0800 Subject: [PATCH 1/2] not escape unicode char for import path string. --- src/compiler/checker.ts | 3 ++- tests/cases/fourslash/quickInfoImportNonunicodePath.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/quickInfoImportNonunicodePath.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index aa0091f99523a..abc1364b024a2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4132,7 +4132,8 @@ namespace ts { function symbolToStringWorker(writer: EmitTextWriter) { const entity = builder(symbol, meaning!, enclosingDeclaration, nodeFlags)!; // TODO: GH#18217 - const printer = createPrinter({ removeComments: true }); + // add neverAsciiEscape for GH#39027 + const printer = enclosingDeclaration?.kind === SyntaxKind.SourceFile ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true }); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); printer.writeNode(EmitHint.Unspecified, entity, /*sourceFile*/ sourceFile, writer); return writer; diff --git a/tests/cases/fourslash/quickInfoImportNonunicodePath.ts b/tests/cases/fourslash/quickInfoImportNonunicodePath.ts new file mode 100644 index 0000000000000..cd4874b50bbfc --- /dev/null +++ b/tests/cases/fourslash/quickInfoImportNonunicodePath.ts @@ -0,0 +1,9 @@ +/// + +// @Filename: /江南今何在/tmp.ts +//// export const foo = 1; + +// @Filename: /test.ts +//// import { foo } from "./江南/*1*/今何在/tmp"; + +verify.quickInfoAt("1", 'module "/江南今何在/tmp"', ""); From 9cc9756f08f4a6aa4b50a1ceedbbd5c75c4163c2 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Tue, 7 Jul 2020 18:04:08 +0800 Subject: [PATCH 2/2] fix test. --- tests/cases/fourslash/quickInfoImportNonunicodePath.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/fourslash/quickInfoImportNonunicodePath.ts b/tests/cases/fourslash/quickInfoImportNonunicodePath.ts index cd4874b50bbfc..62d043a214b86 100644 --- a/tests/cases/fourslash/quickInfoImportNonunicodePath.ts +++ b/tests/cases/fourslash/quickInfoImportNonunicodePath.ts @@ -6,4 +6,4 @@ // @Filename: /test.ts //// import { foo } from "./江南/*1*/今何在/tmp"; -verify.quickInfoAt("1", 'module "/江南今何在/tmp"', ""); +verify.quickInfoAt("1", 'module "/江南今何在/tmp"');