@@ -2,11 +2,12 @@ import axios from "axios"
22import { getUser , getWorkspaces } from "coder/site/src/api/api"
33import { Workspace } from "coder/site/src/api/typesGenerated"
44import * as vscode from "vscode"
5+ import { OutlineProvider } from "./outline"
56import { Remote } from "./remote"
67import { Storage } from "./storage"
78
89export class Commands {
9- public constructor ( private readonly storage : Storage ) { }
10+ public constructor ( private readonly storage : Storage , private readonly treeDataProvider : OutlineProvider ) { }
1011
1112 public async login ( ...args : string [ ] ) : Promise < void > {
1213 let url : string | undefined = args . length >= 1 ? args [ 0 ] : undefined
@@ -64,25 +65,17 @@ export class Commands {
6465 await this . storage . setSessionToken ( token )
6566 const user = await getUser ( )
6667 await vscode . commands . executeCommand ( "setContext" , "coder.authenticated" , true )
67- vscode . window
68- . showInformationMessage (
69- `Welcome to Coder, ${ user . username } !` ,
70- {
71- detail : "You can now use the Coder extension to manage your Coder instance." ,
72- } ,
73- "Open Workspace" ,
74- )
75- . then ( ( action ) => {
76- if ( action === "Open Workspace" ) {
77- vscode . commands . executeCommand ( "coder.open" )
78- }
79- } )
68+ this . treeDataProvider . refresh ( )
69+ vscode . window . showInformationMessage ( `Welcome to Coder, ${ user . username } !` , {
70+ detail : "You can now use the Coder extension to manage your Coder instance." ,
71+ } )
8072 }
8173
8274 public async logout ( ) : Promise < void > {
8375 await this . storage . setURL ( undefined )
8476 await this . storage . setSessionToken ( undefined )
8577 await vscode . commands . executeCommand ( "setContext" , "coder.authenticated" , false )
78+ this . treeDataProvider . refresh ( )
8679 vscode . window . showInformationMessage ( "You've been logged out of Coder!" , "Login" ) . then ( ( action ) => {
8780 if ( action === "Login" ) {
8881 vscode . commands . executeCommand ( "coder.login" )
0 commit comments