[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
- 分支
- 304
- 平均合併
- 23 小時 28 分鐘
- 30 天內合併 PR
- 35
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/vscode-react-native 的其他 Issue
-
[Feature] Android package resolver reads commented-out applicationId and causes debugging to fail未關閉enhancement
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/vscode-react-native#3068 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 65/100
microsoft/vscode-react-native#3065 ·
維護者通常 1 天內回覆
-
[Feature] Incorrect type validation in ConfigurationReader.readObject allows all value types to pass未關閉enhancement
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/vscode-react-native#3063 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 88/100
microsoft/vscode-react-native#3062 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/vscode-react-native#3055 ·
維護者通常 1 天內回覆
查看 microsoft/vscode-react-native 的全部 Issue
相似的 Issue
-
account bug communication lecture
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
area:tui bug platform:macos
難度 2/5 1-3 小時 新手友好度 68/100
anthropics/claude-code#109005 ·
-
難度 2/5 1-3 小時 新手友好度 87/100
openedx/end-to-end-tests#196 ·
維護者通常 1 天內回覆
-
area:tooling good first issue
難度 2/5 1-3 小時 新手友好度 68/100
interledger/publisher-tools#1007 ·
維護者通常 1 天內回覆
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
難度 2/5 1-3 小時 新手友好度 83/100
databrickslabs/ontos#1420 ·
維護者通常 3 天內回覆