@@ -49,6 +49,7 @@ export class WorkspaceMonitor implements vscode.Disposable {
49
49
try {
50
50
const newWorkspaceData = JSON . parse ( event . data ) as Workspace
51
51
this . update ( newWorkspaceData )
52
+ this . maybeNotify ( newWorkspaceData )
52
53
this . onChange . fire ( newWorkspaceData )
53
54
} catch ( error ) {
54
55
this . notifyError ( error )
@@ -65,6 +66,7 @@ export class WorkspaceMonitor implements vscode.Disposable {
65
66
this . updateStatusBarItem . command = "coder.workspace.update"
66
67
67
68
this . update ( workspace ) // Set initial state.
69
+ this . maybeNotify ( workspace )
68
70
}
69
71
70
72
/**
@@ -81,9 +83,13 @@ export class WorkspaceMonitor implements vscode.Disposable {
81
83
private update ( workspace : Workspace ) {
82
84
this . updateContext ( workspace )
83
85
this . updateStatusBar ( workspace )
86
+ }
87
+
88
+ private maybeNotify ( workspace : Workspace ) {
84
89
this . maybeNotifyOutdated ( workspace )
85
90
this . maybeNotifyAutostop ( workspace )
86
91
this . maybeNotifyDeletion ( workspace )
92
+ this . maybeNotifyNotRunning ( workspace )
87
93
}
88
94
89
95
private maybeNotifyAutostop ( workspace : Workspace ) {
@@ -111,6 +117,22 @@ export class WorkspaceMonitor implements vscode.Disposable {
111
117
}
112
118
}
113
119
120
+ private maybeNotifyNotRunning ( workspace : Workspace ) {
121
+ if ( workspace . latest_build . status !== "running" ) {
122
+ const action = vscode . window . showInformationMessage (
123
+ "Your workspace is no longer running!" ,
124
+ {
125
+ detail : "Reloading the window to reconnect." ,
126
+ } ,
127
+ "Reload Window" ,
128
+ )
129
+ if ( ! action ) {
130
+ return
131
+ }
132
+ vscode . commands . executeCommand ( "workbench.action.reloadWindow" )
133
+ }
134
+ }
135
+
114
136
private isImpending ( target : string , notifyTime : number ) : boolean {
115
137
const nowTime = new Date ( ) . getTime ( )
116
138
const targetTime = new Date ( target ) . getTime ( )
0 commit comments