Skip to content

navtree does not include methods of class defined in a property #33715

Description

@mjbvz

From microsoft/vscode#81755

TypeScript Version: 3.7.0-dev.20191001

Search Terms:

  • class property
  • method
  • navtree
  • tsserver

Code

For the JavaScript

class A {
    A2 = class A2 {
        method() { return 1; }
    };
};

Get the server to make a navtree request

Bug
The sub properties of A2 such as method are not included:

[Trace  - 1:57:06 PM] <syntax> Response received: navtree (269). Request took 2 ms. Success: true 
Result: {
    "text": "<global>",
    "kind": "script",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 7,
                "offset": 2
            }
        }
    ],
    "childItems": [
        {
            "text": "A",
            "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": "A2",
                    "kind": "property",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 2,
                                "offset": 5
                            },
                            "end": {
                                "line": 4,
                                "offset": 7
                            }
                        }
                    ],
                    "nameSpan": {
                        "start": {
                            "line": 2,
                            "offset": 5
                        },
                        "end": {
                            "line": 2,
                            "offset": 7
                        }
                    }
                }
            ]
        }
    ]
}

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: LS: OutliningRelates to multi-line regions that editors can collapseExperience EnhancementNoncontroversial enhancementsSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions