Skip to content

Commit ec26f33

Browse files
committed
unresolved imports of empty array and undefined are same
1 parent a705d20 commit ec26f33

File tree

106 files changed

+5
-870
lines changed

Some content is hidden

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

106 files changed

+5
-870
lines changed

src/server/project.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ function compilerOptionsChangeRequiresRefresh(opt1: CompilerOptions, opt2: Compi
366366
}
367367

368368
function unresolvedImportsChanged(imports1: SortedReadonlyArray<string> | undefined, imports2: SortedReadonlyArray<string> | undefined): boolean {
369-
if (imports1 === imports2) {
370-
return false;
371-
}
369+
if (imports1 === imports2) return false;
370+
// undefined and 0 length array are same
371+
if (!imports1?.length === !imports2?.length) return false;
372372
return !arrayIsEqualTo(imports1, imports2);
373373
}
374374

@@ -1500,13 +1500,13 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
15001500
this.typingsCacheEntry = {
15011501
compilerOptions: this.getCompilationSettings(),
15021502
typeAcquisition,
1503-
unresolvedImports: this.lastCachedUnresolvedImportsList,
1503+
unresolvedImports: this.lastCachedUnresolvedImportsList?.length ? this.lastCachedUnresolvedImportsList : undefined,
15041504
};
15051505
// something has been changed, issue a request to update typings
15061506
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(
15071507
this,
15081508
typeAcquisition,
1509-
this.lastCachedUnresolvedImportsList,
1509+
this.typingsCacheEntry.unresolvedImports,
15101510
);
15111511
}
15121512
}

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
@@ -87,14 +87,12 @@ TI:: [hh:mm:ss:mss] Got install request
8787
"include": [],
8888
"exclude": []
8989
},
90-
"unresolvedImports": [],
9190
"projectRootPath": "/node_modules/@angular/forms",
9291
"kind": "discover"
9392
}
9493
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
9594
TI:: [hh:mm:ss:mss] Explicitly included types: []
9695
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: []
97-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
9896
TI:: [hh:mm:ss:mss] Finished typings discovery:
9997
{
10098
"cachedTypingPaths": [],
@@ -136,7 +134,6 @@ TI:: [hh:mm:ss:mss] Sending response:
136134
"noEmitForJsFiles": true
137135
},
138136
"typings": [],
139-
"unresolvedImports": [],
140137
"kind": "action::set"
141138
}
142139
Info seq [hh:mm:ss:mss] event:
@@ -159,7 +156,6 @@ Info seq [hh:mm:ss:mss] event:
159156
"noEmitForJsFiles": true
160157
},
161158
"typings": [],
162-
"unresolvedImports": [],
163159
"kind": "action::set"
164160
}
165161
}

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
@@ -361,14 +361,12 @@ TI:: [hh:mm:ss:mss] Got install request
361361
"include": [],
362362
"exclude": []
363363
},
364-
"unresolvedImports": [],
365364
"projectRootPath": "/node_modules/@angular/forms",
366365
"kind": "discover"
367366
}
368367
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
369368
TI:: [hh:mm:ss:mss] Explicitly included types: []
370369
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: []
371-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
372370
TI:: [hh:mm:ss:mss] Finished typings discovery:
373371
{
374372
"cachedTypingPaths": [],
@@ -410,7 +408,6 @@ TI:: [hh:mm:ss:mss] Sending response:
410408
"noEmitForJsFiles": true
411409
},
412410
"typings": [],
413-
"unresolvedImports": [],
414411
"kind": "action::set"
415412
}
416413
Info seq [hh:mm:ss:mss] event:
@@ -433,7 +430,6 @@ Info seq [hh:mm:ss:mss] event:
433430
"noEmitForJsFiles": true
434431
},
435432
"typings": [],
436-
"unresolvedImports": [],
437433
"kind": "action::set"
438434
}
439435
}

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
@@ -84,14 +84,12 @@ TI:: [hh:mm:ss:mss] Got install request
8484
"include": [],
8585
"exclude": []
8686
},
87-
"unresolvedImports": [],
8887
"projectRootPath": "/node_modules/@angular/forms",
8988
"kind": "discover"
9089
}
9190
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
9291
TI:: [hh:mm:ss:mss] Explicitly included types: []
9392
TI:: [hh:mm:ss:mss] Typing names in '/node_modules/@angular/forms/package.json' dependencies: ["@angular/core"]
94-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
9593
TI:: [hh:mm:ss:mss] Finished typings discovery:
9694
{
9795
"cachedTypingPaths": [],
@@ -138,7 +136,6 @@ TI:: [hh:mm:ss:mss] Sending response:
138136
"noEmitForJsFiles": true
139137
},
140138
"typings": [],
141-
"unresolvedImports": [],
142139
"kind": "action::set"
143140
}
144141
Info seq [hh:mm:ss:mss] event:
@@ -161,7 +158,6 @@ Info seq [hh:mm:ss:mss] event:
161158
"noEmitForJsFiles": true
162159
},
163160
"typings": [],
164-
"unresolvedImports": [],
165161
"kind": "action::set"
166162
}
167163
}

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
@@ -202,13 +202,11 @@ TI:: [hh:mm:ss:mss] Got install request
202202
"include": [],
203203
"exclude": []
204204
},
205-
"unresolvedImports": [],
206205
"projectRootPath": "/",
207206
"kind": "discover"
208207
}
209208
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
210209
TI:: [hh:mm:ss:mss] Explicitly included types: []
211-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
212210
TI:: [hh:mm:ss:mss] Finished typings discovery:
213211
{
214212
"cachedTypingPaths": [],
@@ -248,7 +246,6 @@ TI:: [hh:mm:ss:mss] Sending response:
248246
"maxNodeModuleJsDepth": 2
249247
},
250248
"typings": [],
251-
"unresolvedImports": [],
252249
"kind": "action::set"
253250
}
254251
Info seq [hh:mm:ss:mss] event:
@@ -272,7 +269,6 @@ Info seq [hh:mm:ss:mss] event:
272269
"maxNodeModuleJsDepth": 2
273270
},
274271
"typings": [],
275-
"unresolvedImports": [],
276272
"kind": "action::set"
277273
}
278274
}

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
@@ -235,13 +235,11 @@ TI:: [hh:mm:ss:mss] Got install request
235235
"include": [],
236236
"exclude": []
237237
},
238-
"unresolvedImports": [],
239238
"projectRootPath": "e:/myproject/src",
240239
"kind": "discover"
241240
}
242241
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
243242
TI:: [hh:mm:ss:mss] Explicitly included types: []
244-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
245243
TI:: [hh:mm:ss:mss] Finished typings discovery:
246244
{
247245
"cachedTypingPaths": [],
@@ -281,7 +279,6 @@ TI:: [hh:mm:ss:mss] Sending response:
281279
"maxNodeModuleJsDepth": 2
282280
},
283281
"typings": [],
284-
"unresolvedImports": [],
285282
"kind": "action::set"
286283
}
287284
Info seq [hh:mm:ss:mss] event:
@@ -305,7 +302,6 @@ Info seq [hh:mm:ss:mss] event:
305302
"maxNodeModuleJsDepth": 2
306303
},
307304
"typings": [],
308-
"unresolvedImports": [],
309305
"kind": "action::set"
310306
}
311307
}

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
@@ -125,13 +125,11 @@ TI:: [hh:mm:ss:mss] Got install request
125125
"include": [],
126126
"exclude": []
127127
},
128-
"unresolvedImports": [],
129128
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
130129
"kind": "discover"
131130
}
132131
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
133132
TI:: [hh:mm:ss:mss] Explicitly included types: []
134-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
135133
TI:: [hh:mm:ss:mss] Finished typings discovery:
136134
{
137135
"cachedTypingPaths": [],
@@ -171,7 +169,6 @@ TI:: [hh:mm:ss:mss] Sending response:
171169
"maxNodeModuleJsDepth": 2
172170
},
173171
"typings": [],
174-
"unresolvedImports": [],
175172
"kind": "action::set"
176173
}
177174
Info seq [hh:mm:ss:mss] event:
@@ -195,7 +192,6 @@ Info seq [hh:mm:ss:mss] event:
195192
"maxNodeModuleJsDepth": 2
196193
},
197194
"typings": [],
198-
"unresolvedImports": [],
199195
"kind": "action::set"
200196
}
201197
}

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
@@ -126,13 +126,11 @@ TI:: [hh:mm:ss:mss] Got install request
126126
"include": [],
127127
"exclude": []
128128
},
129-
"unresolvedImports": [],
130129
"projectRootPath": "/root/teams/VSCode68/Shared Documents/General/jt-ts-test-workspace",
131130
"kind": "discover"
132131
}
133132
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
134133
TI:: [hh:mm:ss:mss] Explicitly included types: []
135-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
136134
TI:: [hh:mm:ss:mss] Finished typings discovery:
137135
{
138136
"cachedTypingPaths": [],
@@ -172,7 +170,6 @@ TI:: [hh:mm:ss:mss] Sending response:
172170
"maxNodeModuleJsDepth": 2
173171
},
174172
"typings": [],
175-
"unresolvedImports": [],
176173
"kind": "action::set"
177174
}
178175
Info seq [hh:mm:ss:mss] event:
@@ -196,7 +193,6 @@ Info seq [hh:mm:ss:mss] event:
196193
"maxNodeModuleJsDepth": 2
197194
},
198195
"typings": [],
199-
"unresolvedImports": [],
200196
"kind": "action::set"
201197
}
202198
}

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
@@ -338,13 +338,11 @@ TI:: [hh:mm:ss:mss] Got install request
338338
"include": [],
339339
"exclude": []
340340
},
341-
"unresolvedImports": [],
342341
"projectRootPath": "/",
343342
"kind": "discover"
344343
}
345344
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
346345
TI:: [hh:mm:ss:mss] Explicitly included types: []
347-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
348346
TI:: [hh:mm:ss:mss] Finished typings discovery:
349347
{
350348
"cachedTypingPaths": [],
@@ -384,7 +382,6 @@ TI:: [hh:mm:ss:mss] Sending response:
384382
"maxNodeModuleJsDepth": 2
385383
},
386384
"typings": [],
387-
"unresolvedImports": [],
388385
"kind": "action::set"
389386
}
390387
Info seq [hh:mm:ss:mss] event:
@@ -408,7 +405,6 @@ Info seq [hh:mm:ss:mss] event:
408405
"maxNodeModuleJsDepth": 2
409406
},
410407
"typings": [],
411-
"unresolvedImports": [],
412408
"kind": "action::set"
413409
}
414410
}

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
@@ -316,13 +316,11 @@ TI:: [hh:mm:ss:mss] Got install request
316316
"include": [],
317317
"exclude": []
318318
},
319-
"unresolvedImports": [],
320319
"projectRootPath": "/",
321320
"kind": "discover"
322321
}
323322
TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/typesMap.json'
324323
TI:: [hh:mm:ss:mss] Explicitly included types: []
325-
TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: []
326324
TI:: [hh:mm:ss:mss] Finished typings discovery:
327325
{
328326
"cachedTypingPaths": [],
@@ -361,7 +359,6 @@ TI:: [hh:mm:ss:mss] Sending response:
361359
"noEmitForJsFiles": true
362360
},
363361
"typings": [],
364-
"unresolvedImports": [],
365362
"kind": "action::set"
366363
}
367364
Info seq [hh:mm:ss:mss] event:
@@ -384,7 +381,6 @@ Info seq [hh:mm:ss:mss] event:
384381
"noEmitForJsFiles": true
385382
},
386383
"typings": [],
387-
"unresolvedImports": [],
388384
"kind": "action::set"
389385
}
390386
}

0 commit comments

Comments
 (0)