[Feature] React Native debug configuration completion inserts an extra comma after comments in launch.json
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react-native, typescript, vscode
- 领域
- devtools
调研方向
先阅读 LaunchJsonCompletionHelper.isCommaImmediatelyBeforeCursor() 和 issue 中提到的现有 JSONC 扫描器;检查附近有关在注释周围插入补全内容的测试。使用提供的 launch.json 重现这些步骤,然后确认新配置插入时没有多余的逗号,并且文档仍是有效的 JSONC。
由索引模型根据 Issue 内容生成。
描述
Description
Accepting the React Native completion item in launch.json and completing the configuration wizard can insert an extra comma when a comment separates the cursor from an existing comma.
This turns an otherwise valid launch.json into invalid JSONC.
Steps to Reproduce
-
Open a React Native project in VS Code with React Native Tools enabled.
-
Set
.vscode/launch.jsonto the following:{ "version": "0.2.0", "configurations": [ { "name": "Debug Android Hermes", "request": "launch", "type": "reactnativedirect", "cwd": "${workspaceFolder}", "platform": "android" }, // Add another debug configuration here ] } -
Place the cursor on the blank line immediately below the comment, inside the
configurationsarray. -
Open the Command Palette and run Trigger Suggest.
-
Select the React Native completion item.
-
Complete the extension's configuration wizard.
-
Inspect the inserted configuration.
Note: Use Trigger Suggest → React Native, not the Add Configuration… button. In the tested case, the button relocates the insertion point and does not reproduce this issue.
Expected Behavior
The extension should recognize the existing comma after the preceding configuration and insert the new configuration without adding another comma.
},
// Add another debug configuration here
{
"name": "..."
}
The document should remain valid JSONC.
Actual Behavior
An additional comma is inserted before the new configuration:
},
// Add another debug configuration here
,{
"name": "..."
}
There are now two commas between the configuration objects, separated by a comment, making the document invalid.
Possible Cause
LaunchJsonCompletionHelper.isCommaImmediatelyBeforeCursor() checks preceding lines using trim().endsWith(",") and stops at the first non-empty line.
It does not skip comments to identify the preceding significant JSON token. It also treats a comma at the end of a comment as an actual JSON comma.
Using the existing JSONC scanner to ignore comments and whitespace when identifying the preceding token may address both cases.
- 主要语言
- TypeScript
- 星标
- 2.7k
- 派生
- 303
- 平均合并
- 20 小时 33 分钟
- 30 天内合并 PR
- 33
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/vscode-react-native 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/vscode-react-native#3055 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 67/100
microsoft/vscode-react-native#3053 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/vscode-react-native#3037 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 67/100
microsoft/vscode-react-native#3036 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 83/100
microsoft/vscode-react-native#3033 ·
维护者通常 1 天内回复
查看 microsoft/vscode-react-native 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/durable-harness#53 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
area/docs area/ui enhancement
难度 1/5 1-3 小时 新手友好度 88/100
melgarafael/DeskcommCRM#4098 ·
维护者通常 1 天内回复
-
bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 86/100
kerti/balances-v2#801 ·
维护者通常 1 天内回复
-
lesson-submission pending-review
难度 1/5 1 小时以内 新手友好度 84/100
Ikalus1988/MisakaNet#4510 ·
维护者通常 1 天内回复