refactor: only keep one User instance

This commit is contained in:
Levi Yan
2025-03-24 16:29:55 +08:00
parent 4bc9ee4e83
commit fa9be999d5
2 changed files with 5 additions and 4 deletions

View File

@@ -11,10 +11,10 @@ export default class DSHome {
private devstarHomePageUrl: string;
private devstarDomain: string | undefined
constructor(context: vscode.ExtensionContext) {
constructor(context: vscode.ExtensionContext, user: User) {
this.context = context;
this.user = new User(context);
this.remoteContainer = new RemoteContainer(this.user);
this.user = user;
this.remoteContainer = new RemoteContainer(user);
this.devstarDomain = utils.getDevstarDomain()
if (undefined == this.devstarDomain || "" == this.devstarDomain) {

View File

@@ -12,8 +12,9 @@ export class DevStarExtension {
constructor(private context: vscode.ExtensionContext) {
this.user = new User(context);
// 只保持一个User实例
this.remoteContainer = new RemoteContainer(this.user);
this.dsHome = new DSHome(context);
this.dsHome = new DSHome(context, this.user);
const handler = vscode.window.registerUriHandler({
handleUri: async (uri: vscode.Uri) => {