gpt4 book ai didi

visual-studio-code - 如何在 vscode 扩展中监听调试适配器协议(protocol)事件?

转载 作者:行者123 更新时间:2023-12-05 04:55:09 28 4
gpt4 key购买 nike

我知道我可以使用 vscode.debug.activeDebugSession?.customRequest(command) 向调试适配器发送自定义请求。但是,如果我想监听诸如 Stopped Event 之类的事件怎么办? ?

最佳答案

对于自定义事件,使用这个:

vscode.debug.onDidReceiveDebugSessionCustomEvent(event => {
if(event.event == 'stopped') {
// ...
}
})

对于 vscode 拦截的事件,您可能需要检查 this answer相反:

The solution for this is called a DebugAdapterTracker.

vscode.debug.registerDebugAdapterTrackerFactory('*', {
createDebugAdapterTracker(session: DebugSession) {
return {
onWillReceiveMessage: m => console.log(`> ${JSON.stringify(m, undefined, 2)}`),
onDidSendMessage: m => console.log(`< ${JSON.stringify(m, undefined, 2)}`)
};
}
});

https://code.visualstudio.com/updates/v1_30#_extension-authoring

Look for "Finalized Debug Adapter Tracker API". It was originallycreated for Live Share debugging.

关于visual-studio-code - 如何在 vscode 扩展中监听调试适配器协议(protocol)事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65543150/

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