@@ -521,7 +521,6 @@ export class ChatController {
521521 commands : [ { command : commandName , description : commandDescription } ] ,
522522 } )
523523 }
524- // const symbolsCmd: QuickActionCommand = contextCommand[0].commands?.[3]
525524 const promptsCmd : QuickActionCommand = contextCommand [ 0 ] . commands ?. [ 4 ]
526525
527526 // Check for user prompts
@@ -553,47 +552,7 @@ export class ChatController {
553552 icon : 'list-add' as MynahIconsType ,
554553 } )
555554
556- // const lspClientReady = await LspClient.instance.waitUntilReady()
557- // if (lspClientReady) {
558- // const contextCommandItems = await LspClient.instance.getContextCommandItems()
559- // const folderCmd: QuickActionCommand = contextCommand[0].commands?.[1]
560- // const filesCmd: QuickActionCommand = contextCommand[0].commands?.[2]
561-
562- // for (const contextCommandItem of contextCommandItems) {
563- // const wsFolderName = path.basename(contextCommandItem.workspaceFolder)
564- // if (contextCommandItem.type === 'file') {
565- // filesCmd.children?.[0].commands.push({
566- // command: path.basename(contextCommandItem.relativePath),
567- // description: path.join(wsFolderName, contextCommandItem.relativePath),
568- // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
569- // label: 'file' as ContextCommandItemType,
570- // id: contextCommandItem.id,
571- // icon: 'file' as MynahIconsType,
572- // })
573- // } else if (contextCommandItem.type === 'folder') {
574- // folderCmd.children?.[0].commands.push({
575- // command: path.basename(contextCommandItem.relativePath),
576- // description: path.join(wsFolderName, contextCommandItem.relativePath),
577- // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
578- // label: 'folder' as ContextCommandItemType,
579- // id: contextCommandItem.id,
580- // icon: 'folder' as MynahIconsType,
581- // })
582- // } else if (contextCommandItem.symbol && symbolsCmd.children) {
583- // symbolsCmd.children?.[0].commands.push({
584- // command: contextCommandItem.symbol.name,
585- // description: `${contextCommandItem.symbol.kind}, ${path.join(wsFolderName, contextCommandItem.relativePath)}, L${contextCommandItem.symbol.range.start.line}-${contextCommandItem.symbol.range.end.line}`,
586- // route: [contextCommandItem.workspaceFolder, contextCommandItem.relativePath],
587- // label: 'code' as ContextCommandItemType,
588- // id: contextCommandItem.id,
589- // icon: 'code-block' as MynahIconsType,
590- // })
591- // }
592- // }
593- // }
594-
595555 this . messenger . sendContextCommandData ( contextCommand )
596- // void LspController.instance.updateContextCommandSymbolsOnce()
597556 }
598557
599558 private handlePromptCreate ( tabID : string ) {
@@ -1038,45 +997,6 @@ export class ChatController {
1038997 return [ ]
1039998 }
1040999 workspaceFolders . sort ( )
1041- // const workspaceFolder = workspaceFolders[0]
1042- // for (const contextCommand of contextCommands) {
1043- // session.relativePathToWorkspaceRoot.set(contextCommand.workspaceFolder, contextCommand.workspaceFolder)
1044- // }
1045- // const prompts: any[] = []
1046- // try {
1047- // // prompts = await LspClient.instance.getContextCommandPrompt(contextCommands)
1048- // } catch (e) {
1049- // // todo: handle @workspace used before indexing is ready
1050- // getLogger().verbose(`Could not get context command prompts: ${e}`)
1051- // }
1052-
1053- // triggerPayload.contextLengths.additionalContextLengths = this.telemetryHelper.getContextLengths(prompts)
1054- // for (const prompt of prompts.slice(0, 20)) {
1055- // // Add system prompt for user prompts and workspace rules
1056- // const contextType = this.telemetryHelper.getContextType(prompt)
1057- // const description =
1058- // contextType === 'rule' || contextType === 'prompt'
1059- // ? `You must follow the instructions in ${prompt.relativePath}. Below are lines ${prompt.startLine}-${prompt.endLine} of this file:\n`
1060- // : prompt.description
1061-
1062- // // Handle user prompts outside the workspace
1063- // const relativePath = prompt.filePath.startsWith(getUserPromptsDirectory())
1064- // ? path.basename(prompt.filePath)
1065- // : path.relative(workspaceFolder, prompt.filePath)
1066-
1067- // const entry = {
1068- // name: prompt.name.substring(0, aditionalContentNameLimit),
1069- // description: description.substring(0, aditionalContentNameLimit),
1070- // innerContext: prompt.content.substring(0, additionalContentInnerContextLimit),
1071- // type: contextType,
1072- // relativePath: relativePath,
1073- // startLine: prompt.startLine,
1074- // endLine: prompt.endLine,
1075- // }
1076-
1077- // triggerPayload.additionalContents.push(entry)
1078- // }
1079- // getLogger().info(`Retrieved chunks of additional context count: ${triggerPayload.additionalContents.length} `)
10801000 }
10811001
10821002 private async generateResponse (
@@ -1124,24 +1044,6 @@ export class ChatController {
11241044 if ( triggerPayload . useRelevantDocuments ) {
11251045 triggerPayload . message = triggerPayload . message . replace ( / @ w o r k s p a c e / , '' )
11261046 if ( CodeWhispererSettings . instance . isLocalIndexEnabled ( ) ) {
1127- // const start = performance.now()
1128- // const relevantTextDocuments = await LspController.instance.query(triggerPayload.message)
1129- // for (const relevantDocument of relevantTextDocuments) {
1130- // if (relevantDocument.text && relevantDocument.text.length > 0) {
1131- // triggerPayload.contextLengths.workspaceContextLength += relevantDocument.text.length
1132- // if (relevantDocument.text.length > workspaceChunkMaxSize) {
1133- // relevantDocument.text = relevantDocument.text.substring(0, workspaceChunkMaxSize)
1134- // getLogger().debug(`Truncating @workspace chunk: ${relevantDocument.relativeFilePath} `)
1135- // }
1136- // triggerPayload.relevantTextDocuments.push(relevantDocument)
1137- // }
1138- // }
1139- // for (const doc of triggerPayload.relevantTextDocuments) {
1140- // getLogger().info(
1141- // `amazonq: Using workspace files ${doc.relativeFilePath}, content(partial): ${doc.text?.substring(0, 200)}, start line: ${doc.startLine}, end line: ${doc.endLine}`
1142- // )
1143- // }
1144- // triggerPayload.projectContextQueryLatencyMs = performance.now() - start
11451047 } else {
11461048 this . messenger . sendOpenSettingsMessage ( triggerID , tabID )
11471049 return
0 commit comments