Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewyuq committed Oct 10, 2024
1 parent c592449 commit d3ffc64
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
import assert from 'assert'
import * as sinon from 'sinon'
import * as vscode from 'vscode'
import { CodeWhispererCodeCoverageTracker, vsCodeState, TelemetryHelper, AuthUtil } from 'aws-core-vscode/codewhisperer'
import {
CodeWhispererCodeCoverageTracker,
vsCodeState,
TelemetryHelper,
AuthUtil,
getUnmodifiedAcceptedTokens,
} from 'aws-core-vscode/codewhisperer'
import { createMockDocument, createMockTextEditor, resetCodeWhispererGlobalVariables } from 'aws-core-vscode/test'
import { globals } from 'aws-core-vscode/shared'
import { assertTelemetryCurried } from 'aws-core-vscode/test'
Expand Down Expand Up @@ -150,14 +156,13 @@ describe('codewhispererCodecoverageTracker', function () {
})

it('Should return correct unmodified accepted tokens count', function () {
const tracker = CodeWhispererCodeCoverageTracker.getTracker(language)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('foo', 'fou'), 2)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('foo', 'f11111oo'), 3)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('foo', 'fo'), 2)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('helloworld', 'HelloWorld'), 8)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('helloworld', 'World'), 4)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('CodeWhisperer', 'CODE'), 1)
assert.strictEqual(tracker?.getUnmodifiedAcceptedTokens('CodeWhisperer', 'CodeWhispererGood'), 13)
assert.strictEqual(getUnmodifiedAcceptedTokens('foo', 'fou'), 2)
assert.strictEqual(getUnmodifiedAcceptedTokens('foo', 'f11111oo'), 3)
assert.strictEqual(getUnmodifiedAcceptedTokens('foo', 'fo'), 2)
assert.strictEqual(getUnmodifiedAcceptedTokens('helloworld', 'HelloWorld'), 8)
assert.strictEqual(getUnmodifiedAcceptedTokens('helloworld', 'World'), 4)
assert.strictEqual(getUnmodifiedAcceptedTokens('CodeWhisperer', 'CODE'), 1)
assert.strictEqual(getUnmodifiedAcceptedTokens('CodeWhisperer', 'CodeWhispererGood'), 13)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { getLogger } from '../../shared/logger/logger'
import * as CodeWhispererConstants from '../models/constants'
import globals from '../../shared/extensionGlobals'
import { vsCodeState } from '../models/model'

import { CodewhispererLanguage, telemetry } from '../../shared/telemetry/telemetry'
import { runtimeLanguageContext } from '../util/runtimeLanguageContext'
import { TelemetryHelper } from '../util/telemetryHelper'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { logSendTelemetryEventFailure } from '../../codewhispererChat/controller
import { Timeout } from '../../shared/utilities/timeoutUtils'
import { getSelectedCustomization } from '../util/customizationUtil'
import { isAwsError, undefinedIfEmpty } from '../../shared'
import { getUnmodifiedAcceptedTokens } from '../indexNode'
import { getUnmodifiedAcceptedTokens } from '../util/commonUtil'

/**
* This singleton class is mainly used for calculating the percentage of user modification.
Expand Down Expand Up @@ -149,7 +149,7 @@ export class CodeWhispererTracker {
sessionId: suggestion.sessionId,
requestId: suggestion.requestId,
programmingLanguage: { languageName: suggestion.language },
// deprecated % value and should not be used by service-side
// deprecated % value and should not be used by service side
modificationPercentage: percentage,
customizationArn: customizationArn,
timestamp: new Date(Date.now()),
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/codewhisperer/util/telemetryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ import { AuthUtil } from './authUtil'
import { isAwsError } from '../../shared/errors'
import { getLogger } from '../../shared/logger'
import { session } from './codeWhispererSession'
import { AcceptedSuggestionEntry, CodeWhispererSupplementalContext } from '../models/model'
import { CodeWhispererSupplementalContext } from '../models/model'
import { FeatureConfigProvider } from '../../shared/featureConfig'
import { CodeScanRemediationsEventType } from '../client/codewhispereruserclient'
import { InsertedCode } from '../../codewhispererChat/controllers/chat/model'

export class TelemetryHelper {
// Some variables for client component latency
Expand Down

0 comments on commit d3ffc64

Please sign in to comment.