@@ -1086,6 +1086,7 @@ namespace ts.Completions {
10861086 const semanticStart = timestamp ( ) ;
10871087 let completionKind = CompletionKind . None ;
10881088 let isNewIdentifierLocation = false ;
1089+ let isNonContextualObjectLiteral = false ;
10891090 let keywordFilters = KeywordCompletionFilters . None ;
10901091 // This also gets mutated in nested-functions after the return
10911092 let symbols : Symbol [ ] = [ ] ;
@@ -1471,6 +1472,8 @@ namespace ts.Completions {
14711472 }
14721473
14731474 function shouldOfferImportCompletions ( ) : boolean {
1475+ // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
1476+ if ( isNonContextualObjectLiteral ) return false ;
14741477 // If not already a module, must have modules enabled.
14751478 if ( ! preferences . includeCompletionsForModuleExports ) return false ;
14761479 // If already using ES6 modules, OK to continue using them.
@@ -1898,6 +1901,7 @@ namespace ts.Completions {
18981901 if ( objectLikeContainer . flags & NodeFlags . InWithStatement ) {
18991902 return GlobalsSearch . Fail ;
19001903 }
1904+ isNonContextualObjectLiteral = true ;
19011905 return GlobalsSearch . Continue ;
19021906 }
19031907 const completionsType = typeChecker . getContextualType ( objectLikeContainer , ContextFlags . Completions ) ;
@@ -1910,6 +1914,7 @@ namespace ts.Completions {
19101914 if ( typeMembers . length === 0 ) {
19111915 // Edge case: If NumberIndexType exists
19121916 if ( ! hasNumberIndextype ) {
1917+ isNonContextualObjectLiteral = true ;
19131918 return GlobalsSearch . Continue ;
19141919 }
19151920 }
0 commit comments