mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Use compilerOptionsIndicateEs6Modules over program contains es6 modules for determining auto import offering. Also dont depend on uncheck js file for this.
Fixes #28696
This commit is contained in:
@@ -11,22 +11,31 @@
|
||||
////fo/*b*/
|
||||
|
||||
// @Filename: /c.js
|
||||
////const x = 0;/*c*/ // Off for JS files (unless a non-declaration external module exists in the project)
|
||||
////const x = 0;/*c*/
|
||||
|
||||
// @Filename: /c1.js
|
||||
////// @ts-check
|
||||
////const x = 0;/*ccheck*/
|
||||
|
||||
// @Filename: /c2.ts
|
||||
////const x = 0;/*c2*/
|
||||
////const x = 0;/*cts*/
|
||||
|
||||
// @Filename: /d.js
|
||||
////const a = import("./a"); // Does not make this an external module
|
||||
////fo/*d*/
|
||||
|
||||
// @Filename: /d1.js
|
||||
////// @ts-check
|
||||
////const a = import("./a"); // Does not make this an external module
|
||||
////fo/*dcheck*/
|
||||
|
||||
// @Filename: /d2.ts
|
||||
////const a = import("./a"); // Does not make this an external module
|
||||
////fo/*d2*/
|
||||
////fo/*dts*/
|
||||
|
||||
verify.completions({ marker: ["b", "c", "d"], excludes: "foo", preferences: { includeCompletionsForModuleExports: true } });
|
||||
verify.completions({ marker: ["b"], excludes: "foo", preferences: { includeCompletionsForModuleExports: true } });
|
||||
verify.completions({
|
||||
marker: ["c2", "d2"],
|
||||
marker: ["c", "ccheck", "cts", "d", "dcheck", "dts"],
|
||||
includes: [{ name: "foo", source: "/node_modules/a/index", text: "const foo: 0", kind: "const", kindModifiers: "export,declare", hasAction: true, sourceDisplay: "a" }],
|
||||
preferences: { includeCompletionsForModuleExports: true },
|
||||
});
|
||||
|
||||
@@ -12,19 +12,40 @@
|
||||
////
|
||||
|
||||
// @Filename: /b.js
|
||||
//// /**/
|
||||
//// /*1*/
|
||||
|
||||
verify.completions({ marker: "", excludes: "fail", preferences: { includeCompletionsForModuleExports: true } });
|
||||
edit.insert("export const k = 10;\r\nf");
|
||||
verify.completions({
|
||||
includes: {
|
||||
name: "fail",
|
||||
source: "/node_modules/foo/index",
|
||||
sourceDisplay: "./node_modules/foo/index",
|
||||
text: "const fail: number",
|
||||
kind: "const",
|
||||
kindModifiers: "export,declare",
|
||||
hasAction: true,
|
||||
},
|
||||
preferences: { includeCompletionsForModuleExports: true },
|
||||
});
|
||||
// @Filename: /b2.js
|
||||
//////@ts-check
|
||||
/////*2*/
|
||||
|
||||
// @Filename: /b3.ts
|
||||
/////*3*/
|
||||
|
||||
// In esnext js files are assumed to be modules
|
||||
goTo.eachMarker(() => {
|
||||
verify.completions({
|
||||
includes: {
|
||||
name: "fail",
|
||||
source: "/node_modules/foo/index",
|
||||
sourceDisplay: "./node_modules/foo/index",
|
||||
text: "const fail: number",
|
||||
kind: "const",
|
||||
kindModifiers: "export,declare",
|
||||
hasAction: true,
|
||||
},
|
||||
preferences: { includeCompletionsForModuleExports: true },
|
||||
});
|
||||
edit.insert("export const k = 10;\r\nf");
|
||||
verify.completions({
|
||||
includes: {
|
||||
name: "fail",
|
||||
source: "/node_modules/foo/index",
|
||||
sourceDisplay: "./node_modules/foo/index",
|
||||
text: "const fail: number",
|
||||
kind: "const",
|
||||
kindModifiers: "export,declare",
|
||||
hasAction: true,
|
||||
},
|
||||
preferences: { includeCompletionsForModuleExports: true },
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user