- Notifications
You must be signed in to change notification settings - Fork 440
/
Copy pathtab-bars.ts
36 lines (32 loc) · 1.22 KB
/
tab-bars.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
importtype{TabBar}from'@theia/core/shared/@phosphor/widgets';
import{Saveable}from'@theia/core/lib/browser/saveable';
import{
TabBarRendererasTheiaTabBarRenderer,
ToolbarAwareTabBarasTheiaToolbarAwareTabBar,
}from'@theia/core/lib/browser/shell/tab-bars';
importdebouncefrom'lodash.debounce';
exportclassTabBarRendererextendsTheiaTabBarRenderer{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
overridecreateTabClass(data: TabBar.IRenderData<any>): string{
letclassName=super.createTabClass(data);
if(!data.title.closable&&Saveable.isDirty(data.title.owner)){
className+=' p-mod-closable';
}
returnclassName;
}
protectedoverridehandleContextMenuEvent=(): void=>{
// NOOP
// Context menus are empty, so they have been removed
};
}
exportclassToolbarAwareTabBarextendsTheiaToolbarAwareTabBar{
protectedoverrideasyncupdateBreadcrumbs(): Promise<void>{
// NOOP
// IDE2 does not use breadcrumbs.
}
privatereadonlydoUpdateToolbar=debounce(()=>super.updateToolbar(),500);
protectedoverrideupdateToolbar(): void{
// Unlike Theia, IDE2 debounces the toolbar updates with 500ms
this.doUpdateToolbar();
}
}