-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(codewhisperer): refactor UTG code path and add test coverage #5590
Conversation
[done] will upload a functional feature test screen recording |
packages/amazonq/test/unit/codewhisperer/util/codeParsingUtil.test.ts
Outdated
Show resolved
Hide resolved
@@ -24,10 +24,12 @@ import { getOpenFilesInWindow } from '../../../shared/utilities/editorUtilities' | |||
import { getLogger } from '../../../shared/logger/logger' | |||
import { CodeWhispererSupplementalContext, CodeWhispererSupplementalContextItem, UtgStrategy } from '../../models/model' | |||
|
|||
type UtgSupportedLanguage = keyof typeof utgLanguageConfigs | |||
const UTG_SUPPORTEDLANGUAGES: vscode.TextDocument['languageId'][] = ['java', 'python'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fetch the list of supported languages to BE. Because In order to extend the feature to additional languages we will rely on weekly release of IDEs, instead we should rely on Backend for this information so that we can make such decisions very dynamic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that's a good callout and discussed offline with Vikash, I think we're limited by the infra we have at this point of time, our service doesn't have this kinda of dynamic configuration API yet except the one for A/B testing. So we can't do much on this for now.
This comment also apply to other Q features as well like "auto trigger classifier co-efficients" https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/codewhisperer/service/classifierTrigger.ts#L43 and other language level gated features. It would be definitely a good feature for us to track in the future
packages/core/src/codewhisperer/util/supplementalContext/utgUtils.ts
Outdated
Show resolved
Hide resolved
packages/core/src/codewhisperer/util/supplementalContext/utgUtils.ts
Outdated
Show resolved
Hide resolved
packages/amazonq/test/unit/codewhisperer/util/codeParsingUtil.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test takes 10 seconds. ...
openATextEditorWithText
opens an editor, which can be slow. Could we add a param to it which only callsvscode.workspace.openTextDocument
and skipsshowTextDocument
That was implemented in the new assertIsTestFile
function. I think it would be preferable to add that variant to testUtil.ts
, but doesn't need to block this for now.
After that change, the total test time for the "validate by file name" tests is now 60 ms instead of 10 s. Nice!
sgtm, i will add this to testUtil |
Oh, I didn't see this. I have a PR already for that #5660 |
gotcha, thanks Justin :)! |
Problem
Solution
java
java-example-1.mov
java-example-2.mov
no supported (kotlin)
kotlin-example.mov
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.