Skip to content

Commit 9bcfda8

Browse files
committed
unresolved imports of empty array and undefined are same
1 parent ee5a6a8 commit 9bcfda8

File tree

111 files changed

+9
-894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+9
-894
lines changed

src/server/project.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ function compilerOptionsChanged(opt1: CompilerOptions, opt2: CompilerOptions): b
362362
}
363363

364364
function unresolvedImportsChanged(imports1: SortedReadonlyArray<string> | undefined, imports2: SortedReadonlyArray<string> | undefined): boolean {
365-
if (imports1 === imports2) {
366-
return false;
367-
}
365+
if (imports1 === imports2) return false;
366+
// undefined and 0 length array are same
367+
if (!imports1?.length === !imports2?.length) return false;
368368
return !arrayIsEqualTo(imports1, imports2);
369369
}
370370
const disabledTypeAcquisition: TypeAcquisition = {};
@@ -1518,10 +1518,14 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
15181518
this.typingsCache = {
15191519
compilerOptions: this.getCompilationSettings(),
15201520
typeAcquisition,
1521-
unresolvedImports: this.lastCachedUnresolvedImportsList,
1521+
unresolvedImports: this.lastCachedUnresolvedImportsList?.length ? this.lastCachedUnresolvedImportsList : undefined,
15221522
};
15231523
// something has been changed, issue a request to update typings
1524-
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(this, typeAcquisition, this.lastCachedUnresolvedImportsList);
1524+
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(
1525+
this,
1526+
typeAcquisition,
1527+
this.typingsCache.unresolvedImports,
1528+
);
15251529
}
15261530
}
15271531

tests/baselines/reference/tsserver/autoImportProvider/Auto-importable-file-is-in-inferred-project-until-imported.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,12 @@ TI:: [hh:mm:ss:mss] Got install request
186186
"include": [],
187187
"exclude": []
188188
},
189-
"unresolvedImports": [],
190189
"projectRootPath": "/user/username/projects/project/node_modules/@angular/forms",
191190
"kind": "discover"
192191
}
193192
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
194193
TI:: [hh:mm:ss:mss] Explicitly included types: []
195194
TI:: [hh:mm:ss:mss] Typing names in '/user/username/projects/project/node_modules/@angular/forms/package.json' dependencies: []
196-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
197195
TI:: [hh:mm:ss:mss] Finished typings discovery:
198196
{
199197
"cachedTypingPaths": [],
@@ -235,7 +233,6 @@ TI:: [hh:mm:ss:mss] Sending response:
235233
"noEmitForJsFiles": true
236234
},
237235
"typings": [],
238-
"unresolvedImports": [],
239236
"kind": "action::set"
240237
}
241238
Info seq [hh:mm:ss:mss] event:
@@ -258,7 +255,6 @@ Info seq [hh:mm:ss:mss] event:
258255
"noEmitForJsFiles": true
259256
},
260257
"typings": [],
261-
"unresolvedImports": [],
262258
"kind": "action::set"
263259
}
264260
}

tests/baselines/reference/tsserver/autoImportProvider/Responds-to-manual-changes-in-node_modules.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,12 @@ TI:: [hh:mm:ss:mss] Got install request
435435
"include": [],
436436
"exclude": []
437437
},
438-
"unresolvedImports": [],
439438
"projectRootPath": "/user/username/projects/project/node_modules/@angular/forms",
440439
"kind": "discover"
441440
}
442441
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
443442
TI:: [hh:mm:ss:mss] Explicitly included types: []
444443
TI:: [hh:mm:ss:mss] Typing names in '/user/username/projects/project/node_modules/@angular/forms/package.json' dependencies: []
445-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
446444
TI:: [hh:mm:ss:mss] Finished typings discovery:
447445
{
448446
"cachedTypingPaths": [],
@@ -484,7 +482,6 @@ TI:: [hh:mm:ss:mss] Sending response:
484482
"noEmitForJsFiles": true
485483
},
486484
"typings": [],
487-
"unresolvedImports": [],
488485
"kind": "action::set"
489486
}
490487
Info seq [hh:mm:ss:mss] event:
@@ -507,7 +504,6 @@ Info seq [hh:mm:ss:mss] event:
507504
"noEmitForJsFiles": true
508505
},
509506
"typings": [],
510-
"unresolvedImports": [],
511507
"kind": "action::set"
512508
}
513509
}

