Microsoft/TypeScript

Return namespan on default exports

Open

#48 675 ouverte le 13 avr. 2022

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)TypeScript (6 726 forks)batch import
Experience EnhancementHelp WantedSuggestion

Métriques du dépôt

Stars
 (48 455 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (9 PRs mergées en 30 j)

Description

Bug Report

🔎 Search Terms

  • navTree
  • Outline
  • nameSpan

🕗 Version & Regression Information

4.7-beta

Not a regression

Related issues

  • #48674

💻 Code

For the code:

// index.ts
import bla from './index'

export default 123;
  1. Look at the navtree response for the document and look at the entry for the export

🙁 Actual behavior

The entry for the default export does not set a nameSpan:

[Trace  - 19:20:39.65] <syntax> Response received: getOutliningSpans (346). Request took 1 ms. Success: true 
Result: []
[Trace  - 19:20:39.117] <syntax> Sending request: navtree (347). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/index.ts"
}
[Trace  - 19:20:39.118] <syntax> Response received: navtree (347). Request took 1 ms. Success: true 
Result: {
    "text": "\"index\"",
    "kind": "module",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 4,
                "offset": 21
            }
        }
    ],
    "childItems": [
        {
            "text": "default",
            "kind": "const",
            "kindModifiers": "export",
            "spans": [
                {
                    "start": {
                        "line": 4,
                        "offset": 1
                    },
                    "end": {
                        "line": 4,
                        "offset": 20
                    }
                }
            ]
        },
        {
            "text": "bla",
            "kind": "alias",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 2,
                        "offset": 8
                    },
                    "end": {
                        "line": 2,
                        "offset": 11
                    }
                }
            ],
            "nameSpan": {
                "start": {
                    "line": 2,
                    "offset": 8
                },
                "end": {
                    "line": 2,
                    "offset": 11
                }
            }
        }
    ]
}

🙂 Expected behavior

On the default export, a namespan is set for the span of default

This is something VS Code computes itself today. It helps us implement the references code lens

Guide contributeur