Skip to content

Commit d166ac7

Browse files
committed
unresolved imports of empty array and undefined are same
1 parent 8e30ef8 commit d166ac7

File tree

107 files changed

+9
-878
lines changed

Some content is hidden

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

107 files changed

+9
-878
lines changed

src/server/project.ts

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

360360
function unresolvedImportsChanged(imports1: SortedReadonlyArray<string> | undefined, imports2: SortedReadonlyArray<string> | undefined): boolean {
361-
if (imports1 === imports2) {
362-
return false;
363-
}
361+
if (imports1 === imports2) return false;
362+
// undefined and 0 length array are same
363+
if (!imports1?.length === !imports2?.length) return false;
364364
return !arrayIsEqualTo(imports1, imports2);
365365
}
366366
const disabledTypeAcquisition: TypeAcquisition = {};
@@ -1521,10 +1521,14 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
15211521
this.typingsCache = {
15221522
compilerOptions: this.getCompilationSettings(),
15231523
typeAcquisition,
1524-
unresolvedImports: this.lastCachedUnresolvedImportsList,
1524+
unresolvedImports: this.lastCachedUnresolvedImportsList?.length ? this.lastCachedUnresolvedImportsList : undefined,
15251525
};
15261526
// something has been changed, issue a request to update typings
1527-
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(this, typeAcquisition, this.lastCachedUnresolvedImportsList);
1527+
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(
1528+
this,
1529+
typeAcquisition,
1530+
this.typingsCache.unresolvedImports,
1531+
);
15281532
}
15291533
}
15301534

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
@@ -121,14 +121,12 @@ TI:: [hh:mm:ss:mss] Got install request
121121
"include": [],
122122
"exclude": []
123123
},
124-
"unresolvedImports": [],
125124
"projectRootPath": "/node_modules/@angular/forms",
126125
"kind": "discover"
127126
}
128127
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
129128
TI:: [hh:mm:ss:mss] Explicitly included types: []
130129
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: []
131-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
132130
TI:: [hh:mm:ss:mss] Finished typings discovery:
133131
{
134132
"cachedTypingPaths": [],
@@ -170,7 +168,6 @@ TI:: [hh:mm:ss:mss] Sending response:
170168
"noEmitForJsFiles": true
171169
},
172170
"typings": [],
173-
"unresolvedImports": [],
174171
"kind": "action::set"
175172
}
176173
Info seq [hh:mm:ss:mss] event:
@@ -193,7 +190,6 @@ Info seq [hh:mm:ss:mss] event:
193190
"noEmitForJsFiles": true
194191
},
195192
"typings": [],
196-
"unresolvedImports": [],
197193
"kind": "action::set"
198194
}
199195
}

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
@@ -455,14 +455,12 @@ TI:: [hh:mm:ss:mss] Got install request
455455
"include": [],
456456
"exclude": []
457457
},
458-
"unresolvedImports": [],
459458
"projectRootPath": "/node_modules/@angular/forms",
460459
"kind": "discover"
461460
}
462461
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
463462
TI:: [hh:mm:ss:mss] Explicitly included types: []
464463
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: []
465-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
466464
TI:: [hh:mm:ss:mss] Finished typings discovery:
467465
{
468466
"cachedTypingPaths": [],
@@ -504,7 +502,6 @@ TI:: [hh:mm:ss:mss] Sending response:
504502
"noEmitForJsFiles": true
505503
},
506504
"typings": [],
507-
"unresolvedImports": [],
508505
"kind": "action::set"
509506
}
510507
Info seq [hh:mm:ss:mss] event:
@@ -527,7 +524,6 @@ Info seq [hh:mm:ss:mss] event:
527524
"noEmitForJsFiles": true
528525
},
529526
"typings": [],
530-
"unresolvedImports": [],
531527
"kind": "action::set"
532528
}
533529
}

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
@@ -118,14 +118,12 @@ TI:: [hh:mm:ss:mss] Got install request
118118
"include": [],
119119
"exclude": []
120120
},
121-
"unresolvedImports": [],
122121
"projectRootPath": "/node_modules/@angular/forms",
123122
"kind": "discover"
124123
}
125124
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
126125
TI:: [hh:mm:ss:mss] Explicitly included types: []
127126
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: ["@angular/core"]
128-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
129127
TI:: [hh:mm:ss:mss] Finished typings discovery:
130128
{
131129
"cachedTypingPaths": [],
@@ -172,7 +170,6 @@ TI:: [hh:mm:ss:mss] Sending response:
172170
"noEmitForJsFiles": true
173171
},
174172
"typings": [],
175-
"unresolvedImports": [],
176173
"kind": "action::set"
177174
}
178175
Info seq [hh:mm:ss:mss] event:
@@ -195,7 +192,6 @@ Info seq [hh:mm:ss:mss] event:
195192
"noEmitForJsFiles": true
196193
},
197194
"typings": [],
198-
"unresolvedImports": [],
199195
"kind": "action::set"
200196
}
201197
}

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
@@ -282,13 +282,11 @@ TI:: [hh:mm:ss:mss] Got install request
282282
"include": [],
283283
"exclude": []
284284
},
285-
"unresolvedImports": [],
286285
"projectRootPath": "/",
287286
"kind": "discover"
288287
}
289288
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
290289
TI:: [hh:mm:ss:mss] Explicitly included types: []
291-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
292290
TI:: [hh:mm:ss:mss] Finished typings discovery:
293291
{
294292
"cachedTypingPaths": [],
@@ -328,7 +326,6 @@ TI:: [hh:mm:ss:mss] Sending response:
328326
"maxNodeModuleJsDepth": 2
329327
},
330328
"typings": [],
331-
"unresolvedImports": [],
332329
"kind": "action::set"
333330
}
334331
Info seq [hh:mm:ss:mss] event:
@@ -352,7 +349,6 @@ Info seq [hh:mm:ss:mss] event:
352349
"maxNodeModuleJsDepth": 2
353350
},
354351
"typings": [],
355-
"unresolvedImports": [],
356352
"kind": "action::set"
357353
}
358354
}

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
@@ -290,13 +290,11 @@ TI:: [hh:mm:ss:mss] Got install request
290290
"include": [],
291291
"exclude": []
292292
},
293-
"unresolvedImports": [],
294293
"projectRootPath": "e:/myproject/src",
295294
"kind": "discover"
296295
}
297296
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
298297
TI:: [hh:mm:ss:mss] Explicitly included types: []
299-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
300298
TI:: [hh:mm:ss:mss] Finished typings discovery:
301299
{
302300
"cachedTypingPaths": [],
@@ -336,7 +334,6 @@ TI:: [hh:mm:ss:mss] Sending response:
336334
"maxNodeModuleJsDepth": 2
337335
},
338336
"typings": [],
339-
"unresolvedImports": [],
340337
"kind": "action::set"
341338
}
342339
Info seq [hh:mm:ss:mss] event:
@@ -360,7 +357,6 @@ Info seq [hh:mm:ss:mss] event:
360357
"maxNodeModuleJsDepth": 2
361358
},
362359
"typings": [],
363-
"unresolvedImports": [],
364360
"kind": "action::set"
365361
}
366362
}

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
@@ -139,13 +139,11 @@ TI:: [hh:mm:ss:mss] Got install request
139139
"include": [],
140140
"exclude": []
141141
},
142-
"unresolvedImports": [],
143142
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
144143
"kind": "discover"
145144
}
146145
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
147146
TI:: [hh:mm:ss:mss] Explicitly included types: []
148-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
149147
TI:: [hh:mm:ss:mss] Finished typings discovery:
150148
{
151149
"cachedTypingPaths": [],
@@ -185,7 +183,6 @@ TI:: [hh:mm:ss:mss] Sending response:
185183
"maxNodeModuleJsDepth": 2
186184
},
187185
"typings": [],
188-
"unresolvedImports": [],
189186
"kind": "action::set"
190187
}
191188
Info seq [hh:mm:ss:mss] event:
@@ -209,7 +206,6 @@ Info seq [hh:mm:ss:mss] event:
209206
"maxNodeModuleJsDepth": 2
210207
},
211208
"typings": [],
212-
"unresolvedImports": [],
213209
"kind": "action::set"
214210
}
215211
}

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
@@ -140,13 +140,11 @@ TI:: [hh:mm:ss:mss] Got install request
140140
"include": [],
141141
"exclude": []
142142
},
143-
"unresolvedImports": [],
144143
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
145144
"kind": "discover"
146145
}
147146
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
148147
TI:: [hh:mm:ss:mss] Explicitly included types: []
149-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
150148
TI:: [hh:mm:ss:mss] Finished typings discovery:
151149
{
152150
"cachedTypingPaths": [],
@@ -186,7 +184,6 @@ TI:: [hh:mm:ss:mss] Sending response:
186184
"maxNodeModuleJsDepth": 2
187185
},
188186
"typings": [],
189-
"unresolvedImports": [],
190187
"kind": "action::set"
191188
}
192189
Info seq [hh:mm:ss:mss] event:
@@ -210,7 +207,6 @@ Info seq [hh:mm:ss:mss] event:
210207
"maxNodeModuleJsDepth": 2
211208
},
212209
"typings": [],
213-
"unresolvedImports": [],
214210
"kind": "action::set"
215211
}
216212
}

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
@@ -411,13 +411,11 @@ TI:: [hh:mm:ss:mss] Got install request
411411
"include": [],
412412
"exclude": []
413413
},
414-
"unresolvedImports": [],
415414
"projectRootPath": "/",
416415
"kind": "discover"
417416
}
418417
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
419418
TI:: [hh:mm:ss:mss] Explicitly included types: []
420-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
421419
TI:: [hh:mm:ss:mss] Finished typings discovery:
422420
{
423421
"cachedTypingPaths": [],
@@ -457,7 +455,6 @@ TI:: [hh:mm:ss:mss] Sending response:
457455
"maxNodeModuleJsDepth": 2
458456
},
459457
"typings": [],
460-
"unresolvedImports": [],
461458
"kind": "action::set"
462459
}
463460
Info seq [hh:mm:ss:mss] event:
@@ -481,7 +478,6 @@ Info seq [hh:mm:ss:mss] event:
481478
"maxNodeModuleJsDepth": 2
482479
},
483480
"typings": [],
484-
"unresolvedImports": [],
485481
"kind": "action::set"
486482
}
487483
}

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
@@ -368,13 +368,11 @@ TI:: [hh:mm:ss:mss] Got install request
368368
"include": [],
369369
"exclude": []
370370
},
371-
"unresolvedImports": [],
372371
"projectRootPath": "/",
373372
"kind": "discover"
374373
}
375374
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
376375
TI:: [hh:mm:ss:mss] Explicitly included types: []
377-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
378376
TI:: [hh:mm:ss:mss] Finished typings discovery:
379377
{
380378
"cachedTypingPaths": [],
@@ -413,7 +411,6 @@ TI:: [hh:mm:ss:mss] Sending response:
413411
"noEmitForJsFiles": true
414412
},
415413
"typings": [],
416-
"unresolvedImports": [],
417414
"kind": "action::set"
418415
}
419416
Info seq [hh:mm:ss:mss] event:
@@ -436,7 +433,6 @@ Info seq [hh:mm:ss:mss] event:
436433
"noEmitForJsFiles": true
437434
},
438435
"typings": [],
439-
"unresolvedImports": [],
440436
"kind": "action::set"
441437
}
442438
}

0 commit comments

Comments
 (0)