Skip to content

Commit 1fc5697

Browse files
authored
Merge pull request #233 from ccagml/main
生成区域调试参数后尝试直接发起调试
2 parents cc75d5d + 9f193fc commit 1fc5697

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## version 2.19.11
2+
3+
- 生成区域调试参数后尝试直接发起调试
4+
15
## version 2.19.10
26

37
- workspaceFolder 可以尝试从环境变量中读取数据

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-leetcode-problem-rating",
33
"displayName": "LeetCode",
44
"description": "%main.description%",
5-
"version": "2.19.10",
5+
"version": "2.19.11",
66
"author": "ccagml",
77
"publisher": "ccagml",
88
"license": "MIT",

src/controller/DebugController.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2023 ccagml . All rights reserved
88
*/
99

10-
import { TextDocument, window, Range, Position } from "vscode";
10+
import { TextDocument, window, Range, Position, workspace } from "vscode";
1111
import { getTextEditorFilePathByUri } from "../utils/SystemUtils";
1212
import * as fs from "fs";
1313
import { fileMeta, ProblemMeta, supportDebugLanguages } from "../utils/problemUtils";
@@ -187,9 +187,13 @@ class DebugContorller {
187187

188188
if (lineContent.indexOf("@lc code=end") >= 0) {
189189
const editor = window.activeTextEditor;
190-
editor?.edit((edit) => {
191-
edit.insert(new Position(i + 1, i + 1), div_debug_arg.join("\n"));
192-
});
190+
await editor
191+
?.edit((edit) => {
192+
edit.insert(new Position(i + 1, i + 1), div_debug_arg.join("\n"));
193+
})
194+
.then(() => {
195+
editor.document.save();
196+
});
193197
}
194198
}
195199
}
@@ -207,7 +211,16 @@ class DebugContorller {
207211
// window.showErrorMessage("这题还不能debug,请尝试配置区域调试参数,麻烦提issuse");
208212
// 判断生成测试区块
209213
await this.check_create_debug_area(meta, document);
210-
return;
214+
215+
try {
216+
document = await workspace.openTextDocument(document.uri);
217+
} catch (error) {
218+
return;
219+
}
220+
221+
if (!this.canDebug(meta, document)) {
222+
return;
223+
}
211224
}
212225
let result: any;
213226

0 commit comments

Comments
 (0)