gpt4 book ai didi

visual-studio-code - 如何自定义 vscode 的差异编辑器显示以忽略某些差异?

转载 作者:行者123 更新时间:2023-12-05 07:20:03 25 4
gpt4 key购买 nike

在我的 vscode 扩展中,我想比较差异编辑器中的预期测试结果和实际测试结果。预期结果 yaml 文件包含动态替换的表达式,在并排编辑器中我想控制突出显示哪些差异。

预期:

   request:
url: '${baseUrl}/movies/${id}'
method: GET
#...

实际:

  request:
url: 'http://localhost/api/movies/435b30ad' # (diff should be ignored)
method: GET
#...

有没有一种直接的方法可以让我自己提供差异?

目前,在打开 diff 编辑器后,我正在像这样应用装饰:

    async diffResults(expected: vscode.Uri, actual: vscode.Uri) {
await vscode.commands.executeCommand('vscode.diff', expected, actual);
const expectedEditor = await this.findEditor(expected);
if (expectedEditor) {
this.decorator.applyDecorations(expectedEditor);
}
const actualEditor = await this.findEditor(actual);
if (actualEditor) {
this.decorator.applyDecorations(actualEditor);
}
}

但是,我的装饰覆盖在默认差异装饰之上,而不是取代它们。此外,我觉得装饰器方法不是处理这个问题的正确方法。如果可能的话,我想自己向编辑器提供实际的差异,并让 vscode 处理装饰。

最佳答案

我相信不是,唯一可能的定制是列出的 diffEditor 设置 here .

关于visual-studio-code - 如何自定义 vscode 的差异编辑器显示以忽略某些差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57641075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com