microsoft / microsoft/TypeScript

[navtree] Only a single nameSpan listed for multiple declarations of interface

Open
#35,068 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: TSServer In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.7.2

Search Terms:

  • navtree
  • tsserver

Code
For the TypeScript:

interface IFoo2 {
    foo: any;
}

interface IFoo2 {
    foo2: any;
}
  1. Run a navTree request

Bug:
Two spans for IFoo2 are returned but there is only a single nameSpan

{
    "text": "<global>",
    "kind": "script",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 8,
                "offset": 2
            }
        }
    ],
    "childItems": [
        {
            "text": "IFoo2",
            "kind": "interface",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 1,
                        "offset": 1
                    },
                    "end": {
                        "line": 3,
                        "offset": 2
                    }
                },
                {
                    "start": {
                        "line": 5,
                        "offset": 1
                    },
                    "end": {
                        "line": 7,
                        "offset": 2
                    }
                }
            ],
            "nameSpan": {
                "start": {
                    "line": 1,
                    "offset": 11
                },
                "end": {
                    "line": 1,
                    "offset": 16
                }
            },
            ...
        }
    ]
}

For VS Code's tooling, we'd like to have a list of all namespans

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the TypeScript 3.7.2 navTree request using the two merged IFoo2 declarations shown in the report. Trace the navTree response generation and update it so each declaration's nameSpan is represented; done means the response contains both name spans and the existing spans remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.