Skip to content

Commit 2ea348d

Browse files
Merge master into feature/emr
2 parents 48cdedc + db9efb7 commit 2ea348d

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

package-lock.json

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "amazon q inline: skip indexing when no workspace folders are found"
4+
}

packages/core/src/amazonq/lsp/lspController.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ import { isWeb } from '../../shared/extensionGlobals'
2323
import { getUserAgent } from '../../shared/telemetry/util'
2424
import { isAmazonInternalOs } from '../../shared/vscode/env'
2525

26-
function getProjectPaths() {
27-
const workspaceFolders = vscode.workspace.workspaceFolders
28-
if (!workspaceFolders || workspaceFolders.length === 0) {
29-
throw new ToolkitError('No workspace folders found')
30-
}
31-
return workspaceFolders.map((folder) => folder.uri.fsPath)
32-
}
33-
3426
export interface Chunk {
3527
readonly filePath: string
3628
readonly content: string
@@ -322,12 +314,13 @@ export class LspController {
322314
async buildIndex(buildIndexConfig: BuildIndexConfig) {
323315
getLogger().info(`LspController: Starting to build index of project`)
324316
const start = performance.now()
325-
const projPaths = getProjectPaths()
317+
const projPaths = (vscode.workspace.workspaceFolders ?? []).map((folder) => folder.uri.fsPath)
318+
if (projPaths.length === 0) {
319+
getLogger().info(`LspController: Skipping building index. No projects found in workspace`)
320+
return
321+
}
326322
projPaths.sort()
327323
try {
328-
if (projPaths.length === 0) {
329-
throw Error('No project')
330-
}
331324
this._isIndexingInProgress = true
332325
const projRoot = projPaths[0]
333326
const files = await collectFilesForIndex(
@@ -340,7 +333,7 @@ export class LspController {
340333
(accumulator, currentFile) => accumulator + currentFile.fileSizeBytes,
341334
0
342335
)
343-
getLogger().info(`LspController: Found ${files.length} files in current project ${getProjectPaths()}`)
336+
getLogger().info(`LspController: Found ${files.length} files in current project ${projPaths}`)
344337
const config = buildIndexConfig.isVectorIndexEnabled ? 'all' : 'default'
345338
const r = files.map((f) => f.fileUri.fsPath)
346339
const resp = await LspClient.instance.buildIndex(r, projRoot, config)

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,12 @@ export async function finalizeTransformationJob(status: string) {
718718
if (!(status === 'COMPLETED' || status === 'PARTIALLY_COMPLETED')) {
719719
getLogger().error(`CodeTransformation: ${CodeWhispererConstants.failedToCompleteJobNotification}`)
720720
jobPlanProgress['transformCode'] = StepProgress.Failed
721-
transformByQState.setJobFailureErrorNotification(CodeWhispererConstants.failedToCompleteJobNotification)
722-
transformByQState.setJobFailureErrorChatMessage(CodeWhispererConstants.failedToCompleteJobChatMessage)
721+
if (!transformByQState.getJobFailureErrorNotification()) {
722+
transformByQState.setJobFailureErrorNotification(CodeWhispererConstants.failedToCompleteJobNotification)
723+
}
724+
if (!transformByQState.getJobFailureErrorChatMessage()) {
725+
transformByQState.setJobFailureErrorChatMessage(CodeWhispererConstants.failedToCompleteJobChatMessage)
726+
}
723727
throw new Error('Job was not successful nor partially successful')
724728
}
725729
transformByQState.setToSucceeded()

packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ export class ProposedTransformationExplorer {
516516
programmingLanguage: {
517517
languageName:
518518
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE
519-
? 'JAVA'
520-
: 'SQL',
519+
? 'java'
520+
: 'sql',
521521
},
522522
linesOfCodeChanged: metricsData.linesOfCodeChanged,
523523
charsOfCodeChanged: metricsData.charactersOfCodeChanged,

0 commit comments

Comments
 (0)