From 96303121130464a229998d78c342dbd6061bc8e0 Mon Sep 17 00:00:00 2001 From: Lei Gao Date: Thu, 12 Jun 2025 12:33:51 -0700 Subject: [PATCH] rm unused code --- ...-9b0e6490-39a8-445f-9d67-9d762de7421c.json | 4 - ...-bb976b5f-7697-42d8-89a9-8e96310a23f4.json | 4 - .../controllers/chat/controller.ts | 98 ------------------- 3 files changed, 106 deletions(-) delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-9b0e6490-39a8-445f-9d67-9d762de7421c.json delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json diff --git a/packages/amazonq/.changes/next-release/Bug Fix-9b0e6490-39a8-445f-9d67-9d762de7421c.json b/packages/amazonq/.changes/next-release/Bug Fix-9b0e6490-39a8-445f-9d67-9d762de7421c.json deleted file mode 100644 index f17516bb8f4..00000000000 --- a/packages/amazonq/.changes/next-release/Bug Fix-9b0e6490-39a8-445f-9d67-9d762de7421c.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "Bug Fix", - "description": "Previous and subsequent cells are used as context for completion in a Jupyter notebook" -} diff --git a/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json b/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json deleted file mode 100644 index 988fb2bcc7b..00000000000 --- a/packages/amazonq/.changes/next-release/Bug Fix-bb976b5f-7697-42d8-89a9-8e96310a23f4.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "Bug Fix", - "description": "Support chat in AL2 aarch64" -} diff --git a/packages/core/src/codewhispererChat/controllers/chat/controller.ts b/packages/core/src/codewhispererChat/controllers/chat/controller.ts index 1fee99b4026..1be0c0332f5 100644 --- a/packages/core/src/codewhispererChat/controllers/chat/controller.ts +++ b/packages/core/src/codewhispererChat/controllers/chat/controller.ts @@ -521,7 +521,6 @@ export class ChatController { commands: [{ command: commandName, description: commandDescription }], }) } - // const symbolsCmd: QuickActionCommand = contextCommand[0].commands?.[3] const promptsCmd: QuickActionCommand = contextCommand[0].commands?.[4] // Check for user prompts @@ -553,47 +552,7 @@ export class ChatController { icon: 'list-add' as MynahIconsType, }) - // const lspClientReady = await LspClient.instance.waitUntilReady() - // if (lspClientReady) { - // const contextCommandItems = await LspClient.instance.getContextCommandItems() - // const folderCmd: QuickActionCommand = contextCommand[0].commands?.[1] - // const filesCmd: QuickActionCommand = contextCommand[0].commands?.[2] - - // for (const contextCommandItem of contextCommandItems) { - // const wsFolderName = path.basename(contextCommandItem.workspaceFolder) - // if (contextCommandItem.type === 'file') { - // filesCmd.children?.[0].commands.push({ - // command: path.basename(contextCommandItem.relativePath), - // description: path.join(wsFolderName, contextCommandItem.relativePath), - // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath], - // label: 'file' as ContextCommandItemType, - // id: contextCommandItem.id, - // icon: 'file' as MynahIconsType, - // }) - // } else if (contextCommandItem.type === 'folder') { - // folderCmd.children?.[0].commands.push({ - // command: path.basename(contextCommandItem.relativePath), - // description: path.join(wsFolderName, contextCommandItem.relativePath), - // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath], - // label: 'folder' as ContextCommandItemType, - // id: contextCommandItem.id, - // icon: 'folder' as MynahIconsType, - // }) - // } else if (contextCommandItem.symbol && symbolsCmd.children) { - // symbolsCmd.children?.[0].commands.push({ - // command: contextCommandItem.symbol.name, - // description: `${contextCommandItem.symbol.kind}, ${path.join(wsFolderName, contextCommandItem.relativePath)}, L${contextCommandItem.symbol.range.start.line}-${contextCommandItem.symbol.range.end.line}`, - // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath], - // label: 'code' as ContextCommandItemType, - // id: contextCommandItem.id, - // icon: 'code-block' as MynahIconsType, - // }) - // } - // } - // } - this.messenger.sendContextCommandData(contextCommand) - // void LspController.instance.updateContextCommandSymbolsOnce() } private handlePromptCreate(tabID: string) { @@ -1038,45 +997,6 @@ export class ChatController { return [] } workspaceFolders.sort() - // const workspaceFolder = workspaceFolders[0] - // for (const contextCommand of contextCommands) { - // session.relativePathToWorkspaceRoot.set(contextCommand.workspaceFolder, contextCommand.workspaceFolder) - // } - // const prompts: any[] = [] - // try { - // // prompts = await LspClient.instance.getContextCommandPrompt(contextCommands) - // } catch (e) { - // // todo: handle @workspace used before indexing is ready - // getLogger().verbose(`Could not get context command prompts: ${e}`) - // } - - // triggerPayload.contextLengths.additionalContextLengths = this.telemetryHelper.getContextLengths(prompts) - // for (const prompt of prompts.slice(0, 20)) { - // // Add system prompt for user prompts and workspace rules - // const contextType = this.telemetryHelper.getContextType(prompt) - // const description = - // contextType === 'rule' || contextType === 'prompt' - // ? `You must follow the instructions in ${prompt.relativePath}. Below are lines ${prompt.startLine}-${prompt.endLine} of this file:\n` - // : prompt.description - - // // Handle user prompts outside the workspace - // const relativePath = prompt.filePath.startsWith(getUserPromptsDirectory()) - // ? path.basename(prompt.filePath) - // : path.relative(workspaceFolder, prompt.filePath) - - // const entry = { - // name: prompt.name.substring(0, aditionalContentNameLimit), - // description: description.substring(0, aditionalContentNameLimit), - // innerContext: prompt.content.substring(0, additionalContentInnerContextLimit), - // type: contextType, - // relativePath: relativePath, - // startLine: prompt.startLine, - // endLine: prompt.endLine, - // } - - // triggerPayload.additionalContents.push(entry) - // } - // getLogger().info(`Retrieved chunks of additional context count: ${triggerPayload.additionalContents.length} `) } private async generateResponse( @@ -1124,24 +1044,6 @@ export class ChatController { if (triggerPayload.useRelevantDocuments) { triggerPayload.message = triggerPayload.message.replace(/@workspace/, '') if (CodeWhispererSettings.instance.isLocalIndexEnabled()) { - // const start = performance.now() - // const relevantTextDocuments = await LspController.instance.query(triggerPayload.message) - // for (const relevantDocument of relevantTextDocuments) { - // if (relevantDocument.text && relevantDocument.text.length > 0) { - // triggerPayload.contextLengths.workspaceContextLength += relevantDocument.text.length - // if (relevantDocument.text.length > workspaceChunkMaxSize) { - // relevantDocument.text = relevantDocument.text.substring(0, workspaceChunkMaxSize) - // getLogger().debug(`Truncating @workspace chunk: ${relevantDocument.relativeFilePath} `) - // } - // triggerPayload.relevantTextDocuments.push(relevantDocument) - // } - // } - // for (const doc of triggerPayload.relevantTextDocuments) { - // getLogger().info( - // `amazonq: Using workspace files ${doc.relativeFilePath}, content(partial): ${doc.text?.substring(0, 200)}, start line: ${doc.startLine}, end line: ${doc.endLine}` - // ) - // } - // triggerPayload.projectContextQueryLatencyMs = performance.now() - start } else { this.messenger.sendOpenSettingsMessage(triggerID, tabID) return