Skip to content

Prevents auto import in module: "none" #55556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a661017
Prevents auto-import in non-module files
hardikkoul Aug 10, 2023
6b1f9bf
changing "compilerOptionsIndicateEs6Modules"
hardikkoul Aug 11, 2023
dcd970e
Adding Unit Test
hardikkoul Aug 13, 2023
3607ace
updating the Unit Test Case
hardikkoul Aug 15, 2023
77897bd
Removing comment
hardikkoul Aug 28, 2023
9ab97a6
changing "compilerOptionsIndicateEs6Modules"
hardikkoul Aug 11, 2023
4dc4225
Adding Unit Test
hardikkoul Aug 13, 2023
23dd2d7
updating the Unit Test Case
hardikkoul Aug 15, 2023
2bf66ce
Removing comment
hardikkoul Aug 28, 2023
8593208
adding space
hardikkoul Aug 29, 2023
9a450cb
Merge branch 'bug55256-Hardik' of https://github.com/hardikkoul/TypeS…
hardikkoul Aug 29, 2023
8940285
Prevents Auto import in module:none #55328
hardikkoul Aug 29, 2023
d8b0ec4
updateing
hardikkoul Aug 29, 2023
02f0964
resolving import
hardikkoul Aug 29, 2023
dfb3bee
formatting amd update
hardikkoul Aug 29, 2023
3d188a4
formatting
hardikkoul Aug 29, 2023
7d46dad
Refactoring the test case
hardikkoul Aug 30, 2023
c05c588
adding @filename
hardikkoul Aug 30, 2023
a57d50c
updating the test case
hardikkoul Aug 30, 2023
1ac17ed
removing @module
hardikkoul Aug 30, 2023
18ea085
making includeCompletionsForModuleExports true
hardikkoul Aug 30, 2023
0791bd6
adding NOT and json syntax fix
hardikkoul Aug 30, 2023
eba1c44
updating the test case
hardikkoul Aug 30, 2023
7bbb4ec
removing marker
hardikkoul Aug 30, 2023
6dbddd4
changing module: none
hardikkoul Aug 31, 2023
01d49fd
removing preferences
hardikkoul Aug 31, 2023
621a005
removing marker
hardikkoul Aug 31, 2023
fead5bc
Add tests and delete implementation
andrewbranch Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/cases/fourslash/autoImportModuleNone1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference path="fourslash.ts" />

// @module: none
// @moduleResolution: node10
// @target: es5

// @Filename: /node_modules/dep/index.d.ts
////export const x: number;

// @Filename: /index.ts
//// x/**/

verify.completions({
marker: "",
excludes: ["x"],
preferences: {
includeCompletionsForModuleExports: true,
},
});

edit.replaceLine(0, "import { x } from 'dep'; x;");
verify.getSemanticDiagnostics([{
range: { fileName: "/index.ts", pos: 0, end: "import { x } from 'dep';".length },
code: ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none.code,
message: ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none.message
}]);
29 changes: 29 additions & 0 deletions tests/cases/fourslash/autoImportModuleNone2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference path="fourslash.ts" />

// @module: none
// @moduleResolution: node10
// @target: es2015

// @Filename: /node_modules/dep/index.d.ts
////export const x: number;

// @Filename: /index.ts
//// x/**/

verify.completions({
marker: "",
includes: [{
name: "x",
source: "dep",
sourceDisplay: "dep",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}],
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
},
});

edit.replaceLine(0, "import { x } from 'dep'; x;");
verify.getSemanticDiagnostics([]);