@@ -11,7 +11,7 @@ export async function activate(context: vscode.ExtensionContext) {
11
11
const repoInfo = await CodingServer . getRepoParams ( ) ;
12
12
13
13
if ( ! repoInfo ?. team ) {
14
- vscode . window . showWarningMessage ( `Please open a repo hosted by coding.net.` ) ;
14
+ vscode . window . showInformationMessage ( `Please open a repo hosted by coding.net.` ) ;
15
15
} else {
16
16
context . workspaceState . update ( `repoInfo` , repoInfo ) ;
17
17
}
@@ -22,13 +22,18 @@ export async function activate(context: vscode.ExtensionContext) {
22
22
if ( ! codingSrv . session ?. user ) {
23
23
vscode . window . showWarningMessage ( `Please login first.` ) ;
24
24
} else {
25
- context . workspaceState . update ( `session` , codingSrv . session ) ;
25
+ await context . workspaceState . update ( `session` , codingSrv . session ) ;
26
+ const rInfo = context . workspaceState . get ( `repoInfo` , { } ) ;
27
+ await context . workspaceState . update ( `repoInfo` , {
28
+ ...rInfo ,
29
+ team : codingSrv . session . user . team ,
30
+ } ) ;
26
31
}
27
32
28
33
const mrDataProvider = new MRTreeDataProvider ( context , codingSrv ) ;
29
34
const releaseDataProvider = new ReleaseTreeDataProvider ( context ) ;
30
35
const mrTree = vscode . window . createTreeView ( `mrTreeView` , { treeDataProvider : mrDataProvider } ) ;
31
- const releaseTree = vscode . window . createTreeView ( `releaseTreeView` , { treeDataProvider : releaseDataProvider } ) ;
36
+ vscode . window . createTreeView ( `releaseTreeView` , { treeDataProvider : releaseDataProvider } ) ;
32
37
33
38
context . subscriptions . push ( vscode . window . registerUriHandler ( uriHandler ) ) ;
34
39
context . subscriptions . push (
@@ -45,7 +50,8 @@ export async function activate(context: vscode.ExtensionContext) {
45
50
) ;
46
51
context . subscriptions . push (
47
52
vscode . commands . registerCommand ( 'codingPlugin.login' , async ( ) => {
48
- const session = await codingSrv . login ( repoInfo ?. team || `` ) ;
53
+ const rInfo = context . workspaceState . get ( `repoInfo` , { } ) as RepoInfo ;
54
+ const session = await codingSrv . login ( rInfo ?. team || `` ) ;
49
55
if ( ! session ?. accessToken ) {
50
56
console . error ( `No token provided.` ) ;
51
57
} else {
@@ -82,7 +88,7 @@ export async function activate(context: vscode.ExtensionContext) {
82
88
if ( ! selection )
83
89
return ;
84
90
85
- const r = context . workspaceState . get ( `repoInfo` ) as RepoInfo ;
91
+ const r = context . workspaceState . get ( `repoInfo` , { } ) as RepoInfo ;
86
92
context . workspaceState . update ( `repoInfo` , {
87
93
team : r ?. team ,
88
94
project : selection ?. description . replace ( `/${ selection ?. label } ` , `` ) ,
0 commit comments