-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Warning: parse 'launch.json' error! #252
Comments
由于用的 js 内置解析器,不支持带有注释的 json,后面会修复的 |
刚刚看了一下,现在的版本已经是用的 jsonc 了 你的 json 存在问题 两个数组内的最后一项有多余的
|
好的,但似乎 vscode api 使用的 jsonc-parser 没有这个问题?因为 vscode api 自己也有一个方法读取 launch.json,这个文件是能正常读取的 |
https://github.com/onury/jsonc/blob/adc4a7a801e73bc13a89e911e05d8f409ac5d4c8/lib/jsonc.js#L219-L223
|
applyEdits 适合用来配合 vscode 的编辑器 api 来修改指定位置的内容, applyEdits 用来合并有改动的部分, export function applyEdits(text: string, edits: EditResult): string;
export type EditResult = Edit[];
export interface Edit {
/**
* The start offset of the modification.
*/
offset: number;
/**
* The length of the modification. Must not be negative. Empty length represents an *insert*.
*/
length: number;
/**
* The new content. Empty content represents a *remove*.
*/
content: string;
} 插件需要修改 json 对象内容,如果要在带有注释的基础上,再生成正确的 EditResult,太复杂 这样一通操作下来,目的仅仅是为了保留 json 中的注释 这个 DebugConfigurationGenerator 在早先用于生成默认的调试配置模板,
后面可能加入设置项来做一个开关,可以选择 启用 或 禁用 该功能,这样就不会影响到自己纯手写的配置 |
那么,可以考虑忽略掉注释,把 |
好的,既然它会生成这些参数,后面会逐渐替换到 jsonc-parser 的 |
使用 EIDE 打开已有项目时,出现一个警告:
这是项目文件夹内
.vscode/launch.json
的内容:The text was updated successfully, but these errors were encountered: