clear highlight after reopen

This commit is contained in:
lyyyuna 2020-08-17 17:11:06 +08:00
parent 8a1592c6a3
commit 247a9df679

View File

@ -15,6 +15,7 @@ export class GocServer {
color: 'white' color: 'white'
});; });;
private lastProfile = ''; private lastProfile = '';
private lastFileNeedsRender = '';
construct() { } construct() { }
@ -30,16 +31,14 @@ export class GocServer {
this.getConfigurations(); this.getConfigurations();
let profile = await this.getLatestProfile(); let profile = await this.getLatestProfile();
if (profile == this.lastProfile) {
continue;
}
this.lastProfile = profile;
this.renderFile(packages, profile); this.renderFile(packages, profile);
} }
} }
stopQueryLoop() { stopQueryLoop() {
this.timer = false; this.timer = false;
this.lastProfile = '';
this.lastFileNeedsRender = '';
this.clearHightlight() this.clearHightlight()
} }
@ -91,7 +90,14 @@ export class GocServer {
renderFile(packages: Array<any>, profile: string) { renderFile(packages: Array<any>, profile: string) {
let activeTextEditor = vscode.window.activeTextEditor; let activeTextEditor = vscode.window.activeTextEditor;
let fileNeedsRender = activeTextEditor?.document.fileName; let fileNeedsRender = activeTextEditor?.document.fileName || '---';
// check if needs to rerender
if (profile == this.lastProfile && fileNeedsRender == this.lastFileNeedsRender) {
return;
}
this.lastProfile = profile;
this.lastFileNeedsRender = fileNeedsRender;
for (let i=0; i<packages.length; i++) { for (let i=0; i<packages.length; i++) {
let p = packages[i]; let p = packages[i];