44 */
55
66import { Commands , globals } from 'aws-core-vscode/shared'
7- import { window } from 'vscode'
7+ // import { window } from 'vscode'
88import { AmazonQChatViewProvider } from './webviewProvider'
99
10+ /**
11+ * TODO: Re-enable these once we can figure out which path they're going to live in
12+ * In hybrid chat mode they were being registered twice causing a registration error
13+ */
1014export function registerCommands ( provider : AmazonQChatViewProvider ) {
1115 globals . context . subscriptions . push (
12- registerGenericCommand ( 'aws.amazonq.explainCode' , 'Explain' , provider ) ,
13- registerGenericCommand ( 'aws.amazonq.refactorCode' , 'Refactor' , provider ) ,
14- registerGenericCommand ( 'aws.amazonq.fixCode' , 'Fix' , provider ) ,
15- registerGenericCommand ( 'aws.amazonq.optimizeCode' , 'Optimize' , provider ) ,
16- Commands . register ( 'aws.amazonq.sendToPrompt' , ( data ) => {
17- const triggerType = getCommandTriggerType ( data )
18- const selection = getSelectedText ( )
16+ // registerGenericCommand('aws.amazonq.explainCode', 'Explain', provider),
17+ // registerGenericCommand('aws.amazonq.refactorCode', 'Refactor', provider),
18+ // registerGenericCommand('aws.amazonq.fixCode', 'Fix', provider),
19+ // registerGenericCommand('aws.amazonq.optimizeCode', 'Optimize', provider),
20+ // Commands.register('aws.amazonq.sendToPrompt', (data) => {
21+ // const triggerType = getCommandTriggerType(data)
22+ // const selection = getSelectedText()
1923
20- void focusAmazonQPanel ( ) . then ( ( ) => {
21- void provider . webview ?. postMessage ( {
22- command : 'sendToPrompt' ,
23- params : { selection : selection , triggerType } ,
24- } )
25- } )
26- } ) ,
24+ // void focusAmazonQPanel().then(() => {
25+ // void provider.webview?.postMessage({
26+ // command: 'sendToPrompt',
27+ // params: { selection: selection, triggerType },
28+ // })
29+ // })
30+ // }),
2731 Commands . register ( 'aws.amazonq.openTab' , ( ) => {
2832 void focusAmazonQPanel ( ) . then ( ( ) => {
2933 void provider . webview ?. postMessage ( {
@@ -35,36 +39,36 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
3539 )
3640}
3741
38- function getSelectedText ( ) : string {
39- const editor = window . activeTextEditor
40- if ( editor ) {
41- const selection = editor . selection
42- const selectedText = editor . document . getText ( selection )
43- return selectedText
44- }
42+ // function getSelectedText(): string {
43+ // const editor = window.activeTextEditor
44+ // if (editor) {
45+ // const selection = editor.selection
46+ // const selectedText = editor.document.getText(selection)
47+ // return selectedText
48+ // }
4549
46- return ' '
47- }
50+ // return ' '
51+ // }
4852
49- function getCommandTriggerType ( data : any ) : string {
50- // data is undefined when commands triggered from keybinding or command palette. Currently no
51- // way to differentiate keybinding and command palette, so both interactions are recorded as keybinding
52- return data === undefined ? 'hotkeys' : 'contextMenu'
53- }
53+ // function getCommandTriggerType(data: any): string {
54+ // // data is undefined when commands triggered from keybinding or command palette. Currently no
55+ // // way to differentiate keybinding and command palette, so both interactions are recorded as keybinding
56+ // return data === undefined ? 'hotkeys' : 'contextMenu'
57+ // }
5458
55- function registerGenericCommand ( commandName : string , genericCommand : string , provider : AmazonQChatViewProvider ) {
56- return Commands . register ( commandName , ( data ) => {
57- const triggerType = getCommandTriggerType ( data )
58- const selection = getSelectedText ( )
59+ // function registerGenericCommand(commandName: string, genericCommand: string, provider: AmazonQChatViewProvider) {
60+ // return Commands.register(commandName, (data) => {
61+ // const triggerType = getCommandTriggerType(data)
62+ // const selection = getSelectedText()
5963
60- void focusAmazonQPanel ( ) . then ( ( ) => {
61- void provider . webview ?. postMessage ( {
62- command : 'genericCommand' ,
63- params : { genericCommand, selection, triggerType } ,
64- } )
65- } )
66- } )
67- }
64+ // void focusAmazonQPanel().then(() => {
65+ // void provider.webview?.postMessage({
66+ // command: 'genericCommand',
67+ // params: { genericCommand, selection, triggerType },
68+ // })
69+ // })
70+ // })
71+ // }
6872
6973/**
7074 * Importing focusAmazonQPanel from aws-core-vscode/amazonq leads to several dependencies down the chain not resolving since AmazonQ chat
0 commit comments