microsoft / microsoft/TypeScript

Should the native TypeScript LSP include top-level imports in its `textDocument/documentSymbol` response?

未关闭
#64,155 1 条评论 1 个 reaction 已指派 2 人 已被 @jakebailey 认领 在 GitHub 查看
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### Acknowledgement

- [x] I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

### Comment

## Question

The existing VS Code TypeScript extension intentionally filters imports from
the Outline view. This behavior was introduced in:

- https://github.com/microsoft/vscode/issues/50829
- https://github.com/microsoft/vscode/commit/f1efd11c2a6da4533f65d66bf7921c552270ca4e

The native TypeScript LSP currently appears to include imports instead. For
example:

```ts
import DefaultComponent from './component';
import * as utils from './utils';
import { value, original as renamed } from './values';
import type { Options } from './types';
```

## Expected Behavior

I am not certain which behavior is intended. I would appreciate clarification
on whether:

1. The difference from the existing VS Code TypeScript extension is intentional.
2. The native LSP should preserve the established Outline behavior.

The LSP specification does not appear to describe whether imports should be
reported as document symbols, so this seems to be a language-server policy
decision.

## Motivation

Including imports can substantially clutter the Outline without providing much value in return. Knowing the intended behavior would help determine whether downstream servers and users should expect that behavior to cease when adopting TS 7.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。