Microsoft/TypeScript

Return namespan on default exports

Open

#48,675 创建于 2022年4月13日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (6,726 fork)batch import
Experience EnhancementHelp WantedSuggestion

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

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

贡献者指南