Skip to content

Commit 4e79bd5

Browse files
ctlai95laileni-aws
authored andcommitted
Removing insert at cursor from Pair programming mode
1 parent c5a41d8 commit 4e79bd5

File tree

2 files changed

+13
-9
lines changed
  • packages/core/src

2 files changed

+13
-9
lines changed

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,14 @@ export const createMynahUI = (
207207
},
208208
}
209209
}
210-
if (
211-
tab?.type === 'cwc' &&
212-
messageData.codeBlockActions['insert-to-cursor'] === null &&
213-
messageData.codeBlockActions['copy'] === null
214-
) {
215-
return {
210+
if (tab?.type === 'cwc' && messageData.codeBlockActions['insert-to-cursor'] === null) {
211+
const actions: Record<string, undefined> = {
216212
'insert-to-cursor': undefined,
217-
// eslint-disable-next-line prettier/prettier
218-
copy: undefined,
219213
}
214+
if (messageData.codeBlockActions['copy'] === null) {
215+
actions.copy = undefined
216+
}
217+
return actions
220218
}
221219
// Show only "Copy" option for codeblocks in Q Test Tab
222220
if (tab?.type === 'testgen') {

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
MynahIconsType,
5555
DetailedList,
5656
MynahUIDataModel,
57+
CodeBlockActions,
5758
} from '@aws/mynah-ui'
5859
import { Database } from '../../../../shared/db/chatDb/chatDb'
5960
import { TabType } from '../../../../amazonq/webview/ui/storages/tabsStorage'
@@ -477,7 +478,11 @@ export class Messenger {
477478
if (this.isTriggerCancelled(triggerID)) {
478479
return
479480
}
480-
481+
let codeBlockActions: CodeBlockActions | null = {}
482+
if (session.pairProgrammingModeOn) {
483+
// eslint-disable-next-line unicorn/no-null
484+
codeBlockActions = { 'insert-to-cursor': null }
485+
}
481486
this.dispatcher.sendChatMessage(
482487
new ChatMessage(
483488
{
@@ -492,6 +497,7 @@ export class Messenger {
492497
userIntent: triggerPayload.userIntent,
493498
codeBlockLanguage: codeBlockLanguage,
494499
contextList: undefined,
500+
codeBlockActions,
495501
},
496502
tabID
497503
)

0 commit comments

Comments
 (0)