diff --git a/CHANGELOG.md b/CHANGELOG.md index 7518538..25c6f07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## version 2.11.12 + +- 提交通过结果显示耗时 + ## version 2.11.11 - BWC95 & WC327 数据 diff --git a/package.json b/package.json index 0287b6b..d178dfd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-leetcode-problem-rating", "displayName": "LeetCode", "description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了", - "version": "2.11.11", + "version": "2.11.12", "author": "ccagml", "publisher": "ccagml", "license": "MIT", diff --git a/src/service/SubmissionService.ts b/src/service/SubmissionService.ts index 0f67d7e..cd0bf55 100644 --- a/src/service/SubmissionService.ts +++ b/src/service/SubmissionService.ts @@ -14,12 +14,18 @@ import { ISubmitEvent } from "../model/Model"; import { IWebViewOption } from "../model/Model"; import { promptHintMessage } from "../utils/OutputUtils"; import { isAnswerDiffColor } from "../utils/ConfigUtils"; +import { statusBarTimeService } from "../service/StatusBarTimeService"; class SubmissionService extends BaseWebViewService { protected readonly viewType: string = "leetcode.submission"; private result: IResult; public show(resultString: string): void { this.result = this.parseResult(resultString); + + const temp = this.getSubmitEvent(); + if (temp?.accepted && temp?.sub_type == "submit") { + this.result["costTime"] = [`耗时${statusBarTimeService.getCostTimeStr()}`]; + } this.showWebviewInternal(); this.showKeybindingsHint(); } @@ -43,6 +49,8 @@ class SubmissionService extends BaseWebViewService { return false; } else if (key == "system_message") { return false; + } else if (key == "costTime") { + return false; } return true; } @@ -68,6 +76,9 @@ class SubmissionService extends BaseWebViewService { protected getWebviewContent(): string { const styles: string = markdownService.getStyles(); const title: string = `## ${this.result.messages[0]}`; + if (this.result?.costTime && this.result?.costTime.length > 0) { + this.result.messages.push(this.result?.costTime[0]); + } const messages: string[] = this.result.messages.slice(1).map((m: string) => `* ${m}`); let sections: string[] = []; if (isAnswerDiffColor()) {