Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Skip inline completion when deleting characters"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ fun getManualCallEvent(editor: Editor, isIntelliSenseAccept: Boolean): InlineCom
}
return InlineCompletionEvent.DirectCall(editor, editor.caretModel.currentCaret, dataContext)
}

fun InlineCompletionEvent.isDeletion(): Boolean = false
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@
val data = UserDataHolderBase().apply { this.putUserData(KEY_Q_AUTO_TRIGGER_INTELLISENSE, isIntelliSenseAccept) }
return InlineCompletionEvent.ManualCall(editor, Q_INLINE_PROVIDER_ID, data)
}

fun InlineCompletionEvent.isDeletion(): Boolean =
this is InlineCompletionEvent.Backspace

Check warning on line 20 in plugins/amazonq/codewhisperer/jetbrains-community/src-243+/software/aws/toolkits/jetbrains/services/codewhisperer/popup/QManualCall.kt

View workflow job for this annotation

GitHub Actions / qodana

Unstable API Usage

'com.intellij.codeInsight.inline.completion.InlineCompletionEvent.Backspace' is marked unstable with @ApiStatus.Experimental

Check warning

Code scanning / QDJVMC

Unstable API Usage Warning

'com.intellij.codeInsight.inline.completion.InlineCompletionEvent.Backspace' is marked unstable with @ApiStatus.Experimental
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ class QInlineCompletionProvider(private val cs: CoroutineScope) : InlineCompleti
CodeWhispererInvocationStatus.getInstance().setIsInvokingQInline(session, false)
}

// this is only available in 2024.3+
if (request.event.isDeletion()) {
logInline(triggerSessionId) {
"Skip inline completion when deleting"
}
return InlineCompletionSuggestion.Empty
}

val sessionContext = InlineCompletionSessionContext(triggerOffset = request.endOffset)

// Pagination workaround: Always return exactly 5 variants
Expand Down
Loading