@@ -14,12 +14,18 @@ import { ISubmitEvent } from "../model/Model";
14
14
import { IWebViewOption } from "../model/Model" ;
15
15
import { promptHintMessage } from "../utils/OutputUtils" ;
16
16
import { isAnswerDiffColor } from "../utils/ConfigUtils" ;
17
+ import { statusBarTimeService } from "../service/StatusBarTimeService" ;
17
18
class SubmissionService extends BaseWebViewService {
18
19
protected readonly viewType : string = "leetcode.submission" ;
19
20
private result : IResult ;
20
21
21
22
public show ( resultString : string ) : void {
22
23
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
+ }
23
29
this . showWebviewInternal ( ) ;
24
30
this . showKeybindingsHint ( ) ;
25
31
}
@@ -43,6 +49,8 @@ class SubmissionService extends BaseWebViewService {
43
49
return false ;
44
50
} else if ( key == "system_message" ) {
45
51
return false ;
52
+ } else if ( key == "costTime" ) {
53
+ return false ;
46
54
}
47
55
return true ;
48
56
}
@@ -68,6 +76,9 @@ class SubmissionService extends BaseWebViewService {
68
76
protected getWebviewContent ( ) : string {
69
77
const styles : string = markdownService . getStyles ( ) ;
70
78
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
+ }
71
82
const messages : string [ ] = this . result . messages . slice ( 1 ) . map ( ( m : string ) => `* ${ m } ` ) ;
72
83
let sections : string [ ] = [ ] ;
73
84
if ( isAnswerDiffColor ( ) ) {
0 commit comments