答案错误时自动打断点
我添加的代码:
diff --git a/src/commands.ts b/src/commands.ts
index eb2edb4..bc1a4d0 100644
--- a/src/commands.ts
+++ b/src/commands.ts
@@ -29,6 +29,7 @@ export const debugHandler = async (file: string, name: string) => {
return;
}
const ok_binary = resolve(dirname(ok_config), "ok");
+
await vscode.debug.startDebugging(
vscode.workspace.getWorkspaceFolder(vscode.Uri.parse(file)),
{
@@ -40,6 +41,19 @@ export const debugHandler = async (file: string, name: string) => {
console: "integratedTerminal",
}
);
+ console.log(resolve(dirname(ok_config), "ok")+"/client/sources/common/interpreter.py");
+ vscode.debug.addBreakpoints([
+ new vscode.SourceBreakpoint(
+ new vscode.Location(
+ vscode.Uri.file(resolve(dirname(ok_config), "ok")+"/client/sources/common/interpreter.py"),
+ new vscode.Position(313,0) //0-based
+ ),
+ true,//enabled
+ "",//condition
+ "",//hitCondition
+ "",//logMessage
+ )
+ ]);
};
export const unlockHandler = async (file: string, name: string) => {
但是没用
最大的问题
就是,ok是个zip文件,而如何指定zip文件内部的文件呢?
为什么我认为可以直接把ok当成文件夹处理
这是某处弄出来的日志
0.00s - Process SetBreakpointsRequest: {
"arguments": {
"breakpoints": [
{
"line": 9
}
],
"lines": [
9
],
"source": {
"name": "six.py",
"path": "/Users/ken/Codes/SICP/hw07-Code/ok/urllib3/packages/six.py",
"sourceReference": 1
},
"sourceModified": false
},
"command": "setBreakpoints",
"seq": 8,
"type": "request"
}
我只记得是debugpy
的日志,通过设置export DEBUGPY_LOG_DIR=xxx
得到的日志(然后我再也没法再次得到这个日志了……不知道为啥)
这些都直接把ok当作了一个文件夹来处理。
我的代码运行状态
我加上的代码,确实加上了断点,而且开始debug之前都是正常状态,debug中又显示为文件不存在,debug完了以后又显示为正常
emmmm
啊,我也不知道怎么做了,剩下的就交给tygg来处理吧!
😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂
下面是那个我只得到了一次的日志 full-log