microsoft / microsoft/TypeScript

Commit characters are not reset inside typescript object property key strings

未关闭
#62,161 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Strada (TS 6.0-) Language Service
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

Type: Bug

1. Create some interface type that has property keys defined
e.g.
```ts
type Fruit = 'apple' | 'banana';
type FruitCount = Record;
```
2. Create a variable that follows the type of that interface
e.g.
```ts
const someFruitCount: FruitCount = {
}
```
3. Start a new property key inside the object by typing `'` or `"`, then press a commit character, such as `.`, `;`, `(`, or `,`
4. Observe that vscode autocompletes the first suggestion inside the string.

This has been tested both in `vscode.dev` and `insiders.vscode.dev` without any extensions or configuration.

https://github.com/user-attachments/assets/a8657d94-12e3-4577-b8d4-9e0e7e8796f4

I'm happy to have a crack at fixing this bug, but I'm raising this as an issue to help visibility incase anybody else runs into this problem, or is already working on it.

VS Code version: Code 1.100.2 (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z)
OS version: Darwin arm64 24.4.0
Modes:

System Info

|Item|Value|
|---|---|
|CPUs|Apple M2 Pro (12 x 2400)|
|GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|8, 9, 7|
|Memory (System)|32.00GB (0.17GB free)|
|Process Argv|--crash-reporter-id b7d695b5-942d-4f66-81de-65c24dc54397|
|Screen Reader|no|
|VM|0%|
Extensions (39)

Extension|Author (truncated)|Version
---|---|---
Bookmarks|ale|13.5.0
vscode-monorepo-explorer|atl|0.5.1
atlascode|atl|3.8.2
cde-vscode-local-extension|atl|1.1.372
vscode-atlassian-tsserver|atl|0.0.1
Nix|bbe|1.0.1
path-intellisense|chr|2.10.0
vscode-eslint|dba|3.0.10
vscode-axe-linter|deq|4.10.7
docker|doc|0.7.0
es7-react-js-snippets|dsz|4.4.3
gitlens|eam|17.1.1
EditorConfig|Edi|0.17.3
prettier-vscode|esb|11.0.0
auto-rename-tag|for|0.1.10
copilot|Git|1.326.0
copilot-chat|Git|0.27.2
vscode-graphql-syntax|Gra|1.3.8
git-graph|mhu|1.30.0
vscode-containers|ms-|2.0.2
vscode-docker|ms-|2.0.0
debugpy|ms-|2025.8.0
python|ms-|2025.6.1
vscode-pylance|ms-|2025.5.1
remote-containers|ms-|0.413.0
remote-ssh|ms-|0.113.1
remote-ssh-edit|ms-|0.87.0
copilot-mermaid-diagram|ms-|0.0.3
remote-explorer|ms-|0.5.0
vscode-websearchforcopilot|ms-|0.1.2
abracadabra|nic|9.7.0
prisma|Pri|6.8.2
vscode-yaml|red|1.18.0
code-spell-checker|str|4.0.47
vscode-styled-components|sty|1.7.8
vscode-stylelint|sty|1.5.0
vscode-icons|vsc|12.13.0
pretty-ts-errors|Yoa|0.6.1
vscode-tsserver-trace|ypr|0.0.1

(1 theme extensions excluded)

A/B Experiments

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
pythonrstrctxt:31112756
nativeloc1:31192215
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
pylancecolor:31314202
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

```

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 TypeScript 示例和列出的 commit 字符,在 vscode.dev 或 insiders.vscode.dev 中复现该行为。首先跟踪带引号的对象属性键的 completion 行为,然后验证提交建议时不再将第一个 completion 插入字符串内部。使用报告中的 interface 和 Record 示例确认 fix。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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