Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add handling of extension visibility #12719

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/plugin-ext/src/common/plugin-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,18 @@ export interface PluginPackageTranslation {
path: string;
}

export enum InitialVisibility {
Visible = 'visible',
Hidden = 'hidden',
Collapsed = 'collapsed'
}

export interface PluginPackageCustomEditor {
viewType: string;
displayName: string;
selector?: CustomEditorSelector[];
priority?: CustomEditorPriority;
visibility?: InitialVisibility;
}

export interface CustomEditorSelector {
Expand Down Expand Up @@ -169,12 +176,14 @@ export interface PluginPackageView {
name: string;
when?: string;
type?: string;
visibility?: InitialVisibility;
}

export interface PluginPackageViewWelcome {
view: string;
contents: string;
when?: string;
visibility?: InitialVisibility;
}

export interface PluginPackageCommand {
Expand Down Expand Up @@ -774,6 +783,7 @@ export interface View {
name: string;
when?: string;
type?: string;
visibility?: InitialVisibility;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ export class TheiaPluginScanner implements PluginScanner {
id: rawView.id,
name: rawView.name,
when: rawView.when,
type: rawView.type
type: rawView.type,
visibility: rawView.visibility,
};

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ViewContainerIdentifier, ViewContainerTitleOptions, Widget, FrontendApplicationContribution,
StatefulWidget, CommonMenus, TreeViewWelcomeWidget, codicon, ViewContainerPart, BaseWidget
} from '@theia/core/lib/browser';
import { ViewContainer, View, ViewWelcome, PluginViewType } from '../../../common';
import { ViewContainer, View, ViewWelcome, PluginViewType, InitialVisibility } from '../../../common';
import { PluginSharedStyle } from '../plugin-shared-style';
import { DebugWidget } from '@theia/debug/lib/browser/view/debug-widget';
import { PluginViewWidget, PluginViewWidgetIdentifier } from './plugin-view-widget';
Expand Down Expand Up @@ -608,9 +608,15 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
}
const widget = await this.widgetManager.getOrCreateWidget<PluginViewWidget>(PLUGIN_VIEW_FACTORY_ID, identifier);
if (containerWidget.getTrackableWidgets().indexOf(widget) === -1) {
const viewInfo = this.views.get(viewId);
const initialVisibility = viewInfo?.[1].visibility;
const isInitiallyVisible = initialVisibility === InitialVisibility.Visible;
const isinitiallyHidden = initialVisibility === InitialVisibility.Hidden;
const isInitiallyCollapsed = initialVisibility === InitialVisibility.Collapsed;

containerWidget.addWidget(widget, {
initiallyCollapsed: !!containerWidget.getParts().length,
initiallyHidden: !this.isViewVisible(viewId)
initiallyCollapsed: !!containerWidget.getParts().length && (!isInitiallyVisible || isInitiallyCollapsed),
initiallyHidden: (!this.isViewVisible(viewId) || isinitiallyHidden) && !isInitiallyVisible,
});
}
this.registerWidgetPartEvents(widget, containerWidget);
Expand Down
Loading