@@ -6,26 +6,28 @@ import vscode = require("vscode");
66import { CancellationToken , DebugConfiguration , DebugConfigurationProvider ,
77 ExtensionContext , WorkspaceFolder } from "vscode" ;
88import { LanguageClient , NotificationType , RequestType } from "vscode-languageclient" ;
9- import { IFeature } from "../feature" ;
109import { getPlatformDetails , OperatingSystem } from "../platform" ;
1110import { PowerShellProcess } from "../process" ;
1211import { SessionManager , SessionStatus } from "../session" ;
1312import Settings = require( "../settings" ) ;
1413import utils = require( "../utils" ) ;
1514import { NamedPipeDebugAdapter } from "../debugAdapter" ;
1615import { Logger } from "../logging" ;
16+ import { LanguageClientConsumer } from "../languageClientConsumer" ;
1717
1818export const StartDebuggerNotificationType =
1919 new NotificationType < void , void > ( "powerShell/startDebugger" ) ;
2020
21- export class DebugSessionFeature implements IFeature , DebugConfigurationProvider , vscode . DebugAdapterDescriptorFactory {
21+ export class DebugSessionFeature extends LanguageClientConsumer
22+ implements DebugConfigurationProvider , vscode . DebugAdapterDescriptorFactory {
2223
2324 private sessionCount : number = 1 ;
2425 private command : vscode . Disposable ;
2526 private tempDebugProcess : PowerShellProcess ;
2627 private tempSessionDetails : utils . IEditorServicesSessionDetails ;
2728
2829 constructor ( context : ExtensionContext , private sessionManager : SessionManager , private logger : Logger ) {
30+ super ( ) ;
2931 // Register a debug configuration provider
3032 context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( "PowerShell" , this ) ) ;
3133 context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( "PowerShell" , this ) )
@@ -325,10 +327,9 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider
325327 }
326328}
327329
328- export class SpecifyScriptArgsFeature implements IFeature {
330+ export class SpecifyScriptArgsFeature implements vscode . Disposable {
329331
330332 private command : vscode . Disposable ;
331- private languageClient : LanguageClient ;
332333 private context : vscode . ExtensionContext ;
333334
334335 constructor ( context : vscode . ExtensionContext ) {
@@ -340,10 +341,6 @@ export class SpecifyScriptArgsFeature implements IFeature {
340341 } ) ;
341342 }
342343
343- public setLanguageClient ( languageclient : LanguageClient ) {
344- this . languageClient = languageclient ;
345- }
346-
347344 public dispose ( ) {
348345 this . command . dispose ( ) ;
349346 }
@@ -391,14 +388,14 @@ interface IGetPSHostProcessesResponseBody {
391388 hostProcesses : IPSHostProcessInfo [ ] ;
392389}
393390
394- export class PickPSHostProcessFeature implements IFeature {
391+ export class PickPSHostProcessFeature extends LanguageClientConsumer {
395392
396393 private command : vscode . Disposable ;
397- private languageClient : LanguageClient ;
398394 private waitingForClientToken : vscode . CancellationTokenSource ;
399395 private getLanguageClientResolve : ( value ?: LanguageClient | Thenable < LanguageClient > ) => void ;
400396
401397 constructor ( ) {
398+ super ( ) ;
402399
403400 this . command =
404401 vscode . commands . registerCommand ( "PowerShell.PickPSHostProcess" , ( ) => {
@@ -522,14 +519,14 @@ interface IRunspace {
522519export const GetRunspaceRequestType =
523520 new RequestType < any , IRunspace [ ] , string , void > ( "powerShell/getRunspace" ) ;
524521
525- export class PickRunspaceFeature implements IFeature {
522+ export class PickRunspaceFeature extends LanguageClientConsumer {
526523
527524 private command : vscode . Disposable ;
528- private languageClient : LanguageClient ;
529525 private waitingForClientToken : vscode . CancellationTokenSource ;
530526 private getLanguageClientResolve : ( value ?: LanguageClient | Thenable < LanguageClient > ) => void ;
531527
532528 constructor ( ) {
529+ super ( ) ;
533530 this . command =
534531 vscode . commands . registerCommand ( "PowerShell.PickRunspace" , ( processId ) => {
535532 return this . getLanguageClient ( )
0 commit comments