tests/baselines/reference/tsserver/autoImportProvider/projects-already-inside-node_modules.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,12 @@ TI:: [hh:mm:ss:mss] Got install request
183183
"include": [],
184184
"exclude": []
185185
},
186-
"unresolvedImports": [],
187186
"projectRootPath": "/user/username/projects/project/node_modules/@angular/forms",
188187
"kind": "discover"
189188
}
190189
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
191190
TI:: [hh:mm:ss:mss] Explicitly included types: []
192191
TI:: [hh:mm:ss:mss] Typing names in '/user/username/projects/project/node_modules/@angular/forms/package.json' dependencies: ["@angular/core"]
193-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
194192
TI:: [hh:mm:ss:mss] Finished typings discovery:
195193
{
196194
"cachedTypingPaths": [],
@@ -237,7 +235,6 @@ TI:: [hh:mm:ss:mss] Sending response:
237235
"noEmitForJsFiles": true
238236
},
239237
"typings": [],
240-
"unresolvedImports": [],
241238
"kind": "action::set"
242239
}
243240
Info seq [hh:mm:ss:mss] event:
@@ -260,7 +257,6 @@ Info seq [hh:mm:ss:mss] event:
260257
"noEmitForJsFiles": true
261258
},
262259
"typings": [],
263-
"unresolvedImports": [],
264260
"kind": "action::set"
265261
}
266262
}

tests/baselines/reference/tsserver/auxiliaryProject/does-not-remove-scrips-from-InferredProject.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,11 @@ TI:: [hh:mm:ss:mss] Got install request
374374
"include": [],
375375
"exclude": []
376376
},
377-
"unresolvedImports": [],
378377
"projectRootPath": "/user/username/projects/project",
379378
"kind": "discover"
380379
}
381380
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
382381
TI:: [hh:mm:ss:mss] Explicitly included types: []
383-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
384382
TI:: [hh:mm:ss:mss] Finished typings discovery:
385383
{
386384
"cachedTypingPaths": [],
@@ -420,7 +418,6 @@ TI:: [hh:mm:ss:mss] Sending response:
420418
"maxNodeModuleJsDepth": 2
421419
},
422420
"typings": [],
423-
"unresolvedImports": [],
424421
"kind": "action::set"
425422
}
426423
Info seq [hh:mm:ss:mss] event:
@@ -444,7 +441,6 @@ Info seq [hh:mm:ss:mss] event:
444441
"maxNodeModuleJsDepth": 2
445442
},
446443
"typings": [],
447-
"unresolvedImports": [],
448444
"kind": "action::set"
449445
}
450446
}

tests/baselines/reference/tsserver/completions/works-when-files-are-included-from-two-different-drives-of-windows.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,11 @@ TI:: [hh:mm:ss:mss] Got install request
299299
"include": [],
300300
"exclude": []
301301
},
302-
"unresolvedImports": [],
303302
"projectRootPath": "e:/solution/myproject/src",
304303
"kind": "discover"
305304
}
306305
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
307306
TI:: [hh:mm:ss:mss] Explicitly included types: []
308-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
309307
TI:: [hh:mm:ss:mss] Finished typings discovery:
310308
{
311309
"cachedTypingPaths": [],
@@ -345,7 +343,6 @@ TI:: [hh:mm:ss:mss] Sending response:
345343
"maxNodeModuleJsDepth": 2
346344
},
347345
"typings": [],
348-
"unresolvedImports": [],
349346
"kind": "action::set"
350347
}
351348
Info seq [hh:mm:ss:mss] event:
@@ -369,7 +366,6 @@ Info seq [hh:mm:ss:mss] event:
369366
"maxNodeModuleJsDepth": 2
370367
},
371368
"typings": [],
372-
"unresolvedImports": [],
373369
"kind": "action::set"
374370
}
375371
}

