Skip to content

Commit 0e7647d

Browse files
authored
codewhisperer: reduce token infilling suggestions (#3944)
1 parent d35ac17 commit 0e7647d

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/codewhisperer/service/keyStrokeHandler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { ClassifierTrigger } from './classifierTrigger'
2020
import { isIamConnection } from '../../auth/connection'
2121
import { session } from '../util/codeWhispererSession'
2222
import { extractContextForCodeWhisperer } from '../util/editorContext'
23-
import { CodeWhispererUserGroupSettings } from '../util/userGroupUtil'
2423

2524
const performance = globalThis.performance ?? require('perf_hooks').performance
2625

@@ -119,7 +118,6 @@ export class KeyStrokeHandler {
119118
// we do not want to trigger when there is immediate right context on the same line
120119
// with "}" being an exception because of IDE auto-complete
121120
if (
122-
CodeWhispererUserGroupSettings.getUserGroup() === CodeWhispererConstants.UserGroup.RightContext &&
123121
rightContextAtCurrentLine.length &&
124122
!rightContextAtCurrentLine.startsWith(' ') &&
125123
rightContextAtCurrentLine.trim() !== '}'

src/codewhisperer/util/userGroupUtil.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ export class CodeWhispererUserGroupSettings {
5656
}
5757

5858
private guessUserGroup(): UserGroup {
59-
const randomNum = Math.random()
60-
const result = randomNum <= 1 / 2 ? UserGroup.Control : UserGroup.RightContext
61-
return result
59+
return UserGroup.Control
6260
}
6361

6462
static #instance: CodeWhispererUserGroupSettings | undefined

src/test/codewhisperer/service/keyStrokeHandler.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('keyStrokeHandler', function () {
9999
await testShouldInvoke('a', true)
100100
})
101101

102-
it('Should skip invoking if there is immediate right context on the same line and not a single } for the user group', async function () {
102+
it('Should skip invoking if there is immediate right context on the same line and not a single }', async function () {
103103
const casesForSuppressTokenFilling = [
104104
{
105105
rightContext: 'add',
@@ -127,14 +127,10 @@ describe('keyStrokeHandler', function () {
127127
},
128128
]
129129
casesForSuppressTokenFilling.forEach(async ({ rightContext, shouldInvoke }) => {
130-
await testShouldInvoke('{', shouldInvoke, rightContext, CodeWhispererConstants.UserGroup.RightContext)
130+
await testShouldInvoke('{', shouldInvoke, rightContext)
131131
})
132132
})
133133

134-
it('Should not skip invoking based on right context for control group', async function () {
135-
await testShouldInvoke('{', true, 'add')
136-
})
137-
138134
async function testShouldInvoke(
139135
input: string,
140136
shouldTrigger: boolean,

0 commit comments

Comments
 (0)