Skip to content

Commit fcb4f88

Browse files
authored
Fix: Replacing onCodeBlockActionClicked with onCodeInsertToCursorPosition and onCopyCodeToClipboard function (#5031)
1 parent e121827 commit fcb4f88

File tree

1 file changed

+24
-47
lines changed
  • plugins/amazonq/mynah-ui/src/mynah-ui/ui

1 file changed

+24
-47
lines changed

plugins/amazonq/mynah-ui/src/mynah-ui/ui/main.ts

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -453,54 +453,31 @@ export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, codeT
453453
content: 'Thanks for your feedback.',
454454
})
455455
},
456-
onCodeBlockActionClicked: (
457-
tabId: string,
458-
messageId: string,
459-
actionId: string,
460-
data?: string,
461-
code?: string,
462-
type?: CodeSelectionType,
463-
referenceTrackerInformation?: ReferenceTrackerInformation[],
464-
eventId?: string,
465-
codeBlockIndex?: number,
466-
totalCodeBlocks?: number
456+
onCodeInsertToCursorPosition: connector.onCodeInsertToCursorPosition,
457+
onCopyCodeToClipboard: (
458+
tabId,
459+
messageId,
460+
code,
461+
type,
462+
referenceTrackerInfo,
463+
eventId,
464+
codeBlockIndex,
465+
totalCodeBlocks
467466
) => {
468-
switch (actionId) {
469-
case 'insert-to-cursor':
470-
connector.onCodeInsertToCursorPosition(
471-
tabId,
472-
messageId,
473-
code,
474-
type,
475-
referenceTrackerInformation,
476-
eventId,
477-
codeBlockIndex,
478-
totalCodeBlocks,
479-
responseMetadata.get(messageId)?.[0] ?? undefined,
480-
responseMetadata.get(messageId)?.[1] ?? undefined
481-
)
482-
break
483-
case 'copy':
484-
connector.onCopyCodeToClipboard(
485-
tabId,
486-
messageId,
487-
code,
488-
type,
489-
referenceTrackerInformation,
490-
eventId,
491-
codeBlockIndex,
492-
totalCodeBlocks,
493-
responseMetadata.get(messageId)?.[0] ?? undefined,
494-
responseMetadata.get(messageId)?.[1] ?? undefined
495-
)
496-
mynahUI.notify({
497-
type: NotificationType.SUCCESS,
498-
content: 'Selected code is copied to clipboard',
499-
})
500-
break
501-
default:
502-
break
503-
}
467+
connector.onCopyCodeToClipboard(
468+
tabId,
469+
messageId,
470+
code,
471+
type,
472+
referenceTrackerInfo,
473+
eventId,
474+
codeBlockIndex,
475+
totalCodeBlocks
476+
)
477+
mynahUI.notify({
478+
type: NotificationType.SUCCESS,
479+
content: 'Selected code is copied to clipboard',
480+
})
504481
},
505482
onChatItemEngagement: connector.triggerSuggestionEngagement,
506483
onSourceLinkClick: (tabId, messageId, link, mouseEvent) => {

0 commit comments

Comments
 (0)