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:
@@ -1050,12 +1050,10 @@ namespace ts.Completions {
|
||||
if (sourceFile.externalModuleIndicator) return true;
|
||||
// If already using commonjs, don't introduce ES6.
|
||||
if (sourceFile.commonJsModuleIndicator) return false;
|
||||
// For JS, stay on the safe side.
|
||||
if (isUncheckedFile) return false;
|
||||
// If some file is using ES6 modules, assume that it's OK to add more.
|
||||
if (programContainsEs6Modules(program)) return true;
|
||||
// If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK.
|
||||
return compilerOptionsIndicateEs6Modules(program.getCompilerOptions());
|
||||
if (compilerOptionsIndicateEs6Modules(program.getCompilerOptions())) return true;
|
||||
// If some file is using ES6 modules, assume that it's OK to add more.
|
||||
return programContainsEs6Modules(program);
|
||||
}
|
||||
|
||||
function isSnippetScope(scopeNode: Node): boolean {
|
||||
|
||||
Reference in New Issue
Block a user