TypeScript/tests/baselines/reference/quickInfoDisplayPartsClassDefaultAnonymous.baseline
Andrew Casey 792e6d652a
Fix symbol display exception when handling incomplete class (#44936)
When a class declaration lacks a name, don't throw an exception when
producing the display parts (e.g. for QuickInfo).

Remaining issues:
 1. The name shows as "__missing", the name of the underlying symbol,
    rather than "(Missing)", as it is for the corresponding function
    declaration case (because the parse constructs a missing identifier
    node for the function declaration).
 2. "(Missing)" is hard-coded, rather than being a localizable resource
    string.
 3. When an anonymous class declaration is a default export, the
    corresponding symbol is named "default", resulting in the confusing
    display string "class default".

Since display parts are built using existing `symbolToString`
functionality, it wasn't clear whether detecting special symbol names
and replacing them with user-friendly strings could be done without
breaking other functionality.

Similarly, changing the shape of the parse tree seemed riskier than the
problem justified (the user experience is just not getting QuickInfo for
the incomplete declaration, which seems acceptable).
2021-08-06 15:05:54 -07:00

76 lines
1.5 KiB
Plaintext

[
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultAnonymous.ts",
"position": 0,
"name": "1"
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultAnonymous.ts",
"position": 7,
"name": "2"
},
"quickInfo": {
"kind": "class",
"kindModifiers": "export",
"textSpan": {
"start": 7,
"length": 7
},
"displayParts": [
{
"text": "class",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "default",
"kind": "className"
}
],
"documentation": []
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultAnonymous.ts",
"position": 15,
"name": "3"
},
"quickInfo": {
"kind": "class",
"kindModifiers": "export",
"textSpan": {
"start": 15,
"length": 5
},
"displayParts": [
{
"text": "class",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "default",
"kind": "className"
}
],
"documentation": []
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultAnonymous.ts",
"position": 21,
"name": "4"
}
}
]