@theia/core 1.78.0-next.0 → 1.78.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/catalog.json +247 -32
- package/lib/browser/encoding-registry.js +1 -1
- package/lib/browser/encoding-registry.js.map +1 -1
- package/lib/browser/encoding-registry.spec.d.ts +2 -0
- package/lib/browser/encoding-registry.spec.d.ts.map +1 -0
- package/lib/browser/encoding-registry.spec.js +43 -0
- package/lib/browser/encoding-registry.spec.js.map +1 -0
- package/lib/browser/messaging/service-connection-provider.d.ts.map +1 -1
- package/lib/browser/messaging/service-connection-provider.js +9 -1
- package/lib/browser/messaging/service-connection-provider.js.map +1 -1
- package/lib/browser/messaging/service-connection-provider.spec.d.ts +2 -0
- package/lib/browser/messaging/service-connection-provider.spec.d.ts.map +1 -0
- package/lib/browser/messaging/service-connection-provider.spec.js +76 -0
- package/lib/browser/messaging/service-connection-provider.spec.js.map +1 -0
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +13 -1
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/tab-bars.d.ts +78 -1
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +267 -18
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/shell/tab-bars.spec.js +401 -1
- package/lib/browser/shell/tab-bars.spec.js.map +1 -1
- package/lib/browser/widgets/widget.d.ts.map +1 -1
- package/lib/browser/widgets/widget.js +34 -1
- package/lib/browser/widgets/widget.js.map +1 -1
- package/lib/common/core-preferences.d.ts +2 -0
- package/lib/common/core-preferences.d.ts.map +1 -1
- package/lib/common/core-preferences.js +21 -1
- package/lib/common/core-preferences.js.map +1 -1
- package/lib/common/messaging/handler.d.ts +11 -0
- package/lib/common/messaging/handler.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.d.ts +8 -1
- package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.js +4 -2
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/messaging/proxy-factory.spec.js +16 -1
- package/lib/common/messaging/proxy-factory.spec.js.map +1 -1
- package/lib/common/messaging/socket-write-buffer.d.ts +8 -2
- package/lib/common/messaging/socket-write-buffer.d.ts.map +1 -1
- package/lib/common/messaging/socket-write-buffer.js +18 -12
- package/lib/common/messaging/socket-write-buffer.js.map +1 -1
- package/lib/common/messaging/socket-write-buffer.spec.d.ts +2 -0
- package/lib/common/messaging/socket-write-buffer.spec.d.ts.map +1 -0
- package/lib/common/messaging/socket-write-buffer.spec.js +72 -0
- package/lib/common/messaging/socket-write-buffer.spec.js.map +1 -0
- package/lib/common/shell-environment.d.ts +61 -0
- package/lib/common/shell-environment.d.ts.map +1 -0
- package/lib/common/shell-environment.js +29 -0
- package/lib/common/shell-environment.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.d.ts +20 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.js +72 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.d.ts +2 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.js +86 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.d.ts +4 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.js +26 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.js.map +1 -0
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +12 -4
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.d.ts.map +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.js +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.js.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.d.ts +4 -1
- package/lib/electron-node/request/electron-backend-request-service.d.ts.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.js +56 -13
- package/lib/electron-node/request/electron-backend-request-service.js.map +1 -1
- package/lib/node/backend-application-module.d.ts.map +1 -1
- package/lib/node/backend-application-module.js +13 -5
- package/lib/node/backend-application-module.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.d.ts +13 -3
- package/lib/node/env-variables/env-variables-server.d.ts.map +1 -1
- package/lib/node/env-variables/env-variables-server.js +21 -14
- package/lib/node/env-variables/env-variables-server.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.spec.d.ts +2 -0
- package/lib/node/env-variables/env-variables-server.spec.d.ts.map +1 -0
- package/lib/node/env-variables/env-variables-server.spec.js +83 -0
- package/lib/node/env-variables/env-variables-server.spec.js.map +1 -0
- package/lib/node/i18n/i18n-backend-module.js +2 -2
- package/lib/node/i18n/i18n-backend-module.js.map +1 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/logger-backend-module.js +1 -1
- package/lib/node/logger-backend-module.js.map +1 -1
- package/lib/node/messaging/connection-container-module.d.ts +11 -2
- package/lib/node/messaging/connection-container-module.d.ts.map +1 -1
- package/lib/node/messaging/connection-container-module.js +13 -2
- package/lib/node/messaging/connection-container-module.js.map +1 -1
- package/lib/node/messaging/connection-container-module.spec.d.ts +2 -0
- package/lib/node/messaging/connection-container-module.spec.d.ts.map +1 -0
- package/lib/node/messaging/connection-container-module.spec.js +37 -0
- package/lib/node/messaging/connection-container-module.spec.js.map +1 -0
- package/lib/node/messaging/default-messaging-service.d.ts +33 -4
- package/lib/node/messaging/default-messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/default-messaging-service.js +52 -10
- package/lib/node/messaging/default-messaging-service.js.map +1 -1
- package/lib/node/messaging/gated-channel-multiplexer.d.ts +20 -0
- package/lib/node/messaging/gated-channel-multiplexer.d.ts.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.js +50 -0
- package/lib/node/messaging/gated-channel-multiplexer.js.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.d.ts +2 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.d.ts.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.js +74 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.js.map +1 -0
- package/lib/node/messaging/index.d.ts +1 -0
- package/lib/node/messaging/index.d.ts.map +1 -1
- package/lib/node/messaging/index.js +1 -0
- package/lib/node/messaging/index.js.map +1 -1
- package/lib/node/messaging/messaging-backend-module.js +1 -1
- package/lib/node/messaging/messaging-backend-module.js.map +1 -1
- package/lib/node/messaging/messaging-service.d.ts +5 -1
- package/lib/node/messaging/messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/messaging-service.js.map +1 -1
- package/lib/node/messaging/test/default-messaging-service.spec.js +82 -2
- package/lib/node/messaging/test/default-messaging-service.spec.js.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts +1 -0
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.js +8 -0
- package/lib/node/messaging/websocket-frontend-connection-service.js.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.spec.d.ts +2 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.d.ts.map +1 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.js +141 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.js.map +1 -0
- package/lib/node/performance/measurement-backend-bindings.js +1 -1
- package/lib/node/performance/measurement-backend-bindings.js.map +1 -1
- package/lib/node/process-utils.d.ts +125 -2
- package/lib/node/process-utils.d.ts.map +1 -1
- package/lib/node/process-utils.js +297 -25
- package/lib/node/process-utils.js.map +1 -1
- package/lib/node/process-utils.slow-spec.js +78 -3
- package/lib/node/process-utils.slow-spec.js.map +1 -1
- package/lib/node/process-utils.spec.js +237 -2
- package/lib/node/process-utils.spec.js.map +1 -1
- package/lib/node/shell-environment.d.ts +107 -0
- package/lib/node/shell-environment.d.ts.map +1 -0
- package/lib/node/shell-environment.js +396 -0
- package/lib/node/shell-environment.js.map +1 -0
- package/lib/node/shell-environment.spec.d.ts +2 -0
- package/lib/node/shell-environment.spec.d.ts.map +1 -0
- package/lib/node/shell-environment.spec.js +348 -0
- package/lib/node/shell-environment.spec.js.map +1 -0
- package/lib/node/test/exiting-backend.d.ts +5 -0
- package/lib/node/test/exiting-backend.d.ts.map +1 -1
- package/lib/node/test/exiting-backend.js +16 -3
- package/lib/node/test/exiting-backend.js.map +1 -1
- package/package.json +7 -4
- package/src/browser/encoding-registry.spec.ts +48 -0
- package/src/browser/encoding-registry.ts +1 -1
- package/src/browser/messaging/service-connection-provider.spec.ts +88 -0
- package/src/browser/messaging/service-connection-provider.ts +9 -2
- package/src/browser/shell/application-shell.ts +14 -1
- package/src/browser/shell/tab-bars.spec.ts +452 -1
- package/src/browser/shell/tab-bars.ts +285 -20
- package/src/browser/style/tabs.css +58 -3
- package/src/browser/widgets/widget.ts +36 -1
- package/src/common/core-preferences.ts +23 -1
- package/src/common/messaging/handler.ts +11 -0
- package/src/common/messaging/proxy-factory.spec.ts +17 -1
- package/src/common/messaging/proxy-factory.ts +16 -2
- package/src/common/messaging/socket-write-buffer.spec.ts +90 -0
- package/src/common/messaging/socket-write-buffer.ts +18 -14
- package/src/common/shell-environment.ts +81 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-contribution.spec.ts +95 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-contribution.ts +72 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-module.ts +29 -0
- package/src/electron-main/electron-main-application.ts +15 -4
- package/src/electron-node/keyboard/electron-backend-keyboard-module.ts +2 -1
- package/src/electron-node/request/electron-backend-request-service.ts +59 -11
- package/src/node/backend-application-module.ts +19 -5
- package/src/node/env-variables/env-variables-server.spec.ts +93 -0
- package/src/node/env-variables/env-variables-server.ts +22 -14
- package/src/node/i18n/i18n-backend-module.ts +2 -2
- package/src/node/index.ts +1 -0
- package/src/node/logger-backend-module.ts +1 -1
- package/src/node/messaging/connection-container-module.spec.ts +39 -0
- package/src/node/messaging/connection-container-module.ts +16 -4
- package/src/node/messaging/default-messaging-service.ts +64 -10
- package/src/node/messaging/gated-channel-multiplexer.spec.ts +80 -0
- package/src/node/messaging/gated-channel-multiplexer.ts +52 -0
- package/src/node/messaging/index.ts +1 -0
- package/src/node/messaging/messaging-backend-module.ts +1 -1
- package/src/node/messaging/messaging-service.ts +5 -1
- package/src/node/messaging/test/default-messaging-service.spec.ts +89 -2
- package/src/node/messaging/websocket-frontend-connection-service.spec.ts +158 -0
- package/src/node/messaging/websocket-frontend-connection-service.ts +9 -0
- package/src/node/performance/measurement-backend-bindings.ts +1 -1
- package/src/node/process-utils.slow-spec.ts +90 -3
- package/src/node/process-utils.spec.ts +268 -3
- package/src/node/process-utils.ts +342 -24
- package/src/node/shell-environment.spec.ts +388 -0
- package/src/node/shell-environment.ts +406 -0
- package/src/node/test/exiting-backend.ts +17 -3
|
@@ -31,8 +31,8 @@ import { IconThemeService } from '../icon-theme-service.js';
|
|
|
31
31
|
import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer.js';
|
|
32
32
|
import { NavigatableWidget } from '../navigatable-types.js';
|
|
33
33
|
import { Drag } from '@lumino/dragdrop';
|
|
34
|
-
import { LOCKED_CLASS, PINNED_CLASS } from '../widgets/widget.js';
|
|
35
|
-
import { CorePreferences } from '../../common/core-preferences.js';
|
|
34
|
+
import { isPinned, LOCKED_CLASS, PINNED_CLASS, pin, unpin } from '../widgets/widget.js';
|
|
35
|
+
import { CoreConfiguration, CorePreferences } from '../../common/core-preferences.js';
|
|
36
36
|
import { HoverService } from '../hover-service.js';
|
|
37
37
|
import { Root, createRoot } from 'react-dom/client';
|
|
38
38
|
import { SelectComponent } from '../widgets/select-component.js';
|
|
@@ -183,9 +183,6 @@ export class TabBarRenderer extends TabBar.Renderer {
|
|
|
183
183
|
const style = this.createTabStyle(data);
|
|
184
184
|
const className = `${this.createTabClass(data)}${tabCloseIconStart ? ' closeIcon-start' : ''}`;
|
|
185
185
|
const dataset = this.createTabDataset(data);
|
|
186
|
-
const closeIconTitle = data.title.className.includes(PINNED_CLASS)
|
|
187
|
-
? nls.localizeByDefault('Unpin')
|
|
188
|
-
: nls.localizeByDefault('Close');
|
|
189
186
|
|
|
190
187
|
const hover = {
|
|
191
188
|
onmouseenter: this.handleMouseEnterEvent
|
|
@@ -199,13 +196,15 @@ export class TabBarRenderer extends TabBar.Renderer {
|
|
|
199
196
|
this.renderBadge(data, isInSidePanel),
|
|
200
197
|
this.renderLock(data, isInSidePanel)
|
|
201
198
|
);
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
const tabContents = [tabLabel];
|
|
200
|
+
if (title.closable || isPinned(title)) {
|
|
201
|
+
const tabCloseIcon = this.renderCloseIcon(data);
|
|
202
|
+
if (tabCloseIconStart) {
|
|
203
|
+
tabContents.unshift(tabCloseIcon);
|
|
204
|
+
} else {
|
|
205
|
+
tabContents.push(tabCloseIcon);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
209
208
|
const draggable = this.tabBar instanceof ToolbarAwareTabBar && this.tabBar.isNativeTabDragEnabled ? { draggable: 'true' } : {};
|
|
210
209
|
|
|
211
210
|
return h.li(
|
|
@@ -224,6 +223,20 @@ export class TabBarRenderer extends TabBar.Renderer {
|
|
|
224
223
|
);
|
|
225
224
|
}
|
|
226
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Render the close icon of a tab, which unpins the tab if it is pinned.
|
|
228
|
+
* Only called for tabs that are closable or pinned.
|
|
229
|
+
* @param {SideBarRenderData} data Data used to render the tab.
|
|
230
|
+
* @returns {VirtualElement} The virtual element of the close icon.
|
|
231
|
+
*/
|
|
232
|
+
override renderCloseIcon(data: SideBarRenderData): VirtualElement {
|
|
233
|
+
return h.div({
|
|
234
|
+
className: 'lm-TabBar-tabCloseIcon action-label',
|
|
235
|
+
title: isPinned(data.title) ? nls.localizeByDefault('Unpin') : nls.localizeByDefault('Close'),
|
|
236
|
+
onclick: this.handleCloseClickEvent,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
227
240
|
override createTabClass(data: SideBarRenderData): string {
|
|
228
241
|
let tabClass = super.createTabClass(data);
|
|
229
242
|
if (!(data.visible ?? true)) {
|
|
@@ -698,7 +711,7 @@ export class TabBarRenderer extends TabBar.Renderer {
|
|
|
698
711
|
if (this.tabBar && event.currentTarget instanceof HTMLElement) {
|
|
699
712
|
const id = event.currentTarget.parentElement!.id;
|
|
700
713
|
const title = this.tabBar.titles.find(t => this.createTabId(t) === id);
|
|
701
|
-
if (title
|
|
714
|
+
if (title && isPinned(title) && this.commandService) {
|
|
702
715
|
this.commandService.executeCommand('workbench.action.unpinEditor', event);
|
|
703
716
|
}
|
|
704
717
|
}
|
|
@@ -724,18 +737,43 @@ export interface TabBarPrivateMethods {
|
|
|
724
737
|
_releaseMouse(): void;
|
|
725
738
|
}
|
|
726
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Custom property carrying the sticky `left` offset of a shrunk pinned tab. It is
|
|
742
|
+
* consumed by the `theia-pinned-tab-shrink` rules in tabs.css. The offset is not
|
|
743
|
+
* applied as an inline `left` style because lumino positions the tabs with inline
|
|
744
|
+
* `left` styles while dragging, which would be confused with the sticky offset.
|
|
745
|
+
*/
|
|
746
|
+
const PINNED_TAB_OFFSET_PROPERTY = '--theia-pinned-tab-offset';
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Custom property carrying the fixed width of a shrunk pinned tab. It is consumed
|
|
750
|
+
* by the `theia-pinned-tab-shrink` rules in tabs.css and set on the tab bar node
|
|
751
|
+
* from `ScrollableTabBar.DEFAULT_PINNED_TAB_SIZE`, so that the CSS rules and the
|
|
752
|
+
* tab layout logic share a single source for the value.
|
|
753
|
+
*/
|
|
754
|
+
const PINNED_TAB_SIZE_PROPERTY = '--theia-pinned-tab-size';
|
|
755
|
+
|
|
727
756
|
/**
|
|
728
757
|
* A specialized tab bar for the main and bottom areas.
|
|
729
758
|
*/
|
|
730
759
|
export class ScrollableTabBar extends TabBar<Widget> {
|
|
731
760
|
|
|
761
|
+
/**
|
|
762
|
+
* The fixed width of a shrunk pinned tab when no dynamic tab sizing is
|
|
763
|
+
* configured. Published to CSS as the `--theia-pinned-tab-size` custom property.
|
|
764
|
+
*/
|
|
765
|
+
static readonly DEFAULT_PINNED_TAB_SIZE = 80;
|
|
766
|
+
|
|
732
767
|
protected scrollBar: PerfectScrollbar | undefined;
|
|
733
768
|
|
|
734
769
|
protected pendingReveal?: Promise<void>;
|
|
735
770
|
protected isMouseOver = false;
|
|
736
771
|
protected needsRecompute = false;
|
|
737
772
|
protected tabSize = 0;
|
|
773
|
+
protected pinnedTabWidth = 0;
|
|
774
|
+
protected _pinnedTabSizingMode: ScrollableTabBar.PinnedTabSizingMode | undefined;
|
|
738
775
|
protected _dynamicTabOptions?: ScrollableTabBar.Options;
|
|
776
|
+
protected pinnedTabDragStartFrame?: number;
|
|
739
777
|
protected contentContainer: HTMLElement;
|
|
740
778
|
protected topRow: HTMLElement;
|
|
741
779
|
|
|
@@ -746,6 +784,8 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
746
784
|
constructor(options?: TabBar.IOptions<Widget>, protected readonly scrollbarOptions?: PerfectScrollbar.Options, dynamicTabOptions?: ScrollableTabBar.Options) {
|
|
747
785
|
super(options);
|
|
748
786
|
this._dynamicTabOptions = dynamicTabOptions;
|
|
787
|
+
this.tabMoved.connect(this.onTabMoved, this);
|
|
788
|
+
this.node.style.setProperty(PINNED_TAB_SIZE_PROPERTY, `${ScrollableTabBar.DEFAULT_PINNED_TAB_SIZE}px`);
|
|
749
789
|
this.topRow = document.createElement('div');
|
|
750
790
|
this.topRow.classList.add('theia-tabBar-tab-row');
|
|
751
791
|
this.node.appendChild(this.topRow);
|
|
@@ -775,6 +815,141 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
775
815
|
return this._dynamicTabOptions;
|
|
776
816
|
}
|
|
777
817
|
|
|
818
|
+
set pinnedTabSizingMode(mode: ScrollableTabBar.PinnedTabSizingMode | undefined) {
|
|
819
|
+
this._pinnedTabSizingMode = mode;
|
|
820
|
+
this.node.classList.remove('theia-pinned-tab-shrink');
|
|
821
|
+
if (mode === 'shrink') {
|
|
822
|
+
this.node.classList.add('theia-pinned-tab-shrink');
|
|
823
|
+
}
|
|
824
|
+
this.updateTabs();
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
get pinnedTabSizingMode(): ScrollableTabBar.PinnedTabSizingMode | undefined {
|
|
828
|
+
return this._pinnedTabSizingMode;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Updates both dynamic tab options and pinned tab sizing mode with a single tab bar refresh.
|
|
833
|
+
*/
|
|
834
|
+
updateTabOptions(dynamicTabOptions: ScrollableTabBar.Options | undefined, pinnedTabSizingMode: ScrollableTabBar.PinnedTabSizingMode | undefined): void {
|
|
835
|
+
this._dynamicTabOptions = dynamicTabOptions;
|
|
836
|
+
this._pinnedTabSizingMode = pinnedTabSizingMode;
|
|
837
|
+
this.node.classList.remove('theia-pinned-tab-shrink');
|
|
838
|
+
if (pinnedTabSizingMode === 'shrink') {
|
|
839
|
+
this.node.classList.add('theia-pinned-tab-shrink');
|
|
840
|
+
}
|
|
841
|
+
this.updateTabs();
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
override insertTab(index: number, value: Title<Widget> | Title.IOptions<Widget>): Title<Widget> {
|
|
845
|
+
return super.insertTab(this.adjustIndexForPinnedTabs(index, value), value);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Shrunk pinned tabs are sticky and aligned on the left edge of the tab bar, so pinned
|
|
850
|
+
* titles must always precede unpinned ones. Clamp the insertion index to keep an unpinned
|
|
851
|
+
* title from being placed within the pinned tabs, and a pinned title from being placed
|
|
852
|
+
* after unpinned ones.
|
|
853
|
+
*/
|
|
854
|
+
protected adjustIndexForPinnedTabs(index: number, value: Title<Widget> | Title.IOptions<Widget>): number {
|
|
855
|
+
if (this.pinnedTabSizingMode !== 'shrink') {
|
|
856
|
+
return index;
|
|
857
|
+
}
|
|
858
|
+
let title: Title<Widget> | undefined;
|
|
859
|
+
let pinned: boolean;
|
|
860
|
+
if (value instanceof Title) {
|
|
861
|
+
title = value;
|
|
862
|
+
pinned = isPinned(value);
|
|
863
|
+
} else {
|
|
864
|
+
pinned = value.closable === false && (value.className?.includes(PINNED_CLASS) ?? false);
|
|
865
|
+
}
|
|
866
|
+
let pinnedCount = 0;
|
|
867
|
+
for (const t of this.titles) {
|
|
868
|
+
if (isPinned(t)) {
|
|
869
|
+
pinnedCount++;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
if (pinned) {
|
|
873
|
+
// A pinned title that is already in the tab bar is moved rather than inserted,
|
|
874
|
+
// so it must not be counted when computing the size of the pinned group.
|
|
875
|
+
const moved = title !== undefined && this.titles.indexOf(title) !== -1;
|
|
876
|
+
return Math.max(0, Math.min(index, pinnedCount - (moved ? 1 : 0)));
|
|
877
|
+
}
|
|
878
|
+
return Math.max(index, pinnedCount);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Keep the pinned group consistent when tabs are dragged: an
|
|
883
|
+
* unpinned tab dropped in front of the pinned tabs is pinned, and a pinned tab
|
|
884
|
+
* dragged out of the pinned group is unpinned.
|
|
885
|
+
*/
|
|
886
|
+
protected onTabMoved(sender: TabBar<Widget>, args: TabBar.ITabMovedArgs<Widget>): void {
|
|
887
|
+
const title = args.title;
|
|
888
|
+
const pinnedCount = this.titles.filter(t => isPinned(t)).length;
|
|
889
|
+
if (isPinned(title) && args.toIndex >= pinnedCount) {
|
|
890
|
+
unpin(title);
|
|
891
|
+
} else if (!isPinned(title) && args.toIndex < pinnedCount) {
|
|
892
|
+
pin(title);
|
|
893
|
+
} else {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
this.insertTab(args.toIndex, title);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Move pinned titles to the start of the tab bar so that the sticky pinned tabs stay
|
|
901
|
+
* aligned on the left edge. Titles keep their relative order.
|
|
902
|
+
*/
|
|
903
|
+
protected enforcePinnedTabsFirst(): void {
|
|
904
|
+
if (this.pinnedTabSizingMode !== 'shrink') {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
const titles = this.titles.slice();
|
|
908
|
+
let pinnedCount = 0;
|
|
909
|
+
for (let i = 0; i < titles.length; i++) {
|
|
910
|
+
const title = titles[i];
|
|
911
|
+
if (isPinned(title)) {
|
|
912
|
+
if (i !== pinnedCount) {
|
|
913
|
+
this.insertTab(pinnedCount, title);
|
|
914
|
+
}
|
|
915
|
+
pinnedCount++;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Whether pinned tabs are shrunk and sticky: aligned on the left edge of a
|
|
922
|
+
* horizontal tab bar, where they must stack above the tabs scrolled underneath them.
|
|
923
|
+
*/
|
|
924
|
+
protected get pinnedTabsAreSticky(): boolean {
|
|
925
|
+
return this.pinnedTabSizingMode === 'shrink' && this.orientation === 'horizontal';
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* The width of a shrunk pinned tab: the dynamic tab size if configured,
|
|
930
|
+
* otherwise `DEFAULT_PINNED_TAB_SIZE`, applied to the tabs by CSS.
|
|
931
|
+
*/
|
|
932
|
+
protected getPinnedTabWidth(): number {
|
|
933
|
+
return this.pinnedTabWidth > 0 ? this.pinnedTabWidth : ScrollableTabBar.DEFAULT_PINNED_TAB_SIZE;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* The total width of the sticky pinned tabs aligned on the left edge of the
|
|
938
|
+
* tab bar, or 0 if pinned tabs are not shrunk and sticky.
|
|
939
|
+
*/
|
|
940
|
+
protected getPinnedTabsWidth(): number {
|
|
941
|
+
if (!this.pinnedTabsAreSticky) {
|
|
942
|
+
return 0;
|
|
943
|
+
}
|
|
944
|
+
let pinnedCount = 0;
|
|
945
|
+
for (const title of this.titles) {
|
|
946
|
+
if (isPinned(title)) {
|
|
947
|
+
pinnedCount++;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return pinnedCount * this.getPinnedTabWidth();
|
|
951
|
+
}
|
|
952
|
+
|
|
778
953
|
override dispose(): void {
|
|
779
954
|
if (this.isDisposed) {
|
|
780
955
|
return;
|
|
@@ -800,6 +975,38 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
800
975
|
(this as unknown as TabBarPrivateMethods)._releaseMouse();
|
|
801
976
|
}
|
|
802
977
|
|
|
978
|
+
override handleEvent(event: Event): void {
|
|
979
|
+
const wasDragging = this.node.classList.contains('lm-mod-dragging');
|
|
980
|
+
super.handleEvent(event);
|
|
981
|
+
// Lumino adds `lm-mod-dragging` to the tab bar once a tab drag is activated.
|
|
982
|
+
if (event.type === 'pointermove' && !wasDragging && this.pinnedTabSizingMode === 'shrink'
|
|
983
|
+
&& this.node.classList.contains('lm-mod-dragging')) {
|
|
984
|
+
this.suspendPinnedTabTransitionsOnDragStart();
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Suspend the `left` transition of pinned tabs for the frame in which a drag
|
|
990
|
+
* starts. A pinned tab switches from sticky to relative positioning at drag
|
|
991
|
+
* start so that lumino's inline `left` drag positions apply, and that switch
|
|
992
|
+
* changes the meaning of the `left` offset: animating it would make the tab
|
|
993
|
+
* jump by its sticky offset and slide back. The class is removed again after
|
|
994
|
+
* the next frame, so lumino's `transition: left 150ms ease` slides the pinned
|
|
995
|
+
* tabs for the rest of the drag.
|
|
996
|
+
*/
|
|
997
|
+
protected suspendPinnedTabTransitionsOnDragStart(): void {
|
|
998
|
+
if (this.pinnedTabDragStartFrame !== undefined) {
|
|
999
|
+
window.cancelAnimationFrame(this.pinnedTabDragStartFrame);
|
|
1000
|
+
}
|
|
1001
|
+
this.node.classList.add('theia-pinned-tab-drag-start');
|
|
1002
|
+
this.pinnedTabDragStartFrame = window.requestAnimationFrame(() => {
|
|
1003
|
+
this.pinnedTabDragStartFrame = window.requestAnimationFrame(() => {
|
|
1004
|
+
this.pinnedTabDragStartFrame = undefined;
|
|
1005
|
+
this.node.classList.remove('theia-pinned-tab-drag-start');
|
|
1006
|
+
});
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
|
|
803
1010
|
protected override onAfterAttach(msg: Message): void {
|
|
804
1011
|
this.node.addEventListener('mouseenter', () => { this.isMouseOver = true; });
|
|
805
1012
|
this.node.addEventListener('mouseleave', () => {
|
|
@@ -823,6 +1030,7 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
823
1030
|
}
|
|
824
1031
|
|
|
825
1032
|
protected updateTabs(): void {
|
|
1033
|
+
this.enforcePinnedTabsFirst();
|
|
826
1034
|
const content = [];
|
|
827
1035
|
if (this.dynamicTabOptions) {
|
|
828
1036
|
|
|
@@ -844,14 +1052,31 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
844
1052
|
if (!this.openTabsContainer.classList.contains('lm-mod-hidden')) {
|
|
845
1053
|
availableWidth += this.openTabsContainer.getBoundingClientRect().width;
|
|
846
1054
|
}
|
|
847
|
-
|
|
1055
|
+
const pinnedTabSize = this.dynamicTabOptions.pinnedTabSize;
|
|
1056
|
+
const pinnedCount = pinnedTabSize ? this.titles.filter(t => isPinned(t)).length : 0;
|
|
1057
|
+
const unpinnedCount = this.titles.length - pinnedCount;
|
|
1058
|
+
const pinnedWidth = pinnedCount * (pinnedTabSize ?? 0);
|
|
1059
|
+
const requiredWidth = pinnedWidth + this.dynamicTabOptions.minimumTabSize * unpinnedCount;
|
|
1060
|
+
if (requiredWidth <= availableWidth) {
|
|
848
1061
|
effectiveWidth += this.openTabsContainer.getBoundingClientRect().width;
|
|
849
1062
|
this.openTabsContainer.classList.add('lm-mod-hidden');
|
|
850
1063
|
} else {
|
|
851
1064
|
this.openTabsContainer.classList.remove('lm-mod-hidden');
|
|
852
1065
|
}
|
|
853
|
-
|
|
854
|
-
this.
|
|
1066
|
+
if (pinnedCount > 0 && pinnedTabSize) {
|
|
1067
|
+
this.pinnedTabWidth = pinnedTabSize;
|
|
1068
|
+
if (unpinnedCount > 0) {
|
|
1069
|
+
const remainingWidth = effectiveWidth - pinnedWidth;
|
|
1070
|
+
this.tabSize = Math.max(Math.min(remainingWidth / unpinnedCount,
|
|
1071
|
+
this.dynamicTabOptions.defaultTabSize), this.dynamicTabOptions.minimumTabSize);
|
|
1072
|
+
} else {
|
|
1073
|
+
this.tabSize = this.dynamicTabOptions.defaultTabSize;
|
|
1074
|
+
}
|
|
1075
|
+
} else {
|
|
1076
|
+
this.pinnedTabWidth = 0;
|
|
1077
|
+
this.tabSize = Math.max(Math.min(effectiveWidth / this.titles.length,
|
|
1078
|
+
this.dynamicTabOptions.defaultTabSize), this.dynamicTabOptions.minimumTabSize);
|
|
1079
|
+
}
|
|
855
1080
|
}
|
|
856
1081
|
}
|
|
857
1082
|
this.node.classList.add('dynamic-tabs');
|
|
@@ -859,17 +1084,22 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
859
1084
|
this.openTabsContainer.classList.add('lm-mod-hidden');
|
|
860
1085
|
this.node.classList.remove('dynamic-tabs');
|
|
861
1086
|
}
|
|
1087
|
+
const sticky = this.pinnedTabsAreSticky;
|
|
1088
|
+
const stickyPinnedCount = sticky ? this.titles.filter(t => isPinned(t)).length : 0;
|
|
862
1089
|
for (let i = 0, n = this.titles.length; i < n; ++i) {
|
|
863
1090
|
const title = this.titles[i];
|
|
864
1091
|
const current = title === this.currentTitle;
|
|
865
|
-
const zIndex = current ? n : n - i - 1;
|
|
1092
|
+
const zIndex = sticky && isPinned(title) ? n + stickyPinnedCount - i : current ? n : n - i - 1;
|
|
866
1093
|
const renderData: ScrollableRenderData = { title: title, current: current, zIndex: zIndex };
|
|
867
1094
|
if (this.dynamicTabOptions && this.orientation === 'horizontal') {
|
|
868
|
-
renderData.tabWidth = this.
|
|
1095
|
+
renderData.tabWidth = this.pinnedTabWidth > 0 && isPinned(title)
|
|
1096
|
+
? this.pinnedTabWidth
|
|
1097
|
+
: this.tabSize;
|
|
869
1098
|
}
|
|
870
1099
|
content[i] = this.renderer.renderTab(renderData);
|
|
871
1100
|
}
|
|
872
1101
|
VirtualDOM.render(content, this.contentNode);
|
|
1102
|
+
this.updatePinnedTabOffsets();
|
|
873
1103
|
if (this.scrollBar) {
|
|
874
1104
|
if (!(this.dynamicTabOptions && this.isMouseOver)) {
|
|
875
1105
|
this.scrollBar.update();
|
|
@@ -877,6 +1107,31 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
877
1107
|
}
|
|
878
1108
|
}
|
|
879
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* Apply the sticky offset of each shrunk pinned tab through the
|
|
1112
|
+
* `PINNED_TAB_OFFSET_PROPERTY` custom property, consumed by the
|
|
1113
|
+
* `theia-pinned-tab-shrink` rules in tabs.css. Sticky pinned tabs stack side
|
|
1114
|
+
* by side at the left edge of the tab bar: each pinned tab sticks at its own
|
|
1115
|
+
* natural position so that they do not overlap.
|
|
1116
|
+
*/
|
|
1117
|
+
protected updatePinnedTabOffsets(): void {
|
|
1118
|
+
const sticky = this.pinnedTabsAreSticky;
|
|
1119
|
+
const tabs = this.contentNode.children;
|
|
1120
|
+
let pinnedTabIndex = 0;
|
|
1121
|
+
for (let i = 0, n = this.titles.length; i < n; ++i) {
|
|
1122
|
+
const tab = tabs[i] as HTMLElement | undefined;
|
|
1123
|
+
if (!tab) {
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
if (sticky && isPinned(this.titles[i])) {
|
|
1127
|
+
tab.style.setProperty(PINNED_TAB_OFFSET_PROPERTY, `${pinnedTabIndex * this.getPinnedTabWidth()}px`);
|
|
1128
|
+
pinnedTabIndex++;
|
|
1129
|
+
} else {
|
|
1130
|
+
tab.style.removeProperty(PINNED_TAB_OFFSET_PROPERTY);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
880
1135
|
protected override onResize(msg: Widget.ResizeMessage): void {
|
|
881
1136
|
super.onResize(msg);
|
|
882
1137
|
if (this.dynamicTabOptions) {
|
|
@@ -907,8 +1162,13 @@ export class ScrollableTabBar extends TabBar<Widget> {
|
|
|
907
1162
|
if (this.orientation === 'horizontal') {
|
|
908
1163
|
const scroll = parent.scrollLeft;
|
|
909
1164
|
const left = tab.offsetLeft;
|
|
910
|
-
|
|
911
|
-
|
|
1165
|
+
// Shrunk pinned tabs are sticky and cover the left edge of the tab bar.
|
|
1166
|
+
const pinnedWidth = this.getPinnedTabsWidth();
|
|
1167
|
+
if (pinnedWidth > 0 && isPinned(this.titles[index])) {
|
|
1168
|
+
// Sticky pinned tabs are always visible at the left edge: nothing to reveal.
|
|
1169
|
+
} else if (scroll > left - pinnedWidth) {
|
|
1170
|
+
// Reveal the tab to the right of the sticky pinned tabs.
|
|
1171
|
+
parent.scrollLeft = Math.max(0, left - pinnedWidth);
|
|
912
1172
|
} else {
|
|
913
1173
|
const right = left + tab.clientWidth - parent.clientWidth;
|
|
914
1174
|
if (scroll < right && tab.clientWidth < parent.clientWidth) {
|
|
@@ -944,7 +1204,12 @@ export namespace ScrollableTabBar {
|
|
|
944
1204
|
export interface Options {
|
|
945
1205
|
minimumTabSize: number;
|
|
946
1206
|
defaultTabSize: number;
|
|
1207
|
+
pinnedTabSize?: number;
|
|
947
1208
|
}
|
|
1209
|
+
|
|
1210
|
+
/** Sizing mode of pinned tabs, as configured by the `workbench.editor.pinnedTabSizing` preference. */
|
|
1211
|
+
export type PinnedTabSizingMode = CoreConfiguration['workbench.editor.pinnedTabSizing'];
|
|
1212
|
+
|
|
948
1213
|
export namespace Styles {
|
|
949
1214
|
|
|
950
1215
|
export const TAB_BAR_CONTENT_CONTAINER = 'lm-TabBar-content-container';
|
|
@@ -236,8 +236,8 @@
|
|
|
236
236
|
-ms-user-select: none;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.closeIcon-start
|
|
240
|
-
.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.closeIcon-start
|
|
239
|
+
.lm-TabBar.theia-app-centers .lm-TabBar-tab.lm-mod-closable.closeIcon-start>.lm-TabBar-tabCloseIcon,
|
|
240
|
+
.lm-TabBar.theia-app-centers .lm-TabBar-tab.theia-mod-pinned.closeIcon-start>.lm-TabBar-tabCloseIcon {
|
|
241
241
|
margin-left: inherit;
|
|
242
242
|
margin-right: 4px;
|
|
243
243
|
}
|
|
@@ -287,6 +287,61 @@
|
|
|
287
287
|
content: "\ebb2";
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
/*
|
|
291
|
+
* Shrunk pinned tabs are sticky and aligned on the left edge of the tab bar. Each
|
|
292
|
+
* pinned tab sticks at its own natural position, carried by the
|
|
293
|
+
* `--theia-pinned-tab-offset` custom property set by the tab bar, so that the
|
|
294
|
+
* pinned tabs stack instead of overlapping.
|
|
295
|
+
*/
|
|
296
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink .lm-TabBar-tab.theia-mod-pinned {
|
|
297
|
+
position: sticky;
|
|
298
|
+
left: var(--theia-pinned-tab-offset, 0);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/*
|
|
302
|
+
* While a tab is being dragged, lumino positions the tabs with inline `left`
|
|
303
|
+
* styles (relative offsets, see `.lm-TabBar.lm-mod-dragging` in lumino's
|
|
304
|
+
* tabbar.css). The sticky offset must not apply then, and the sticky rule above
|
|
305
|
+
* has a higher specificity than lumino's dragging rules, so it is overridden
|
|
306
|
+
* here. The override is deliberately not `!important` so that lumino's inline
|
|
307
|
+
* drag positions still take precedence, and lumino's `transition: left` slides
|
|
308
|
+
* the pinned tabs for the rest of the drag.
|
|
309
|
+
*/
|
|
310
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink.lm-mod-dragging .lm-TabBar-tab.theia-mod-pinned {
|
|
311
|
+
position: relative;
|
|
312
|
+
left: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/*
|
|
316
|
+
* Switching a pinned tab from sticky to relative positioning changes the
|
|
317
|
+
* meaning of its `left` offset, so the switch itself must not be animated:
|
|
318
|
+
* otherwise the tab would jump by its sticky offset and slide back. The tab bar
|
|
319
|
+
* adds this class for the first frame of a drag only.
|
|
320
|
+
*/
|
|
321
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink.lm-mod-dragging.theia-pinned-tab-drag-start .lm-TabBar-tab.theia-mod-pinned {
|
|
322
|
+
transition: none;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink .lm-TabBar-tab.theia-mod-pinned>.lm-TabBar-tabCloseIcon {
|
|
326
|
+
display: inline-block;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/*
|
|
330
|
+
* The fixed width of a shrunk pinned tab is carried by the `--theia-pinned-tab-size`
|
|
331
|
+
* custom property, which the tab bar sets from `ScrollableTabBar.DEFAULT_PINNED_TAB_SIZE`,
|
|
332
|
+
* so that the CSS rules and the tab layout logic share a single source for the value.
|
|
333
|
+
*/
|
|
334
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink:not(.dynamic-tabs) .lm-TabBar-tab.theia-mod-pinned {
|
|
335
|
+
min-width: var(--theia-pinned-tab-size);
|
|
336
|
+
max-width: var(--theia-pinned-tab-size);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.lm-TabBar.theia-app-centers.theia-pinned-tab-shrink .lm-TabBar-tab.theia-mod-pinned .lm-TabBar-tabLabel {
|
|
340
|
+
overflow: hidden;
|
|
341
|
+
text-overflow: ellipsis;
|
|
342
|
+
white-space: nowrap;
|
|
343
|
+
}
|
|
344
|
+
|
|
290
345
|
.lm-TabBar-tabIcon.no-icon {
|
|
291
346
|
display: none !important;
|
|
292
347
|
}
|
|
@@ -417,7 +472,7 @@
|
|
|
417
472
|
cursor: pointer;
|
|
418
473
|
}
|
|
419
474
|
|
|
420
|
-
.lm-TabBar-toolbar
|
|
475
|
+
.lm-TabBar-toolbar> :not(.item.enabled)>.action-label {
|
|
421
476
|
background: transparent;
|
|
422
477
|
cursor: default;
|
|
423
478
|
}
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
19
|
import { injectable, decorate, unmanaged } from 'inversify';
|
|
20
|
-
import { Title, Widget } from '@lumino/widgets';
|
|
20
|
+
import { DockPanel, TabBar, Title, Widget } from '@lumino/widgets';
|
|
21
|
+
import { find } from '@lumino/algorithm';
|
|
21
22
|
import { Message, MessageLoop } from '@lumino/messaging';
|
|
22
23
|
import { Emitter, Event, Disposable, DisposableCollection, MaybePromise, isObject } from '../../common/index.js';
|
|
23
24
|
import { KeyCode, KeysOrKeyCodes } from '../keyboard/keys.js';
|
|
@@ -389,6 +390,38 @@ export function isPinned(title: Title<Widget>): boolean {
|
|
|
389
390
|
return pinnedState;
|
|
390
391
|
}
|
|
391
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Find the tab bar containing the given title, if the title is docked in a dock panel.
|
|
395
|
+
*/
|
|
396
|
+
function findOwningTabBar(title: Title<Widget>): TabBar<Widget> | undefined {
|
|
397
|
+
let parent = title.owner.parent;
|
|
398
|
+
while (parent) {
|
|
399
|
+
if (parent instanceof DockPanel) {
|
|
400
|
+
return find(parent.tabBars(), bar => bar.titles.includes(title));
|
|
401
|
+
}
|
|
402
|
+
parent = parent.parent;
|
|
403
|
+
}
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Move the title within its tab bar so that pinned titles precede unpinned ones,
|
|
409
|
+
* keeping the model order in sync with the visual order of the tab bar.
|
|
410
|
+
* A pinned title is placed at the end of the pinned group, an unpinned title
|
|
411
|
+
* at the start of the unpinned group.
|
|
412
|
+
*/
|
|
413
|
+
function moveToPinnedSection(title: Title<Widget>): void {
|
|
414
|
+
const tabBar = findOwningTabBar(title);
|
|
415
|
+
if (!tabBar) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const titles = tabBar.titles;
|
|
419
|
+
const index = isPinned(title)
|
|
420
|
+
? titles.findIndex(t => !isPinned(t))
|
|
421
|
+
: titles.filter(t => isPinned(t)).length;
|
|
422
|
+
tabBar.insertTab(index === -1 ? titles.length : index, title);
|
|
423
|
+
}
|
|
424
|
+
|
|
392
425
|
export function pin(title: Title<Widget>): void {
|
|
393
426
|
const l = () => {
|
|
394
427
|
pinnedTitles.delete(title);
|
|
@@ -399,6 +432,7 @@ export function pin(title: Title<Widget>): void {
|
|
|
399
432
|
if (!title.className.includes(PINNED_CLASS)) {
|
|
400
433
|
title.className += ` ${PINNED_CLASS}`;
|
|
401
434
|
}
|
|
435
|
+
moveToPinnedSection(title);
|
|
402
436
|
}
|
|
403
437
|
|
|
404
438
|
export function unpin(title: Title<Widget>): void {
|
|
@@ -411,6 +445,7 @@ export function unpin(title: Title<Widget>): void {
|
|
|
411
445
|
title.closable = true;
|
|
412
446
|
}
|
|
413
447
|
title.className = title.className.replace(PINNED_CLASS, '').trim();
|
|
448
|
+
moveToPinnedSection(title);
|
|
414
449
|
}
|
|
415
450
|
|
|
416
451
|
export function isLocked(title: Title<Widget>): boolean {
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
import { interfaces } from 'inversify';
|
|
18
18
|
import { environment } from '@theia/application-package/lib/environment';
|
|
19
19
|
import { SUPPORTED_ENCODINGS } from './supported-encodings.js';
|
|
20
|
-
import { isOSX } from '../common/os.js';
|
|
20
|
+
import { isOSX, isWindows } from '../common/os.js';
|
|
21
21
|
import { nls } from '../common/nls.js';
|
|
22
22
|
import { PreferenceContribution, PreferenceSchema } from '../common/preferences/preference-schema.js';
|
|
23
23
|
import { createPreferenceProxy, PreferenceProxy, PreferenceService } from '../common/preferences/index.js';
|
|
24
24
|
import { PreferenceScope } from '../common/preferences/preference-scope.js';
|
|
25
|
+
import { ShellEnvironmentResolutionTimeout } from './shell-environment.js';
|
|
25
26
|
|
|
26
27
|
/* eslint-disable max-len */
|
|
27
28
|
const windowTitleDescription = [
|
|
@@ -54,6 +55,15 @@ export const corePreferenceSchema: PreferenceSchema = {
|
|
|
54
55
|
default: 'ifRequired',
|
|
55
56
|
description: nls.localizeByDefault('Controls whether to show a confirmation dialog before closing the browser tab or window. Note that even if enabled, browsers may still decide to close a tab or window without confirmation and that this setting is only a hint that may not work in all cases.'),
|
|
56
57
|
},
|
|
58
|
+
'application.shellEnvironmentResolutionTimeout': {
|
|
59
|
+
type: 'number',
|
|
60
|
+
default: ShellEnvironmentResolutionTimeout.DEFAULT,
|
|
61
|
+
minimum: ShellEnvironmentResolutionTimeout.MIN,
|
|
62
|
+
maximum: ShellEnvironmentResolutionTimeout.MAX,
|
|
63
|
+
included: environment.electron.is() && !isWindows,
|
|
64
|
+
scope: PreferenceScope.User,
|
|
65
|
+
description: nls.localize('theia/core/shellEnvironmentResolutionTimeout', 'Controls the timeout in seconds before giving up resolving the environment of your login shell when the application starts. Its `PATH` lets terminals, tasks, debug adapters, and extensions find the tools that your shell configuration provides. Takes effect at the next start of the application.'),
|
|
66
|
+
},
|
|
57
67
|
'breadcrumbs.enabled': {
|
|
58
68
|
'type': 'boolean',
|
|
59
69
|
'default': true,
|
|
@@ -314,6 +324,16 @@ export const corePreferenceSchema: PreferenceSchema = {
|
|
|
314
324
|
minimum: 10,
|
|
315
325
|
description: nls.localize('theia/core/tabDefaultSize', 'Specifies the default size for tabs.')
|
|
316
326
|
},
|
|
327
|
+
'workbench.editor.pinnedTabSizing': {
|
|
328
|
+
type: 'string',
|
|
329
|
+
enum: ['normal', 'shrink'],
|
|
330
|
+
default: 'normal',
|
|
331
|
+
markdownDescription: nls.localize('theia/core/pinnedTabSizing', 'Controls the size of pinned editor tabs. Pinned tabs typically do not close until unpinned. Pinning a tab moves it to the end of the pinned group at the beginning of the tab bar. When set to "shrink", pinned tabs are additionally shown at a compact fixed size.'),
|
|
332
|
+
enumDescriptions: [
|
|
333
|
+
nls.localizeByDefault('A pinned tab inherits the look of non pinned tabs.'),
|
|
334
|
+
nls.localizeByDefault('A pinned tab shrinks to a compact fixed size showing parts of the editor name.')
|
|
335
|
+
]
|
|
336
|
+
},
|
|
317
337
|
'workbench.editorAssociations': {
|
|
318
338
|
type: 'object',
|
|
319
339
|
markdownDescription: nls.localizeByDefault('Configure [glob patterns](https://aka.ms/vscode-glob-patterns) to editors (for example `"*.hex": "hexEditor.hexedit"`). These have precedence over the default behavior.'),
|
|
@@ -328,6 +348,7 @@ export const corePreferenceSchema: PreferenceSchema = {
|
|
|
328
348
|
|
|
329
349
|
export interface CoreConfiguration {
|
|
330
350
|
'application.confirmExit': 'never' | 'ifRequired' | 'always';
|
|
351
|
+
'application.shellEnvironmentResolutionTimeout': number;
|
|
331
352
|
'breadcrumbs.enabled': boolean;
|
|
332
353
|
'files.encoding': string;
|
|
333
354
|
'keyboard.dispatch': 'code' | 'keyCode';
|
|
@@ -357,6 +378,7 @@ export interface CoreConfiguration {
|
|
|
357
378
|
'workbench.tab.shrinkToFit.enabled': boolean;
|
|
358
379
|
'workbench.tab.shrinkToFit.minimumSize': number;
|
|
359
380
|
'workbench.tab.shrinkToFit.defaultSize': number;
|
|
381
|
+
'workbench.editor.pinnedTabSizing': 'normal' | 'shrink';
|
|
360
382
|
}
|
|
361
383
|
|
|
362
384
|
export const CorePreferenceContribution = Symbol('CorePreferenceContribution');
|
|
@@ -22,5 +22,16 @@ export const ConnectionHandler = Symbol('ConnectionHandler');
|
|
|
22
22
|
|
|
23
23
|
export interface ConnectionHandler {
|
|
24
24
|
readonly path: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the frontend may use the service before the process environment of the backend is complete.
|
|
27
|
+
*
|
|
28
|
+
* In an Electron application, the backend resolves the environment of the user's login shell after it has started
|
|
29
|
+
* (see `ShellEnvironmentServer`). Until that is done, `process.env` lacks the `PATH` of the user's shell
|
|
30
|
+
* configuration, so the processes that a service starts would not find the user's tools.
|
|
31
|
+
* The backend therefore holds the opening of every service channel until the environment is known.
|
|
32
|
+
* A service that starts no processes and that the frontend needs in order to start up declares its independence,
|
|
33
|
+
* so that the workbench does not wait for the shell. The default is `false`.
|
|
34
|
+
*/
|
|
35
|
+
readonly independentOfShellEnvironment?: boolean;
|
|
25
36
|
onConnection(connection: Channel): void;
|
|
26
37
|
}
|