Skip to content

Commit eb76760

Browse files
committed
update
1 parent e086c6e commit eb76760

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## version 2.11.12
2+
3+
- 提交通过结果显示耗时
4+
15
## version 2.11.11
26

37
- BWC95 & WC327 数据

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-leetcode-problem-rating",
33
"displayName": "LeetCode",
44
"description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了",
5-
"version": "2.11.11",
5+
"version": "2.11.12",
66
"author": "ccagml",
77
"publisher": "ccagml",
88
"license": "MIT",

src/service/SubmissionService.ts

+11
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ import { ISubmitEvent } from "../model/Model";
1414
import { IWebViewOption } from "../model/Model";
1515
import { promptHintMessage } from "../utils/OutputUtils";
1616
import { isAnswerDiffColor } from "../utils/ConfigUtils";
17+
import { statusBarTimeService } from "../service/StatusBarTimeService";
1718
class SubmissionService extends BaseWebViewService {
1819
protected readonly viewType: string = "leetcode.submission";
1920
private result: IResult;
2021

2122
public show(resultString: string): void {
2223
this.result = this.parseResult(resultString);
24+
25+
const temp = this.getSubmitEvent();
26+
if (temp?.accepted && temp?.sub_type == "submit") {
27+
this.result["costTime"] = [`耗时${statusBarTimeService.getCostTimeStr()}`];
28+
}
2329
this.showWebviewInternal();
2430
this.showKeybindingsHint();
2531
}
@@ -43,6 +49,8 @@ class SubmissionService extends BaseWebViewService {
4349
return false;
4450
} else if (key == "system_message") {
4551
return false;
52+
} else if (key == "costTime") {
53+
return false;
4654
}
4755
return true;
4856
}
@@ -68,6 +76,9 @@ class SubmissionService extends BaseWebViewService {
6876
protected getWebviewContent(): string {
6977
const styles: string = markdownService.getStyles();
7078
const title: string = `## ${this.result.messages[0]}`;
79+
if (this.result?.costTime && this.result?.costTime.length > 0) {
80+
this.result.messages.push(this.result?.costTime[0]);
81+
}
7182
const messages: string[] = this.result.messages.slice(1).map((m: string) => `* ${m}`);
7283
let sections: string[] = [];
7384
if (isAnswerDiffColor()) {

0 commit comments

Comments
 (0)