mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Handle the case where the FAR results map is empty (#49254)
* Handle the case where the FAR results map is empty Searching exactly one project does not imply the presence of exactly one references list. Fixes #49217 * Use emptyArray Co-authored-by: Sheetal Nandi <shkamat@microsoft.com> Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
This commit is contained in:
co-authored by
Sheetal Nandi
parent
77ffb96b1a
commit
84974838c7
@@ -575,8 +575,7 @@ namespace ts.server {
|
||||
// it easier for the caller to skip post-processing.
|
||||
if (searchedProjects.size === 1) {
|
||||
const it = resultsMap.values().next();
|
||||
Debug.assert(!it.done);
|
||||
return it.value;
|
||||
return it.done ? emptyArray : it.value; // There may not be any results at all
|
||||
}
|
||||
|
||||
return resultsMap;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"definition": {
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"fileName": "/tests/cases/fourslash/server/referencesToStringLiteralValue.ts",
|
||||
"kind": "var",
|
||||
"name": "some string",
|
||||
"textSpan": {
|
||||
"start": 19,
|
||||
"length": 12
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "\"some string\"",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
]
|
||||
},
|
||||
"references": []
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////const obj = {}/*1*/;
|
||||
|
||||
verify.baselineFindAllReferences('1');
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
/////*1*/
|
||||
|
||||
verify.baselineFindAllReferences('1');
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////const s: string = "some /*1*/ string";
|
||||
|
||||
verify.baselineFindAllReferences('1');
|
||||
Reference in New Issue
Block a user