tests/baselines/reference/tsserver/configFileSearch/when-projectRootPath-is-not-present.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,11 @@ TI:: [hh:mm:ss:mss] Got install request
144144
"include": [],
145145
"exclude": []
146146
},
147-
"unresolvedImports": [],
148147
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
149148
"kind": "discover"
150149
}
151150
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
152151
TI:: [hh:mm:ss:mss] Explicitly included types: []
153-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
154152
TI:: [hh:mm:ss:mss] Finished typings discovery:
155153
{
156154
"cachedTypingPaths": [],
@@ -190,7 +188,6 @@ TI:: [hh:mm:ss:mss] Sending response:
190188
"maxNodeModuleJsDepth": 2
191189
},
192190
"typings": [],
193-
"unresolvedImports": [],
194191
"kind": "action::set"
195192
}
196193
Info seq [hh:mm:ss:mss] event:
@@ -214,7 +211,6 @@ Info seq [hh:mm:ss:mss] event:
214211
"maxNodeModuleJsDepth": 2
215212
},
216213
"typings": [],
217-
"unresolvedImports": [],
218214
"kind": "action::set"
219215
}
220216
}

tests/baselines/reference/tsserver/configFileSearch/when-projectRootPath-is-present-but-file-is-not-from-project-root.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,11 @@ TI:: [hh:mm:ss:mss] Got install request
145145
"include": [],
146146
"exclude": []
147147
},
148-
"unresolvedImports": [],
149148
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
150149
"kind": "discover"
151150
}
152151
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
153152
TI:: [hh:mm:ss:mss] Explicitly included types: []
154-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
155153
TI:: [hh:mm:ss:mss] Finished typings discovery:
156154
{
157155
"cachedTypingPaths": [],
@@ -191,7 +189,6 @@ TI:: [hh:mm:ss:mss] Sending response:
191189
"maxNodeModuleJsDepth": 2
192190
},
193191
"typings": [],
194-
"unresolvedImports": [],
195192
"kind": "action::set"
196193
}
197194
Info seq [hh:mm:ss:mss] event:
@@ -215,7 +212,6 @@ Info seq [hh:mm:ss:mss] event:
215212
"maxNodeModuleJsDepth": 2
216213
},
217214
"typings": [],
218-
"unresolvedImports": [],
219215
"kind": "action::set"
220216
}
221217
}

tests/baselines/reference/tsserver/configuredProjects/files-are-properly-detached-when-language-service-is-disabled.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,11 @@ TI:: [hh:mm:ss:mss] Got install request
427427
"include": [],
428428
"exclude": []
429429
},
430-
"unresolvedImports": [],
431430
"projectRootPath": "/user/username/projects/project",
432431
"kind": "discover"
433432
}
434433
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
435434
TI:: [hh:mm:ss:mss] Explicitly included types: []
436-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
437435
TI:: [hh:mm:ss:mss] Finished typings discovery:
438436
{
439437
"cachedTypingPaths": [],
@@ -473,7 +471,6 @@ TI:: [hh:mm:ss:mss] Sending response:
473471
"maxNodeModuleJsDepth": 2
474472
},
475473
"typings": [],
476-
"unresolvedImports": [],
477474
"kind": "action::set"
478475
}
479476
Info seq [hh:mm:ss:mss] event:
@@ -497,7 +494,6 @@ Info seq [hh:mm:ss:mss] event:
497494
"maxNodeModuleJsDepth": 2
498495
},
499496
"typings": [],
500-
"unresolvedImports": [],
501497
"kind": "action::set"
502498
}
503499
}

tests/baselines/reference/tsserver/configuredProjects/should-not-close-configured-project-after-closing-last-open-file,-but-should-be-closed-on-next-file-open-if-its-not-the-file-from-same-project.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,11 @@ TI:: [hh:mm:ss:mss] Got install request
379379
"include": [],
380380
"exclude": []
381381
},
382-
"unresolvedImports": [],
383382
"projectRootPath": "/home/src/Vscode/Projects/bin",
384383
"kind": "discover"
385384
}
386385
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json'
387386
TI:: [hh:mm:ss:mss] Explicitly included types: []
388-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
389387
TI:: [hh:mm:ss:mss] Finished typings discovery:
390388
{
391389
"cachedTypingPaths": [],
@@ -424,7 +422,6 @@ TI:: [hh:mm:ss:mss] Sending response:
424422
"noEmitForJsFiles": true
425423
},
426424
"typings": [],
427-
"unresolvedImports": [],
428425
"kind": "action::set"
429426
}
430427
Info seq [hh:mm:ss:mss] event:
@@ -447,7 +444,6 @@ Info seq [hh:mm:ss:mss] event:
447444
"noEmitForJsFiles": true
448445
},
449446
"typings": [],
450-
"unresolvedImports": [],
451447
"kind": "action::set"
452448
}
453449
}

0 commit comments

Comments
 (0)