@@ -6,26 +6,28 @@ import vscode = require("vscode");
6
6
import { CancellationToken , DebugConfiguration , DebugConfigurationProvider ,
7
7
ExtensionContext , WorkspaceFolder } from "vscode" ;
8
8
import { LanguageClient , NotificationType , RequestType } from "vscode-languageclient" ;
9
- import { IFeature } from "../feature" ;
10
9
import { getPlatformDetails , OperatingSystem } from "../platform" ;
11
10
import { PowerShellProcess } from "../process" ;
12
11
import { SessionManager , SessionStatus } from "../session" ;
13
12
import Settings = require( "../settings" ) ;
14
13
import utils = require( "../utils" ) ;
15
14
import { NamedPipeDebugAdapter } from "../debugAdapter" ;
16
15
import { Logger } from "../logging" ;
16
+ import { LanguageClientConsumer } from "../languageClientConsumer" ;
17
17
18
18
export const StartDebuggerNotificationType =
19
19
new NotificationType < void , void > ( "powerShell/startDebugger" ) ;
20
20
21
- export class DebugSessionFeature implements IFeature , DebugConfigurationProvider , vscode . DebugAdapterDescriptorFactory {
21
+ export class DebugSessionFeature extends LanguageClientConsumer
22
+ implements DebugConfigurationProvider , vscode . DebugAdapterDescriptorFactory {
22
23
23
24
private sessionCount : number = 1 ;
24
25
private command : vscode . Disposable ;
25
26
private tempDebugProcess : PowerShellProcess ;
26
27
private tempSessionDetails : utils . IEditorServicesSessionDetails ;
27
28
28
29
constructor ( context : ExtensionContext , private sessionManager : SessionManager , private logger : Logger ) {
30
+ super ( ) ;
29
31
// Register a debug configuration provider
30
32
context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( "PowerShell" , this ) ) ;
31
33
context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( "PowerShell" , this ) )
@@ -325,10 +327,9 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider
325
327
}
326
328
}
327
329
328
- export class SpecifyScriptArgsFeature implements IFeature {
330
+ export class SpecifyScriptArgsFeature implements vscode . Disposable {
329
331
330
332
private command : vscode . Disposable ;
331
- private languageClient : LanguageClient ;
332
333
private context : vscode . ExtensionContext ;
333
334
334
335
constructor ( context : vscode . ExtensionContext ) {
@@ -340,10 +341,6 @@ export class SpecifyScriptArgsFeature implements IFeature {
340
341
} ) ;
341
342
}
342
343
343
- public setLanguageClient ( languageclient : LanguageClient ) {
344
- this . languageClient = languageclient ;
345
- }
346
-
347
344
public dispose ( ) {
348
345
this . command . dispose ( ) ;
349
346
}
@@ -391,14 +388,14 @@ interface IGetPSHostProcessesResponseBody {
391
388
hostProcesses : IPSHostProcessInfo [ ] ;
392
389
}
393
390
394
- export class PickPSHostProcessFeature implements IFeature {
391
+ export class PickPSHostProcessFeature extends LanguageClientConsumer {
395
392
396
393
private command : vscode . Disposable ;
397
- private languageClient : LanguageClient ;
398
394
private waitingForClientToken : vscode . CancellationTokenSource ;
399
395
private getLanguageClientResolve : ( value ?: LanguageClient | Thenable < LanguageClient > ) => void ;
400
396
401
397
constructor ( ) {
398
+ super ( ) ;
402
399
403
400
this . command =
404
401
vscode . commands . registerCommand ( "PowerShell.PickPSHostProcess" , ( ) => {
@@ -522,14 +519,14 @@ interface IRunspace {
522
519
export const GetRunspaceRequestType =
523
520
new RequestType < any , IRunspace [ ] , string , void > ( "powerShell/getRunspace" ) ;
524
521
525
- export class PickRunspaceFeature implements IFeature {
522
+ export class PickRunspaceFeature extends LanguageClientConsumer {
526
523
527
524
private command : vscode . Disposable ;
528
- private languageClient : LanguageClient ;
529
525
private waitingForClientToken : vscode . CancellationTokenSource ;
530
526
private getLanguageClientResolve : ( value ?: LanguageClient | Thenable < LanguageClient > ) => void ;
531
527
532
528
constructor ( ) {
529
+ super ( ) ;
533
530
this . command =
534
531
vscode . commands . registerCommand ( "PowerShell.PickRunspace" , ( processId ) => {
535
532
return this . getLanguageClient ( )
0 commit comments