3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
+ import * as vscode from 'vscode' ;
6
7
import { ExtensionServiceDefinition , ExtensionServiceImplementation , GetWorkspaceAuthInfoRequest , GetWorkspaceAuthInfoResponse , LocalSSHServiceDefinition , PingRequest , SendErrorReportRequest , SendLocalSSHUserFlowStatusRequest , SendLocalSSHUserFlowStatusRequest_Code , SendLocalSSHUserFlowStatusRequest_ConnType , SendLocalSSHUserFlowStatusRequest_Status } from '../../proto/typescript/ipc/v1/ipc' ;
7
8
import { Disposable } from '../../common/dispose' ;
8
9
import { retry , timeout } from '../../common/async' ;
@@ -17,7 +18,7 @@ import { CallContext, ServerError, Status } from 'nice-grpc-common';
17
18
import { IHostService } from '../../services/hostService' ;
18
19
import { Server , createClient , createServer , createChannel } from 'nice-grpc' ;
19
20
import { INotificationService } from '../../services/notificationService' ;
20
- import { showWsNotRunningDialog } from '../../remote' ;
21
+ import { getGitpodRemoteWindowConnectionInfo , showWsNotRunningDialog } from '../../remote' ;
21
22
import { ITelemetryService , UserFlowTelemetry } from '../../services/telemetryService' ;
22
23
import { ExperimentalSettings } from '../../experiments' ;
23
24
import { Configuration } from '../../configuration' ;
@@ -38,9 +39,13 @@ const phaseMap: Record<WorkspaceInstanceStatus_Phase, WorkspaceInstancePhase | u
38
39
export class ExtensionServiceImpl implements ExtensionServiceImplementation {
39
40
private notificationGapSet = new Set < string > ( ) ;
40
41
41
- constructor ( private logService : ILogService , private sessionService : ISessionService , private hostService : IHostService , private notificationService : INotificationService , private experiments : ExperimentalSettings , private telemetryService : ITelemetryService ) { }
42
+ constructor ( private readonly context : vscode . ExtensionContext , private logService : ILogService , private sessionService : ISessionService , private hostService : IHostService , private notificationService : INotificationService , private experiments : ExperimentalSettings , private telemetryService : ITelemetryService ) { }
42
43
43
44
private canShowNotification ( id : string ) {
45
+ let remoteConnectionInfo = getGitpodRemoteWindowConnectionInfo ( this . context ) ;
46
+ if ( ! remoteConnectionInfo || remoteConnectionInfo . connectionInfo . workspaceId !== id ) {
47
+ return false ;
48
+ }
44
49
if ( this . notificationGapSet . has ( id ) ) {
45
50
return false ;
46
51
}
@@ -156,6 +161,7 @@ export class ExtensionServiceServer extends Disposable {
156
161
private localSSHServiceClient = createClient ( LocalSSHServiceDefinition , createChannel ( '127.0.0.1:' + Configuration . getLocalSshIpcPort ( ) ) ) ;
157
162
158
163
constructor (
164
+ private readonly context : vscode . ExtensionContext ,
159
165
private readonly logService : ILogService ,
160
166
private readonly sessionService : ISessionService ,
161
167
private readonly hostService : IHostService ,
@@ -173,7 +179,7 @@ export class ExtensionServiceServer extends Disposable {
173
179
174
180
private getServer ( ) : Server {
175
181
const server = createServer ( ) ;
176
- const serviceImpl = new ExtensionServiceImpl ( this . logService , this . sessionService , this . hostService , this . notificationService , this . experiments , this . telemetryService ) ;
182
+ const serviceImpl = new ExtensionServiceImpl ( this . context , this . logService , this . sessionService , this . hostService , this . notificationService , this . experiments , this . telemetryService ) ;
177
183
server . add ( ExtensionServiceDefinition , serviceImpl ) ;
178
184
return server ;
179
185
}
0 commit comments