From 1b4b01eed5c67591827e10c4b268ac97cd2f1937 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 14 Jun 2016 06:49:17 -0700 Subject: [PATCH] Unescape identifiers used in code completion --- src/harness/fourslash.ts | 2 ++ src/services/services.ts | 2 +- tests/cases/fourslash/codeCompletionEscaping.ts | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeCompletionEscaping.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8104f113392..17f14e30737 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -717,6 +717,8 @@ namespace FourSlash { public verifyCompletionEntryDetails(entryName: string, expectedText: string, expectedDocumentation?: string, kind?: string) { const details = this.getCompletionEntryDetails(entryName); + assert(details, "no completion entry available"); + assert.equal(ts.displayPartsToString(details.displayParts), expectedText, this.assertionMessageAtLastKnownMarker("completion entry details text")); if (expectedDocumentation !== undefined) { diff --git a/src/services/services.ts b/src/services/services.ts index d051a4378e4..d5f63627471 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3234,7 +3234,7 @@ namespace ts { } } - return name; + return unescapeIdentifier(name); } function getCompletionData(fileName: string, position: number) { diff --git a/tests/cases/fourslash/codeCompletionEscaping.ts b/tests/cases/fourslash/codeCompletionEscaping.ts new file mode 100644 index 00000000000..b8182307b7b --- /dev/null +++ b/tests/cases/fourslash/codeCompletionEscaping.ts @@ -0,0 +1,8 @@ +/// + +// @Filename: a.js +// @allowJs: true +////__foo;/**/ + +goTo.marker(); +verify.completionListContains("__foo", undefined, undefined, "warning");