@@ -198,6 +198,7 @@ const emitAggregatedUserTriggerDecisionTelemetry = (
198
198
const mergeSuggestionsWithRightContext = (
199
199
rightFileContext : string ,
200
200
suggestions : Suggestion [ ] ,
201
+ includeImportsWithCodeReferences : boolean ,
201
202
range ?: Range
202
203
) : InlineCompletionItemWithReferences [ ] => {
203
204
return suggestions . map ( suggestion => {
@@ -228,7 +229,9 @@ const mergeSuggestionsWithRightContext = (
228
229
insertText : insertText ,
229
230
range,
230
231
references : references ?. length ? references : undefined ,
231
- mostRelevantMissingImports : suggestion . mostRelevantMissingImports ,
232
+ mostRelevantMissingImports : includeImportsWithCodeReferences
233
+ ? suggestion . mostRelevantMissingImports
234
+ : undefined ,
232
235
}
233
236
} )
234
237
}
@@ -288,6 +291,7 @@ export const CodewhispererServerFactory =
288
291
// right before returning and is only guaranteed to be consistent within
289
292
// the context of a single response.
290
293
let includeSuggestionsWithCodeReferences = false
294
+ let includeImportsWithCodeReferences = false
291
295
292
296
// CodePercentage and codeDiff tracker have a dependency on TelemetryService, so initialization is also delayed to `onInitialized` handler
293
297
let codePercentageTracker : CodePercentageTracker
@@ -305,6 +309,8 @@ export const CodewhispererServerFactory =
305
309
sessionManager . discardSession ( currentSession )
306
310
}
307
311
const codeWhispererService = amazonQServiceManager . getCodewhispererService ( )
312
+ includeSuggestionsWithCodeReferences = codeWhispererService . includeSuggestionsWithCodeReferences
313
+ includeImportsWithCodeReferences = codeWhispererService . includeImportsWithCodeReferences
308
314
309
315
// prettier-ignore
310
316
return workspace . getTextDocument ( params . textDocument . uri ) . then ( async textDocument => {
@@ -533,6 +539,7 @@ export const CodewhispererServerFactory =
533
539
const suggestionsWithRightContext = mergeSuggestionsWithRightContext (
534
540
session . requestContext . fileContext . rightFileContent ,
535
541
filteredSuggestions ,
542
+ includeImportsWithCodeReferences ,
536
543
selectionRange
537
544
) . filter ( suggestion => {
538
545
// Discard suggestions that have empty string insertText after right context merge and can't be displayed anymore
0 commit comments