File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
core/src/codewhisperer/models Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,10 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
255255 return [ ]
256256 }
257257
258- const isAutoTrigger = context . triggerKind === InlineCompletionTriggerKind . Automatic
258+ // there is a bug in VS Code, when hitting Enter, the context.triggerKind is Invoke (0)
259+ // when hitting other keystrokes, the context.triggerKind is Automatic (1)
260+ // we only mark option + C as manual trigger
261+ const isAutoTrigger = performance . now ( ) - vsCodeState . lastManualTriggerTime > 50
259262 if ( isAutoTrigger && ! CodeSuggestionsState . instance . isSuggestionsEnabled ( ) ) {
260263 // return early when suggestions are disabled with auto trigger
261264 return [ ]
@@ -348,7 +351,10 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
348351 this . languageClient ,
349352 document ,
350353 position ,
351- context ,
354+ {
355+ triggerKind : isAutoTrigger ? 1 : 0 ,
356+ selectedCompletionInfo : context . selectedCompletionInfo ,
357+ } ,
352358 token ,
353359 isAutoTrigger ,
354360 getAllRecommendationsOptions ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 CodeWhispererSettings ,
2424 getSelectedCustomization ,
2525 TelemetryHelper ,
26+ vsCodeState ,
2627} from 'aws-core-vscode/codewhisperer'
2728import {
2829 Settings ,
@@ -365,6 +366,7 @@ async function onLanguageServerReady(
365366 sessionManager . checkInlineSuggestionVisibility ( )
366367 } ) ,
367368 Commands . register ( { id : 'aws.amazonq.invokeInlineCompletion' , autoconnect : true } , async ( ) => {
369+ vsCodeState . lastManualTriggerTime = performance . now ( )
368370 await vscode . commands . executeCommand ( 'editor.action.inlineSuggest.trigger' )
369371 } ) ,
370372 Commands . register ( 'aws.amazonq.refreshAnnotation' , async ( forceProceed : boolean ) => {
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ interface VsCodeState {
4242 lastUserModificationTime : number
4343
4444 isFreeTierLimitReached : boolean
45+
46+ lastManualTriggerTime : number
4547}
4648
4749export const vsCodeState : VsCodeState = {
@@ -52,6 +54,7 @@ export const vsCodeState: VsCodeState = {
5254 isRecommendationsActive : false ,
5355 lastUserModificationTime : 0 ,
5456 isFreeTierLimitReached : false ,
57+ lastManualTriggerTime : 0 ,
5558}
5659
5760export interface CodeWhispererConfig {
You can’t perform that action at this time.
0 commit comments