Skip to content

Commit 6cd9d23

Browse files
committed
revert unwanted changes
1 parent 173a11d commit 6cd9d23

File tree

4 files changed

+11
-61
lines changed

4 files changed

+11
-61
lines changed

docs/lsp.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ sequenceDiagram
2626

2727
## Language Server Debugging
2828

29-
1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.
29+
1. Clone https://github.com/aws/language-servers.git and set it up in the same workspace as this project by cmd+shift+p and "add folder to workspace" and selecting the language-servers folder that you just cloned. Your VS code folder structure should look like below.
30+
31+
3032

3133
```
3234
/aws-toolkit-vscode
@@ -57,4 +59,4 @@ sequenceDiagram
5759
5860
## Amazon Q Inline Activation
5961
60-
- In order to get inline completion working you must open a supported file type defined in CodewhispererInlineCompletionLanguages in `packages/amazonq/src/app/inline/completion.ts`
62+
- In order to get inline completion working you must open a supported file type defined in CodewhispererInlineCompletionLanguages in `packages/amazonq/src/app/inline/completion.ts`

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
/* eslint-disable aws-toolkits/no-console-log */
7-
86
import * as vscode from 'vscode'
97
import { CodewhispererCodeScanIssueApplyFix, Component, telemetry } from '../../shared/telemetry/telemetry'
108
import { ExtContext, VSCODE_EXTENSION_ID } from '../../shared/extensions'
@@ -367,7 +365,6 @@ export const updateReferenceLog = Commands.declare(
367365
export const openSecurityIssuePanel = Commands.declare(
368366
'aws.amazonq.openSecurityIssuePanel',
369367
(context: ExtContext) => async (issue: CodeScanIssue | IssueItem, filePath: string) => {
370-
console.log('in open security')
371368
const targetIssue: CodeScanIssue = issue instanceof IssueItem ? issue.issue : issue
372369
const targetFilePath: string = issue instanceof IssueItem ? issue.filePath : filePath
373370
await showSecurityIssueWebview(context.extensionContext, targetIssue, targetFilePath)
@@ -393,36 +390,6 @@ export const openSecurityIssuePanel = Commands.declare(
393390
undefined,
394391
!!targetIssue.suggestedFixes.length
395392
)
396-
console.log('in show securityIssueWebview')
397-
console.log('targetIssue', targetIssue)
398-
console.log('file Path', filePath)
399-
console.log('before', targetIssue.suggestedFixes.length === 0)
400-
401-
// telemetry.codewhisperer_codeScanIssueViewDetails.emit({
402-
// findingId: targetIssue.findingId,
403-
// detectorId: targetIssue.detectorId,
404-
// ruleId: targetIssue.ruleId,
405-
// credentialStartUrl: AuthUtil.instance.startUrl,
406-
// autoDetected: targetIssue.autoDetected,
407-
// })
408-
console.log('middle', targetIssue.suggestedFixes.length === 0)
409-
410-
// TelemetryHelper.instance.sendCodeScanRemediationsEvent(
411-
// undefined,
412-
// 'CODESCAN_ISSUE_VIEW_DETAILS',
413-
// targetIssue.detectorId,
414-
// targetIssue.findingId,
415-
// targetIssue.ruleId,
416-
// undefined,
417-
// undefined,
418-
// undefined,
419-
// !!targetIssue.suggestedFixes.length
420-
// )
421-
console.log('after', targetIssue.suggestedFixes.length === 0)
422-
if (targetIssue.suggestedFixes.length === 0) {
423-
console.log('going to generate fix as suggested fix length is 0')
424-
await generateFix.execute(targetIssue, targetFilePath, 'webview', true, false)
425-
}
426393
}
427394
)
428395

@@ -719,18 +686,13 @@ export const generateFix = Commands.declare(
719686
refresh: boolean = false,
720687
shouldOpenSecurityIssuePanel: boolean = true
721688
) => {
722-
console.log('in generate fix')
723689
const targetIssue: CodeScanIssue | undefined = issue instanceof IssueItem ? issue.issue : issue
724690
const targetFilePath: string = issue instanceof IssueItem ? issue.filePath : filePath
725691
const targetSource: Component = issue instanceof IssueItem ? 'tree' : source
726-
console.log('target issue', targetIssue)
727-
console.log('target file path', targetFilePath)
728-
console.log('target source', targetSource)
729692
if (!targetIssue) {
730693
return
731694
}
732695
if (targetIssue.ruleId === CodeWhispererConstants.sasRuleId) {
733-
console.log('GenerateFix is not available for SAS findings.')
734696
getLogger().warn('GenerateFix is not available for SAS findings.')
735697
return
736698
}
@@ -770,9 +732,6 @@ export const generateFix = Commands.declare(
770732
getLogger().debug(
771733
`Received fix with reference and user settings disallow references. Job ID: ${jobId}`
772734
)
773-
console.log(
774-
`Received fix with reference and user settings disallow references. Job ID: ${jobId}`
775-
)
776735
// TODO: re-enable notifications once references published
777736
// void vscode.window.showInformationMessage(
778737
// 'Your settings do not allow code generation with references.'
@@ -796,7 +755,6 @@ export const generateFix = Commands.declare(
796755
]
797756
: [],
798757
}
799-
console.log('finish updating issue', updatedIssue)
800758
await updateSecurityIssueWebview({
801759
issue: updatedIssue,
802760
isGenerateFixLoading: false,
@@ -807,7 +765,6 @@ export const generateFix = Commands.declare(
807765

808766
SecurityIssueProvider.instance.updateIssue(updatedIssue, targetFilePath)
809767
SecurityIssueTreeViewProvider.instance.refresh()
810-
console.log('finish updating webview')
811768
} catch (err) {
812769
const error = err instanceof Error ? err : new TypeError('Unexpected error')
813770
await updateSecurityIssueWebview({

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import { fs } from '../../shared/fs/fs'
6-
// import { getLogger } from '../../shared/logger/logger'
6+
import { getLogger } from '../../shared/logger/logger'
77
import {
88
createCodeFixJob,
99
getCodeFixJob,
@@ -21,7 +21,6 @@ import { tempDirPath } from '../../shared/filesystemUtilities'
2121
import { CodeWhispererSettings } from '../util/codewhispererSettings'
2222
import { AuthUtil } from '../util/authUtil'
2323
import { saveDocumentIfDirty } from '../../shared/utilities/textDocumentUtilities'
24-
/* eslint-disable aws-toolkits/no-console-log */
2524

2625
export async function startCodeFixGeneration(
2726
client: DefaultCodeWhispererClient,
@@ -38,7 +37,7 @@ export async function startCodeFixGeneration(
3837
let linesOfFixGenerated
3938
let charsOfFixGenerated
4039
try {
41-
console.log(
40+
getLogger().verbose(
4241
`Starting code fix generation for lines ${issue.startLine + 1} through ${issue.endLine} of file ${filePath}`
4342
)
4443

@@ -91,30 +90,30 @@ export async function startCodeFixGeneration(
9190
}
9291
jobId = codeFixJob.jobId
9392
issue.fixJobId = codeFixJob.jobId
94-
console.log(`Created code fix job.`)
93+
getLogger().verbose(`Created code fix job.`)
9594

9695
/**
9796
* Step 4: Polling mechanism on code fix job status
9897
*/
9998
throwIfCancelled()
10099
const jobStatus = await pollCodeFixJobStatus(client, String(codeFixJob.jobId), profile)
101100
if (jobStatus === 'Failed') {
102-
console.log(`Code fix generation failed.`)
101+
getLogger().verbose(`Code fix generation failed.`)
103102
throw new CreateCodeFixError()
104103
}
105104

106105
/**
107106
* Step 5: Process and render code fix results
108107
*/
109108
throwIfCancelled()
110-
console.log(`Code fix job succeeded and start processing result.`)
109+
getLogger().verbose(`Code fix job succeeded and start processing result.`)
111110

112111
const { suggestedFix } = await getCodeFixJob(client, String(codeFixJob.jobId), profile)
113112
// eslint-disable-next-line aws-toolkits/no-json-stringify-in-log
114-
console.log(`Suggested fix: ${JSON.stringify(suggestedFix)}`)
113+
getLogger().verbose(`Suggested fix: ${JSON.stringify(suggestedFix)}`)
115114
return { suggestedFix, jobId }
116115
} catch (err) {
117-
console.log('Code fix generation failed: %s', err)
116+
getLogger().error('Code fix generation failed: %s', err)
118117
throw err
119118
} finally {
120119
codeFixState.setToNotStarted()

packages/core/src/codewhisperer/util/telemetryHelper.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,6 @@ export class TelemetryHelper {
890890
result?: string,
891891
includesFix?: boolean
892892
) {
893-
// eslint-disable-next-line aws-toolkits/no-console-log
894-
console.log('sending telemetry')
895893
client
896894
.sendTelemetryEvent({
897895
telemetryEvent: {
@@ -922,12 +920,6 @@ export class TelemetryHelper {
922920
if (isAwsError(error)) {
923921
requestId = error.requestId
924922
}
925-
// eslint-disable-next-line aws-toolkits/no-console-log
926-
console.log(
927-
`Failed to sendCodeScanRemediationsEvent to CodeWhisperer, requestId: ${
928-
requestId ?? ''
929-
}, message: ${error.message}`
930-
)
931923
getLogger().debug(
932924
`Failed to sendCodeScanRemediationsEvent to CodeWhisperer, requestId: ${
933925
requestId ?? ''

0 commit comments

Comments
 (0)