@@ -29,7 +29,7 @@ namespace ts.projectSystem {
29
29
}
30
30
}
31
31
32
- function setup ( logLevel : server . LogLevel | undefined , options ?: Partial < server . StartSessionOptions > , importServicePlugin ?: server . ServerHost [ "importServicePlugin " ] ) {
32
+ function setup ( logLevel : server . LogLevel | undefined , options ?: Partial < server . StartSessionOptions > , importPlugin ?: server . ServerHost [ "importPlugin " ] ) {
33
33
const host = createServerHost ( [ libFile ] , { windowsStyleRoot : "c:/" } ) ;
34
34
const messages : any [ ] = [ ] ;
35
35
const webHost : server . WebHost = {
@@ -38,7 +38,7 @@ namespace ts.projectSystem {
38
38
writeMessage : s => messages . push ( s ) ,
39
39
} ;
40
40
const webSys = server . createWebSystem ( webHost , emptyArray , ( ) => host . getExecutingFilePath ( ) ) ;
41
- webSys . importServicePlugin = importServicePlugin ;
41
+ webSys . importPlugin = importPlugin ;
42
42
const logger = logLevel !== undefined ? new server . MainProcessLogger ( logLevel , webHost ) : nullLogger ( ) ;
43
43
const session = new TestWorkerSession ( webSys , webHost , { serverMode : LanguageServiceMode . PartialSemantic , ...options } , logger ) ;
44
44
return { getMessages : ( ) => messages , clearMessages : ( ) => messages . length = 0 , session } ;
@@ -161,7 +161,7 @@ namespace ts.projectSystem {
161
161
it ( "plugins are not loaded immediately" , async ( ) => {
162
162
let pluginModuleInstantiated = false ;
163
163
let pluginInvoked = false ;
164
- const importServicePlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
164
+ const importPlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
165
165
await Promise . resolve ( ) ; // simulate at least a single turn delay
166
166
pluginModuleInstantiated = true ;
167
167
return {
@@ -173,7 +173,7 @@ namespace ts.projectSystem {
173
173
} ;
174
174
} ;
175
175
176
- const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importServicePlugin ) ;
176
+ const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importPlugin ) ;
177
177
const projectService = session . getProjectService ( ) ;
178
178
179
179
session . executeCommand ( { seq : 1 , type : "request" , command : protocol . CommandTypes . Open , arguments : { file : "^memfs:/foo.ts" , content : "" } } ) ;
@@ -201,7 +201,7 @@ namespace ts.projectSystem {
201
201
const pluginADeferred = Utils . defer ( ) ;
202
202
const pluginBDeferred = Utils . defer ( ) ;
203
203
const log : string [ ] = [ ] ;
204
- const importServicePlugin = async ( _root : string , moduleName : string ) : Promise < server . ModuleImportResult > => {
204
+ const importPlugin = async ( _root : string , moduleName : string ) : Promise < server . ModuleImportResult > => {
205
205
log . push ( `request import ${ moduleName } ` ) ;
206
206
const promise = moduleName === "plugin-a" ? pluginADeferred . promise : pluginBDeferred . promise ;
207
207
await promise ;
@@ -215,7 +215,7 @@ namespace ts.projectSystem {
215
215
} ;
216
216
} ;
217
217
218
- const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" , "plugin-b" ] } , importServicePlugin ) ;
218
+ const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" , "plugin-b" ] } , importPlugin ) ;
219
219
const projectService = session . getProjectService ( ) ;
220
220
221
221
session . executeCommand ( { seq : 1 , type : "request" , command : protocol . CommandTypes . Open , arguments : { file : "^memfs:/foo.ts" , content : "" } } ) ;
@@ -241,15 +241,15 @@ namespace ts.projectSystem {
241
241
} ) ;
242
242
243
243
it ( "sends projectsUpdatedInBackground event" , async ( ) => {
244
- const importServicePlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
244
+ const importPlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
245
245
await Promise . resolve ( ) ; // simulate at least a single turn delay
246
246
return {
247
247
module : ( ( ) => ( { create : info => info . languageService } ) ) as server . PluginModuleFactory ,
248
248
error : undefined
249
249
} ;
250
250
} ;
251
251
252
- const { session, getMessages } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importServicePlugin ) ;
252
+ const { session, getMessages } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importPlugin ) ;
253
253
const projectService = session . getProjectService ( ) ;
254
254
255
255
session . executeCommand ( { seq : 1 , type : "request" , command : protocol . CommandTypes . Open , arguments : { file : "^memfs:/foo.ts" , content : "" } } ) ;
@@ -270,7 +270,7 @@ namespace ts.projectSystem {
270
270
const pluginAShouldLoad = Utils . defer ( ) ;
271
271
const pluginAExternalFilesRequested = Utils . defer ( ) ;
272
272
273
- const importServicePlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
273
+ const importPlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
274
274
// wait until the initial external files are requested from the project service.
275
275
await pluginAShouldLoad . promise ;
276
276
@@ -287,7 +287,7 @@ namespace ts.projectSystem {
287
287
} ;
288
288
} ;
289
289
290
- const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importServicePlugin ) ;
290
+ const { session } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importPlugin ) ;
291
291
const projectService = session . getProjectService ( ) ;
292
292
293
293
session . executeCommand ( { seq : 1 , type : "request" , command : protocol . CommandTypes . Open , arguments : { file : "^memfs:/foo.ts" , content : "" } } ) ;
@@ -316,7 +316,7 @@ namespace ts.projectSystem {
316
316
it ( "project is closed before plugins are loaded" , async ( ) => {
317
317
const pluginALoaded = Utils . defer ( ) ;
318
318
const projectClosed = Utils . defer ( ) ;
319
- const importServicePlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
319
+ const importPlugin = async ( _root : string , _moduleName : string ) : Promise < server . ModuleImportResult > => {
320
320
// mark that the plugin has started loading
321
321
pluginALoaded . resolve ( ) ;
322
322
@@ -328,7 +328,7 @@ namespace ts.projectSystem {
328
328
} ;
329
329
} ;
330
330
331
- const { session, getMessages } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importServicePlugin ) ;
331
+ const { session, getMessages } = setup ( /*logLevel*/ undefined , { globalPlugins : [ "plugin-a" ] } , importPlugin ) ;
332
332
const projectService = session . getProjectService ( ) ;
333
333
334
334
session . executeCommand ( { seq : 1 , type : "request" , command : protocol . CommandTypes . Open , arguments : { file : "^memfs:/foo.ts" , content : "" } } ) ;
0 commit comments