Skip to content

生成区域调试参数后尝试直接发起调试 #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## version 2.19.11

- 生成区域调试参数后尝试直接发起调试

## version 2.19.10

- workspaceFolder 可以尝试从环境变量中读取数据
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-leetcode-problem-rating",
"displayName": "LeetCode",
"description": "%main.description%",
"version": "2.19.10",
"version": "2.19.11",
"author": "ccagml",
"publisher": "ccagml",
"license": "MIT",
Expand Down
23 changes: 18 additions & 5 deletions src/controller/DebugController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright (c) 2023 ccagml . All rights reserved
*/

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

if (lineContent.indexOf("@lc code=end") >= 0) {
const editor = window.activeTextEditor;
editor?.edit((edit) => {
edit.insert(new Position(i + 1, i + 1), div_debug_arg.join("\n"));
});
await editor
?.edit((edit) => {
edit.insert(new Position(i + 1, i + 1), div_debug_arg.join("\n"));
})
.then(() => {
editor.document.save();
});
}
}
}
Expand All @@ -207,7 +211,16 @@ class DebugContorller {
// window.showErrorMessage("这题还不能debug,请尝试配置区域调试参数,麻烦提issuse");
// 判断生成测试区块
await this.check_create_debug_area(meta, document);
return;

try {
document = await workspace.openTextDocument(document.uri);
} catch (error) {
return;
}

if (!this.canDebug(meta, document)) {
return;
}
}
let result: any;

Expand Down