Skip to content

Outlining spans not return for jsdoc comment on arrow function #26014

@mjbvz

Description

@mjbvz

From microsoft/vscode#55249

TypeScript Version: typescript@3.1.0-dev.20180727

Search Terms:

  • outlining, fold, folding
  • comments

Code
For the js

/**
 * Return a sum
 * @param y {Number}
 * @param z {Number}
 * @returns {Number} the sum of y and z
 */
function sum1(y, z) {
    return y + z;
}

/** 
 * Return a sum
 * @param y {Number}
 * @param z {Number}
 * @returns {Number} the sum of y and z
 */
const sum2 = (y, z) => {
    return y + z;
};

Expected behavior:
An outlining span is returned for both jsdoc comments.

Actual behavior:
A folding span is only returned for the first comment

[Trace  - 11:26:30 AM] Response received: getOutliningSpans (36). Request took 3 ms. Success: true 
Result: [
    {
        "textSpan": {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 6,
                "offset": 4
            }
        },
        "hintSpan": {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 6,
                "offset": 4
            }
        },
        "bannerText": "...",
        "autoCollapse": false,
        "kind": "comment"
    },
    {
        "textSpan": {
            "start": {
                "line": 7,
                "offset": 20
            },
            "end": {
                "line": 9,
                "offset": 2
            }
        },
        "hintSpan": {
            "start": {
                "line": 7,
                "offset": 1
            },
            "end": {
                "line": 9,
                "offset": 2
            }
        },
        "bannerText": "...",
        "autoCollapse": true,
        "kind": "code"
    },
    {
        "textSpan": {
            "start": {
                "line": 17,
                "offset": 23
            },
            "end": {
                "line": 19,
                "offset": 2
            }
        },
        "hintSpan": {
            "start": {
                "line": 17,
                "offset": 14
            },
            "end": {
                "line": 19,
                "offset": 2
            }
        },
        "bannerText": "...",
        "autoCollapse": false,
        "kind": "code"
    }
]

Metadata

Metadata

Labels

CommittedThe team has roadmapped this issueDomain: LS: OutliningRelates to multi-line regions that editors can collapseSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions