File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import { TestInfrastructure } from './tools'
3
+ import { createLanguageClientManager , getLanguageClientOptions } from '..'
4
+
5
+ describe ( 'Lifecycle' , ( ) => {
6
+ test ( 'Can dispose the language client manager immediately' , async ( ) => {
7
+ const infrastructure = new TestInfrastructure ( false , false , 2000 )
8
+
9
+ const languageClient = createLanguageClientManager ( 'java' , infrastructure , {
10
+ ...getLanguageClientOptions ( 'java' ) ,
11
+ createAdditionalFeatures : undefined
12
+ } )
13
+ const startPromise = languageClient . start ( )
14
+ await languageClient . dispose ( )
15
+ await startPromise
16
+ } )
17
+ } )
Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ export class TestInfrastructure implements Infrastructure {
116
116
117
117
constructor (
118
118
public automaticTextDocumentUpdate : boolean ,
119
- public _useMutualizedProxy : boolean
119
+ public _useMutualizedProxy : boolean ,
120
+ public connectionCreationDelay : number = 0
120
121
) { }
121
122
122
123
useMutualizedProxy ( languageClientId : LanguageClientId , options : LanguageClientOptions ) : boolean {
@@ -160,6 +161,7 @@ export class TestInfrastructure implements Infrastructure {
160
161
exit : function ( ) : void { }
161
162
}
162
163
const clientConnection = createConnection ( ( ) => c2 , watchDog )
164
+ await new Promise ( resolve => setTimeout ( resolve , this . connectionCreationDelay ) )
163
165
this . connectionDeferred . resolve ( clientConnection )
164
166
c2 . listen ( )
165
167
You can’t perform that action at this time.
0 commit comments