@@ -30,6 +30,7 @@ import { ProjectZipError } from '../../amazonqTest/error'
3030import { removeAnsi } from '../../shared/utilities/textUtilities'
3131import { normalize } from '../../shared/utilities/pathUtils'
3232import { ZipStream } from '../../shared/utilities/zipStream'
33+ import { getTextContent } from '../../shared/utilities/vsCodeUtils'
3334
3435export interface ZipMetadata {
3536 rootDir : string
@@ -77,12 +78,6 @@ export class ZipUtil {
7778 return CodeWhispererConstants . projectScanPayloadSizeLimitBytes
7879 }
7980
80- protected async getTextContent ( uri : vscode . Uri ) {
81- const document = await vscode . workspace . openTextDocument ( uri )
82- const content = document . getText ( )
83- return content
84- }
85-
8681 public reachSizeLimit ( size : number , scope : CodeWhispererConstants . CodeAnalysisScope ) : boolean {
8782 if (
8883 scope === CodeWhispererConstants . CodeAnalysisScope . FILE_AUTO ||
@@ -105,7 +100,7 @@ export class ZipUtil {
105100 }
106101 const zip = new ZipStream ( )
107102
108- const content = await this . getTextContent ( uri )
103+ const content = await getTextContent ( uri )
109104
110105 const workspaceFolder = vscode . workspace . getWorkspaceFolder ( uri )
111106 if ( workspaceFolder ) {
@@ -431,7 +426,7 @@ export class ZipUtil {
431426 await this . processBinaryFile ( zip , file . fileUri , zipEntryPath )
432427 } else {
433428 const isFileOpenAndDirty = this . isFileOpenAndDirty ( file . fileUri )
434- const fileContent = isFileOpenAndDirty ? await this . getTextContent ( file . fileUri ) : file . fileContent
429+ const fileContent = isFileOpenAndDirty ? await getTextContent ( file . fileUri ) : file . fileContent
435430 this . processTextFile ( zip , file . fileUri , fileContent , languageCount , zipEntryPath )
436431 }
437432 }
0 commit comments