Support completions for unique symbol exported from module (#25537)

This commit is contained in:
Andy
2018-07-10 10:47:43 -07:00
committed by GitHub
parent 4bf42fd1c4
commit 72be7156d2
4 changed files with 42 additions and 17 deletions

View File

@@ -1,12 +1,17 @@
/// <reference path="fourslash.ts" />
// @Filename: /a.ts
// @noLib: true
// @Filename: /globals.d.ts
////declare const Symbol: () => symbol;
// @Filename: /a.ts
////const privateSym = Symbol();
////export const publicSym = Symbol();
////export interface I {
//// [privateSym]: number;
//// [publicSym]: number;
//// [defaultPublicSym]: number;
//// n: number;
////}
////export const i: I;
@@ -17,10 +22,21 @@
verify.completions({
marker: "",
// TODO: GH#25095 Should include `publicSym`
exact: "n",
exact: [
"n",
{ name: "publicSym", insertText: "[publicSym]", replacementSpan: test.ranges()[0], hasAction: true },
],
preferences: {
includeInsertTextCompletions: true,
includeCompletionsForModuleExports: true,
},
});
verify.applyCodeActionFromCompletion("", {
name: "publicSym",
source: "/a",
description: `Add 'publicSym' to existing import declaration from "./a"`,
newFileContent:
`import { i, publicSym } from "./a";
i.;`
});