@@ -174,7 +174,7 @@ namespace ts.codefix {
174174 if ( localSymbol && localSymbol . escapedName === name && checkSymbolHasMeaning ( localSymbol , currentTokenMeaning ) ) {
175175 // check if this symbol is already used
176176 const symbolId = getUniqueSymbolId ( localSymbol ) ;
177- symbolIdActionMap . addActions ( symbolId , getCodeActionForImport ( moduleSymbol , name , /*isDefault */ true ) ) ;
177+ symbolIdActionMap . addActions ( symbolId , getCodeActionForImport ( moduleSymbol , name , /*isNamespaceImport */ true ) ) ;
178178 }
179179 }
180180
@@ -562,8 +562,8 @@ namespace ts.codefix {
562562
563563 function getNodeModulePathParts ( fullPath : string ) {
564564 // If fullPath can't be valid module file within node_modules, returns undefined.
565- // Example of expected pattern: /base/path/node_modules/[otherpackage/node_modules/]package/[subdirectory/]file.js
566- // Returns indices: ^ ^ ^ ^
565+ // Example of expected pattern: /base/path/node_modules/[@scope / otherpackage/ @otherscope /node_modules/]package/[subdirectory/]file.js
566+ // Returns indices: ^ ^ ^ ^
567567
568568 let topLevelNodeModulesIndex = 0 ;
569569 let topLevelPackageNameIndex = 0 ;
@@ -573,6 +573,7 @@ namespace ts.codefix {
573573 const enum States {
574574 BeforeNodeModules ,
575575 NodeModules ,
576+ Scope ,
576577 PackageContent
577578 }
578579
@@ -592,8 +593,14 @@ namespace ts.codefix {
592593 }
593594 break ;
594595 case States . NodeModules :
595- packageRootIndex = partEnd ;
596- state = States . PackageContent ;
596+ case States . Scope :
597+ if ( state === States . NodeModules && fullPath . charAt ( partStart + 1 ) === "@" ) {
598+ state = States . Scope ;
599+ }
600+ else {
601+ packageRootIndex = partEnd ;
602+ state = States . PackageContent ;
603+ }
597604 break ;
598605 case States . PackageContent :
599606 if ( fullPath . indexOf ( "/node_modules/" , partStart ) === partStart ) {
0 commit comments