@@ -11,7 +11,7 @@ import * as lodash from "lodash";
11
11
import * as path from "path" ;
12
12
import * as vscode from "vscode" ;
13
13
import { toNumber } from "lodash" ;
14
- import { Disposable , Uri , window } from "vscode" ;
14
+ import { Disposable , Uri , window , workspace , ConfigurationChangeEvent } from "vscode" ;
15
15
import {
16
16
SearchNode ,
17
17
userContestRankingObj ,
@@ -78,7 +78,16 @@ class TreeViewController implements Disposable {
78
78
private searchSet : Map < string , ISearchSet > = new Map < string , ISearchSet > ( ) ;
79
79
private waitTodayQuestion : boolean ;
80
80
private waitUserContest : boolean ;
81
+ private configurationChangeListener : Disposable ;
81
82
83
+ constructor ( ) {
84
+ this . configurationChangeListener = workspace . onDidChangeConfiguration ( ( event : ConfigurationChangeEvent ) => {
85
+ if ( event . affectsConfiguration ( "leetcode-problem-rating.hideScore" ) ) {
86
+ treeDataService . refresh ( ) ;
87
+ bricksDataService . refresh ( ) ;
88
+ }
89
+ } , this ) ;
90
+ }
82
91
// 获取当前文件的路径
83
92
/**
84
93
* It returns the path of the currently active file, or undefined if there is no active file
@@ -996,7 +1005,7 @@ class TreeViewController implements Disposable {
996
1005
}
997
1006
998
1007
public async resolveTagForProblem ( problem : IProblem ) : Promise < string | undefined > {
999
- let path_en_tags = treeDataService . getTagsDataEn ( problem . id )
1008
+ let path_en_tags = treeDataService . getTagsDataEn ( problem . id ) ;
1000
1009
if ( path_en_tags . length === 1 ) {
1001
1010
return path_en_tags [ 0 ] ;
1002
1011
}
@@ -1078,7 +1087,7 @@ class TreeViewController implements Disposable {
1078
1087
const temp_searchSet : Map < string , ISearchSet > = this . searchSet ;
1079
1088
const temp_waitTodayQuestion : boolean = this . waitTodayQuestion ;
1080
1089
const temp_waitUserContest : boolean = this . waitUserContest ;
1081
- this . dispose ( ) ;
1090
+ this . clearCache ( ) ;
1082
1091
let user_score = statusBarService . getUserContestScore ( ) ;
1083
1092
for ( const problem of await this . getAllProblems ( ) ) {
1084
1093
this . explorerNodeMap . set ( problem . id , new NodeModel ( problem , true , user_score ) ) ;
@@ -1492,14 +1501,19 @@ class TreeViewController implements Disposable {
1492
1501
return this . applySortingStrategy ( res ) ;
1493
1502
}
1494
1503
1495
- public dispose ( ) : void {
1504
+ public clearCache ( ) : void {
1496
1505
this . explorerNodeMap . clear ( ) ;
1497
1506
this . companySet . clear ( ) ;
1498
1507
this . tagSet . clear ( ) ;
1499
1508
this . fidToQid . clear ( ) ;
1500
1509
this . qidToFid . clear ( ) ;
1501
1510
}
1502
1511
1512
+ public dispose ( ) : void {
1513
+ this . configurationChangeListener . dispose ( ) ;
1514
+ this . clearCache ( ) ;
1515
+ }
1516
+
1503
1517
private sortSubCategoryNodes ( subCategoryNodes : NodeModel [ ] , category : Category ) : void {
1504
1518
switch ( category ) {
1505
1519
case Category . Difficulty :
0 commit comments