在我的vscode扩展中,我希望在diff编辑器中比较预期测试结果和实际测试结果。预期结果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来处理这些装饰。
发布于 2022-01-27 10:53:45
我相信没有,唯一可能的定制是diffEditor设置列出的这里。
https://stackoverflow.com/questions/57641075
复制相似问题