From 9f193fc4585bbda4281455773fa36663ad84c79e Mon Sep 17 00:00:00 2001 From: ccagml Date: Tue, 18 Jul 2023 12:39:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8C=BA=E5=9F=9F=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E5=8F=82=E6=95=B0=E5=90=8E=E5=B0=9D=E8=AF=95=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=8F=91=E8=B5=B7=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/controller/DebugController.ts | 23 ++++++++++++++++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce634ae..d359e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## version 2.19.11 + +- 生成区域调试参数后尝试直接发起调试 + ## version 2.19.10 - workspaceFolder 可以尝试从环境变量中读取数据 diff --git a/package.json b/package.json index 3bb8d30..23a9f2d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/controller/DebugController.ts b/src/controller/DebugController.ts index 479b012..8d65716 100644 --- a/src/controller/DebugController.ts +++ b/src/controller/DebugController.ts @@ -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"; @@ -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(); + }); } } } @@ -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;