@@ -62,16 +62,16 @@ class WorkerServerProcess implements TsServerProcess {
6262 private readonly _onDataHandlers = new Set < ( data : Proto . Response ) => void > ( ) ;
6363 private readonly _onErrorHandlers = new Set < ( err : Error ) => void > ( ) ;
6464 private readonly _onExitHandlers = new Set < ( code : number | null , signal : string | null ) => void > ( ) ;
65- private readonly _watches : FileWatcherManager ;
6665
67- private readonly worker : Worker ;
66+ private readonly _worker : Worker ;
67+ private readonly _watches : FileWatcherManager ;
6868
6969 /** For communicating with TS server synchronously */
70- private readonly tsserver : MessagePort ;
70+ private readonly _tsserver : MessagePort ;
7171 /** For communicating watches asynchronously */
72- private readonly watcher : MessagePort ;
72+ private readonly _watcher : MessagePort ;
7373 /** For communicating with filesystem synchronously */
74- private readonly syncFs : MessagePort ;
74+ private readonly _syncFs : MessagePort ;
7575
7676 public constructor (
7777 private readonly kind : TsServerProcessKind ,
@@ -81,18 +81,18 @@ class WorkerServerProcess implements TsServerProcess {
8181 private readonly tsServerLog : TsServerLog | undefined ,
8282 logger : Logger ,
8383 ) {
84- this . worker = new Worker ( tsServerPath , { name : `TS ${ kind } server #${ this . id } ` } ) ;
84+ this . _worker = new Worker ( tsServerPath , { name : `TS ${ kind } server #${ this . id } ` } ) ;
8585
8686 this . _watches = new FileWatcherManager ( logger ) ;
8787
8888 const tsserverChannel = new MessageChannel ( ) ;
8989 const watcherChannel = new MessageChannel ( ) ;
9090 const syncChannel = new MessageChannel ( ) ;
91- this . tsserver = tsserverChannel . port2 ;
92- this . watcher = watcherChannel . port2 ;
93- this . syncFs = syncChannel . port2 ;
91+ this . _tsserver = tsserverChannel . port2 ;
92+ this . _watcher = watcherChannel . port2 ;
93+ this . _syncFs = syncChannel . port2 ;
9494
95- this . tsserver . onmessage = ( event ) => {
95+ this . _tsserver . onmessage = ( event ) => {
9696 if ( event . data . type === 'log' ) {
9797 console . error ( `unexpected log message on tsserver channel: ${ JSON . stringify ( event ) } ` ) ;
9898 return ;
@@ -102,7 +102,7 @@ class WorkerServerProcess implements TsServerProcess {
102102 }
103103 } ;
104104
105- this . watcher . onmessage = ( event : MessageEvent < BrowserWatchEvent > ) => {
105+ this . _watcher . onmessage = ( event : MessageEvent < BrowserWatchEvent > ) => {
106106 switch ( event . data . type ) {
107107 case 'dispose' : {
108108 this . _watches . delete ( event . data . id ) ;
@@ -111,9 +111,9 @@ class WorkerServerProcess implements TsServerProcess {
111111 case 'watchDirectory' :
112112 case 'watchFile' : {
113113 this . _watches . create ( event . data . id , vscode . Uri . from ( event . data . uri ) , /*watchParentDirs*/ true , ! ! event . data . recursive , {
114- change : uri => this . watcher . postMessage ( { type : 'watch' , event : 'change' , uri } ) ,
115- create : uri => this . watcher . postMessage ( { type : 'watch' , event : 'create' , uri } ) ,
116- delete : uri => this . watcher . postMessage ( { type : 'watch' , event : 'delete' , uri } ) ,
114+ change : uri => this . _watcher . postMessage ( { type : 'watch' , event : 'change' , uri } ) ,
115+ create : uri => this . _watcher . postMessage ( { type : 'watch' , event : 'create' , uri } ) ,
116+ delete : uri => this . _watcher . postMessage ( { type : 'watch' , event : 'delete' , uri } ) ,
117117 } ) ;
118118 break ;
119119 }
@@ -122,7 +122,7 @@ class WorkerServerProcess implements TsServerProcess {
122122 }
123123 } ;
124124
125- this . worker . onmessage = ( msg : any ) => {
125+ this . _worker . onmessage = ( msg : any ) => {
126126 // for logging only
127127 if ( msg . data . type === 'log' ) {
128128 this . appendLog ( msg . data . body ) ;
@@ -131,15 +131,15 @@ class WorkerServerProcess implements TsServerProcess {
131131 console . error ( `unexpected message on main channel: ${ JSON . stringify ( msg ) } ` ) ;
132132 } ;
133133
134- this . worker . onerror = ( err : ErrorEvent ) => {
134+ this . _worker . onerror = ( err : ErrorEvent ) => {
135135 console . error ( 'error! ' + JSON . stringify ( err ) ) ;
136136 for ( const handler of this . _onErrorHandlers ) {
137137 // TODO: The ErrorEvent type might be wrong; previously this was typed as Error and didn't have the property access.
138138 handler ( err . error ) ;
139139 }
140140 } ;
141141
142- this . worker . postMessage (
142+ this . _worker . postMessage (
143143 { args, extensionUri } ,
144144 [ syncChannel . port1 , tsserverChannel . port1 , watcherChannel . port1 ]
145145 ) ;
@@ -150,7 +150,7 @@ class WorkerServerProcess implements TsServerProcess {
150150 }
151151
152152 write ( serverRequest : Proto . Request ) : void {
153- this . tsserver . postMessage ( serverRequest ) ;
153+ this . _tsserver . postMessage ( serverRequest ) ;
154154 }
155155
156156 onData ( handler : ( response : Proto . Response ) => void ) : void {
@@ -167,10 +167,11 @@ class WorkerServerProcess implements TsServerProcess {
167167 }
168168
169169 kill ( ) : void {
170- this . worker . terminate ( ) ;
171- this . tsserver . close ( ) ;
172- this . watcher . close ( ) ;
173- this . syncFs . close ( ) ;
170+ this . _worker . terminate ( ) ;
171+ this . _tsserver . close ( ) ;
172+ this . _watcher . close ( ) ;
173+ this . _syncFs . close ( ) ;
174+ this . _watches . dispose ( ) ;
174175 }
175176
176177 private appendLog ( msg : string ) {
0 commit comments