-
Notifications
You must be signed in to change notification settings - Fork 718
feat(amazonq): Add command to generate unit tests for selected code #5577
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
Changes from 18 commits
a16fd11
fcc3818
5cc1126
f2ff8f7
50fc1f8
3ed55a9
334dd2a
3e3b6aa
4b19d4a
4dc4f6b
ab799b5
ecc91a1
15de7e9
17a9153
5701cef
a2c7dc3
99cd07d
59a023b
9a11570
a12768c
12f879d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,13 +59,15 @@ import { | |
AwsConnection, | ||
scopesCodeWhispererCore, | ||
ProfileNotFoundError, | ||
isSsoConnection, | ||
} from './connection' | ||
import { isSageMaker, isCloud9, isAmazonQ } from '../shared/extensionUtilities' | ||
import { telemetry } from '../shared/telemetry/telemetry' | ||
import { randomUUID } from '../shared/crypto' | ||
import { asStringifiedStack } from '../shared/telemetry/spans' | ||
import { withTelemetryContext } from '../shared/telemetry/util' | ||
import { DiskCacheError } from '../shared/utilities/cacheUtils' | ||
import { setContext } from '../shared/vscode/setContext' | ||
|
||
interface AuthService { | ||
/** | ||
|
@@ -166,6 +168,26 @@ export class Auth implements AuthService, ConnectionManager { | |
return this.#ssoCacheWatcher | ||
} | ||
|
||
public get startUrl(): string | undefined { | ||
// Reformat the url to remove any trailing '/' and `#` | ||
// e.g. https://view.awsapps.com/start/# will become https://view.awsapps.com/start | ||
return isSsoConnection(this.activeConnection) | ||
? this.reformatStartUrl(this.activeConnection.startUrl) | ||
: undefined | ||
} | ||
|
||
public isConnected(): boolean { | ||
return this.activeConnection !== undefined | ||
} | ||
|
||
public normalizeStartUrl(startUrl: string | undefined) { | ||
return !startUrl ? undefined : startUrl.replace(/[\/#]+$/g, '') | ||
} | ||
|
||
public isInternalAmazonUser(): boolean { | ||
return this.isConnected() && this.startUrl === 'https://amzn.awsapps.com/start' | ||
} | ||
|
||
/** | ||
* Map startUrl -> declared connections | ||
*/ | ||
|
@@ -223,6 +245,8 @@ export class Auth implements AuthService, ConnectionManager { | |
this.#onDidChangeActiveConnection.fire(conn) | ||
await this.store.setCurrentProfileId(id) | ||
|
||
await setContext('aws.isInternalUser', this.isInternalAmazonUser()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it hurts to set this back to false on Some testing that I did made me doubt how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh okay well that would explain it. We need this to be set with |
||
|
||
return conn | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.