Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Navtree - report function properties so that they can be identified as functionsΒ #25062

@mjbvz

Description

@mjbvz

microsoft/vscode#51988

TypeScript Version: 3.0.0-dev.20180616

Search Terms:

  • navtree
  • method, function, property

Code
For the code:

class K {
    p = 1
    f = () => {}
    m() {}
}

Run a navtree request

Expected behavior:
Some way to identify that f is a function

Actual behavior:
Both p and f are reported the same way, as properties.

Result: {
    "text": "<global>",
    "kind": "script",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 5,
                "offset": 3
            }
        }
    ],
    "childItems": [
        {
            "text": "K",
            "kind": "class",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 1,
                        "offset": 1
                    },
                    "end": {
                        "line": 5,
                        "offset": 2
                    }
                }
            ],
            "nameSpan": {
                "start": {
                    "line": 1,
                    "offset": 7
                },
                "end": {
                    "line": 1,
                    "offset": 8
                }
            },
            "childItems": [
                {
                    "text": "f",
                    "kind": "property",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 3,
                                "offset": 5
                            },
                            "end": {
                                "line": 3,
                                "offset": 17
                            }
                        }
                    ],
                    "nameSpan": {
                        "start": {
                            "line": 3,
                            "offset": 5
                        },
                        "end": {
                            "line": 3,
                            "offset": 6
                        }
                    }
                },
                {
                    "text": "m",
                    "kind": "method",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 4,
                                "offset": 5
                            },
                            "end": {
                                "line": 4,
                                "offset": 11
                            }
                        }
                    ],
                    "nameSpan": {
                        "start": {
                            "line": 4,
                            "offset": 5
                        },
                        "end": {
                            "line": 4,
                            "offset": 6
                        }
                    }
                },
                {
                    "text": "p",
                    "kind": "property",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 2,
                                "offset": 5
                            },
                            "end": {
                                "line": 2,
                                "offset": 10
                            }
                        }
                    ],
                    "nameSpan": {
                        "start": {
                            "line": 2,
                            "offset": 5
                        },
                        "end": {
                            "line": 2,
                            "offset": 6
                        }
                    }
                }
            ]
        }
    ]
}

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions