Skip to content

Commit 6aa4a82

Browse files
authored
Merge branch 'main' into rli/file-open-fix
2 parents a73e933 + d2ecf2e commit 6aa4a82

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Skip inline completion when deleting characters"
4+
}

plugins/amazonq/codewhisperer/jetbrains-community/src-242/software/aws/toolkits/jetbrains/services/codewhisperer/popup/QManualCall.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ fun getManualCallEvent(editor: Editor, isIntelliSenseAccept: Boolean): InlineCom
1919
}
2020
return InlineCompletionEvent.DirectCall(editor, editor.caretModel.currentCaret, dataContext)
2121
}
22+
23+
@Suppress("FunctionOnlyReturningConstant")
24+
fun InlineCompletionEvent.isDeletion(): Boolean = false

plugins/amazonq/codewhisperer/jetbrains-community/src-243+/software/aws/toolkits/jetbrains/services/codewhisperer/popup/QManualCall.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ fun getManualCallEvent(editor: Editor, isIntelliSenseAccept: Boolean): InlineCom
1515
val data = UserDataHolderBase().apply { this.putUserData(KEY_Q_AUTO_TRIGGER_INTELLISENSE, isIntelliSenseAccept) }
1616
return InlineCompletionEvent.ManualCall(editor, Q_INLINE_PROVIDER_ID, data)
1717
}
18+
19+
fun InlineCompletionEvent.isDeletion(): Boolean =
20+
this is InlineCompletionEvent.Backspace

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/popup/QInlineCompletionProvider.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ class QInlineCompletionProvider(private val cs: CoroutineScope) : InlineCompleti
404404
CodeWhispererInvocationStatus.getInstance().setIsInvokingQInline(session, false)
405405
}
406406

407+
// this is only available in 2024.3+
408+
if (request.event.isDeletion()) {
409+
logInline(triggerSessionId) {
410+
"Skip inline completion when deleting"
411+
}
412+
return InlineCompletionSuggestion.Empty
413+
}
414+
407415
val sessionContext = InlineCompletionSessionContext(triggerOffset = request.endOffset)
408416

409417
// Pagination workaround: Always return exactly 5 variants

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ data class DeveloperProfiles(
2525
val developerProfiles: Boolean,
2626
val mcp: Boolean,
2727
val pinnedContextEnabled: Boolean,
28+
val workspaceFilePath: String?,
2829
)
2930

3031
data class WindowSettings(
@@ -65,6 +66,7 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata {
6566
developerProfiles = true,
6667
mcp = true,
6768
pinnedContextEnabled = true,
69+
workspaceFilePath = project.workspaceFile?.path,
6870
),
6971
window = WindowSettings(
7072
showSaveFileDialog = true

0 commit comments

Comments
 (0)