Skip to content

Commit ac6d6b7

Browse files
authored
1 parent 4a9ec29 commit ac6d6b7

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class EditorGroupWatermark extends Disposable {
6161

6262
private readonly shortcuts: HTMLElement;
6363
private transientDisposables = this._register(new DisposableStore());
64-
private enabled: boolean;
64+
private enabled: boolean = false;
6565
private workbenchState: WorkbenchState;
6666

6767
constructor(
@@ -83,39 +83,23 @@ export class EditorGroupWatermark extends Disposable {
8383
append(container, elements.root);
8484
this.shortcuts = elements.shortcuts;
8585

86-
this.workbenchState = contextService.getWorkbenchState();
87-
this.enabled = this.configurationService.getValue<boolean>('workbench.tips.enabled');
88-
8986
this.registerListeners();
9087

91-
if (this.enabled) {
92-
this.render();
93-
}
88+
this.workbenchState = contextService.getWorkbenchState();
89+
this.render();
9490
}
9591

9692
private registerListeners(): void {
9793
this.lifecycleService.onDidShutdown(() => this.dispose());
9894

9995
this._register(this.configurationService.onDidChangeConfiguration(e => {
10096
if (e.affectsConfiguration('workbench.tips.enabled')) {
101-
const enabled = this.configurationService.getValue<boolean>('workbench.tips.enabled');
102-
103-
if (enabled === this.enabled) {
104-
return;
105-
}
106-
107-
this.enabled = enabled;
108-
109-
if (this.enabled) {
110-
this.render();
111-
} else {
112-
this.clear();
113-
}
97+
this.render();
11498
}
11599
}));
116100

117101
this._register(this.contextService.onDidChangeWorkbenchState(workbenchState => {
118-
if (!this.enabled || this.workbenchState === workbenchState) {
102+
if (this.workbenchState === workbenchState) {
119103
return;
120104
}
121105

@@ -134,8 +118,19 @@ export class EditorGroupWatermark extends Disposable {
134118
}
135119

136120
private render(): void {
121+
const enabled = this.configurationService.getValue<boolean>('workbench.tips.enabled');
122+
123+
if (enabled === this.enabled) {
124+
return;
125+
}
126+
127+
this.enabled = enabled;
137128
this.clear();
138129

130+
if (!enabled) {
131+
return;
132+
}
133+
139134
const box = append(this.shortcuts, $('.watermark-box'));
140135
const folder = this.workbenchState !== WorkbenchState.EMPTY;
141136
const selected = (folder ? folderEntries : noFolderEntries)

0 commit comments

Comments
 (0)