@@ -8,7 +8,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
88import { registerSingleton } from 'vs/platform/instantiation/common/extensions' ;
99import { IStorageService , StorageScope } from 'vs/platform/storage/common/storage' ;
1010import { ITunnelService , RemoteTunnel } from 'vs/platform/remote/common/tunnel' ;
11- import { Disposable } from 'vs/base/common/lifecycle' ;
11+ import { Disposable , IDisposable } from 'vs/base/common/lifecycle' ;
1212import { IEditableData } from 'vs/workbench/common/views' ;
1313import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
1414import { TunnelInformation , TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver' ;
@@ -191,7 +191,7 @@ export class TunnelModel extends Disposable {
191191 this . _candidateFinder = finder ;
192192 }
193193
194- setCandidateFilter ( filter : ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) : void {
194+ setCandidateFilter ( filter : ( ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) | undefined ) : void {
195195 this . _candidateFilter = filter ;
196196 }
197197
@@ -235,7 +235,7 @@ export interface IRemoteExplorerService {
235235 close ( remote : { host : string , port : number } ) : Promise < void > ;
236236 setTunnelInformation ( tunnelInformation : TunnelInformation | undefined ) : void ;
237237 registerCandidateFinder ( finder : ( ) => Promise < { host : string , port : number , detail : string } [ ] > ) : void ;
238- setCandidateFilter ( filter : ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) : void ;
238+ setCandidateFilter ( filter : ( ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) | undefined ) : IDisposable ;
239239 refresh ( ) : Promise < void > ;
240240}
241241
@@ -310,8 +310,18 @@ class RemoteExplorerService implements IRemoteExplorerService {
310310 this . tunnelModel . registerCandidateFinder ( finder ) ;
311311 }
312312
313- setCandidateFilter ( filter : ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) : void {
313+ setCandidateFilter ( filter : ( candidates : { host : string , port : number , detail : string } [ ] ) => Promise < { host : string , port : number , detail : string } [ ] > ) : IDisposable {
314+ if ( ! filter ) {
315+ return {
316+ dispose : ( ) => { }
317+ } ;
318+ }
314319 this . tunnelModel . setCandidateFilter ( filter ) ;
320+ return {
321+ dispose : ( ) => {
322+ this . tunnelModel . setCandidateFilter ( undefined ) ;
323+ }
324+ } ;
315325 }
316326
317327 refresh ( ) : Promise < void > {
0 commit comments