MCPcopy Create free account
hub / github.com/nodejs/node / shouldOfferImportCompletions

Function shouldOfferImportCompletions

test/fixtures/snapshot/typescript.js:133948–133966  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133946 }
133947 }
133948 function shouldOfferImportCompletions() {
133949 // If already typing an import statement, provide completions for it.
133950 if (importCompletionNode)
133951 return true;
133952 // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
133953 if (isNonContextualObjectLiteral)
133954 return false;
133955 // If not already a module, must have modules enabled.
133956 if (!preferences.includeCompletionsForModuleExports)
133957 return false;
133958 // If already using ES modules, OK to continue using them.
133959 if (sourceFile.externalModuleIndicator || sourceFile.commonJsModuleIndicator)
133960 return true;
133961 // If module transpilation is enabled or we're targeting es6 or above, or not emitting, OK.
133962 if (ts.compilerOptionsIndicateEsModules(program.getCompilerOptions()))
133963 return true;
133964 // If some file is using ES6 modules, assume that it's OK to add more.
133965 return ts.programContainsModules(program);
133966 }
133967 function isSnippetScope(scopeNode) {
133968 switch (scopeNode.kind) {
133969 case 305 /* SyntaxKind.SourceFile */:

Callers 1

collectAutoImportsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected