Skip to content
4 changes: 3 additions & 1 deletion packages/core/src/codewhisperer/util/zipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ export class ZipUtil {

const sourceFiles = await collectFiles(
projectPaths,
vscode.workspace.workspaceFolders as CurrentWsFolders,
[...(vscode.workspace.workspaceFolders ?? [])].sort(
(a, b) => b.uri.fsPath.length - a.uri.fsPath.length
) as CurrentWsFolders,
{
maxSizeBytes: this.getProjectScanPayloadSizeLimitInBytes(),
},
Expand Down
12 changes: 3 additions & 9 deletions packages/core/src/shared/utilities/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,12 @@
workspaceFolders?: readonly vscode.WorkspaceFolder[]
} = {
workspaceFolders: vscode.workspace.workspaceFolders,
},
useCase?: FeatureUseCase
}
): { relativePath: string; workspaceFolder: vscode.WorkspaceFolder } | undefined {
if (!override.workspaceFolders) {
return
}
let folders = override.workspaceFolders

Check failure on line 232 in packages/core/src/shared/utilities/workspaceUtils.ts

View workflow job for this annotation

GitHub Actions / lint (18.x, stable)

'folders' is never reassigned. Use 'const' instead
if (useCase && useCase === FeatureUseCase.TEST_GENERATION) {
// Sort workspace folders by path length (descending) to prioritize deeper paths
// TODO: Need to enable this for entire Q
folders = [...override.workspaceFolders].sort((a, b) => b.uri.fsPath.length - a.uri.fsPath.length)
}

for (const folder of folders) {
if (isInDirectory(folder.uri.fsPath, childPath)) {
Expand Down Expand Up @@ -307,7 +301,7 @@
allPatterns.push(...defaultExcludePatterns)
}

if (useCase == FeatureUseCase.TEST_GENERATION) {

Check failure on line 304 in packages/core/src/shared/utilities/workspaceUtils.ts

View workflow job for this annotation

GitHub Actions / lint (18.x, stable)

Expected '===' and instead saw '=='
allPatterns.push(...testGenExcludePatterns)
}

Expand Down Expand Up @@ -410,10 +404,10 @@
excludePatternFilter
)

const files = excludeByGitIgnore ? await filterOutGitignoredFiles(rootPath, allFiles, false) : allFiles
const files = excludeByGitIgnore ? await filterOutGitignoredFiles(rootPath, allFiles, false, useCase) : allFiles

for (const file of files) {
const relativePath = getWorkspaceRelativePath(file.fsPath, { workspaceFolders }, useCase)
const relativePath = getWorkspaceRelativePath(file.fsPath, { workspaceFolders })
if (!relativePath) {
continue
}
Expand Down
Loading