deploy: current vibn theia state
Some checks failed
Playwright Tests / Playwright Tests (ubuntu-22.04, Node.js 22.x) (push) Has been cancelled
3PP License Check / 3PP License Check (11, 22.x, ubuntu-22.04) (push) Has been cancelled
Publish packages to NPM / Perform Publishing (push) Has been cancelled

Made-with: Cursor
This commit is contained in:
2026-02-27 12:01:08 -08:00
commit 8bb5110148
3782 changed files with 640947 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
// *****************************************************************************
// Copyright (C) 2021 Ericsson and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { ApplicationShell, CommonCommands, KeybindingContribution, KeybindingRegistry, SHELL_TABBAR_CONTEXT_PIN, Widget } from '@theia/core/lib/browser';
import { nls } from '@theia/core/lib/common/nls';
import { Command, CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common';
import { inject, injectable } from '@theia/core/shared/inversify';
import { EditorPreviewWidget } from './editor-preview-widget';
import { CurrentWidgetCommandAdapter } from '@theia/core/lib/browser/shell/current-widget-command-adapter';
export namespace EditorPreviewCommands {
export const PIN_PREVIEW_COMMAND = Command.toDefaultLocalizedCommand({
id: 'workbench.action.keepEditor',
category: CommonCommands.VIEW_CATEGORY,
label: 'Keep Editor',
});
}
@injectable()
export class EditorPreviewContribution implements CommandContribution, MenuContribution, KeybindingContribution {
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(EditorPreviewCommands.PIN_PREVIEW_COMMAND, new CurrentWidgetCommandAdapter(this.shell, {
execute: async title => {
if (title?.owner instanceof EditorPreviewWidget) {
title.owner.convertToNonPreview();
await this.shell.activateWidget(title.owner.id);
}
},
isEnabled: title => title?.owner instanceof EditorPreviewWidget && title.owner.isPreview,
isVisible: title => title?.owner instanceof EditorPreviewWidget,
}));
}
registerKeybindings(registry: KeybindingRegistry): void {
registry.registerKeybinding({
command: EditorPreviewCommands.PIN_PREVIEW_COMMAND.id,
keybinding: 'ctrlcmd+k enter'
});
}
registerMenus(registry: MenuModelRegistry): void {
registry.registerMenuAction(SHELL_TABBAR_CONTEXT_PIN, {
commandId: EditorPreviewCommands.PIN_PREVIEW_COMMAND.id,
label: nls.localizeByDefault('Keep Open'),
order: '6',
});
}
protected getTargetWidget(event?: Event): Widget | undefined {
return event ? this.shell.findTargetedWidget(event) : this.shell.activeWidget;
}
}

View File

@@ -0,0 +1,46 @@
// *****************************************************************************
// Copyright (C) 2018-2021 Google and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import '../../src/browser/style/index.css';
import { FrontendApplicationContribution, KeybindingContribution, WidgetFactory } from '@theia/core/lib/browser';
import { ContainerModule } from '@theia/core/shared/inversify';
import { bindEditorPreviewPreferences } from '../common/editor-preview-preferences';
import { EditorPreviewManager } from './editor-preview-manager';
import { EditorManager } from '@theia/editor/lib/browser';
import { EditorPreviewWidgetFactory } from './editor-preview-widget-factory';
import { EditorPreviewContribution } from './editor-preview-contribution';
import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
import { OpenEditorsTreeDecorator } from '@theia/navigator/lib/browser/open-editors-widget/navigator-open-editors-decorator-service';
import { EditorPreviewTreeDecorator } from './editor-preview-tree-decorator';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(EditorPreviewWidgetFactory).toSelf().inSingletonScope();
bind(WidgetFactory).toService(EditorPreviewWidgetFactory);
bind(EditorPreviewManager).toSelf().inSingletonScope();
rebind(EditorManager).toService(EditorPreviewManager);
bind(EditorPreviewContribution).toSelf().inSingletonScope();
bind(CommandContribution).toService(EditorPreviewContribution);
bind(KeybindingContribution).toService(EditorPreviewContribution);
bind(MenuContribution).toService(EditorPreviewContribution);
bind(EditorPreviewTreeDecorator).toSelf().inSingletonScope();
bind(OpenEditorsTreeDecorator).toService(EditorPreviewTreeDecorator);
bind(FrontendApplicationContribution).toService(EditorPreviewTreeDecorator);
bindEditorPreviewPreferences(bind);
});

View File

@@ -0,0 +1,128 @@
// *****************************************************************************
// Copyright (C) 2018-2021 Google and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { EditorManager, EditorOpenerOptions, EditorWidget } from '@theia/editor/lib/browser';
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
import { EditorPreviewPreferences } from '../common/editor-preview-preferences';
import { MaybePromise } from '@theia/core/lib/common';
import URI from '@theia/core/lib/common/uri';
import { EditorPreviewWidgetFactory, EditorPreviewOptions } from './editor-preview-widget-factory';
import { EditorPreviewWidget } from './editor-preview-widget';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { WidgetOpenerOptions } from '@theia/core/lib/browser';
@injectable()
export class EditorPreviewManager extends EditorManager {
override readonly id = EditorPreviewWidgetFactory.ID;
@inject(EditorPreviewPreferences) protected readonly preferences: EditorPreviewPreferences;
@inject(FrontendApplicationStateService) protected readonly stateService: FrontendApplicationStateService;
/**
* Until the layout has been restored, widget state is not reliable, so we ignore creation events.
*/
protected layoutIsSet = false;
@postConstruct()
protected override init(): void {
super.init();
// All editors are created, but not all are opened. This sets up the logic to swap previews when the editor is attached.
this.onCreated((widget: EditorPreviewWidget) => {
if (this.layoutIsSet && widget.isPreview) {
const oneTimeDisposable = widget.onDidChangeVisibility(() => {
this.handleNewPreview(widget);
oneTimeDisposable.dispose();
});
}
});
this.preferences.onPreferenceChanged(change => {
if (change.preferenceName === 'editor.enablePreview' && !this.preferences['editor.enablePreview']) {
this.all.forEach((editor: EditorPreviewWidget) => {
if (editor.isPreview) {
editor.convertToNonPreview();
}
});
};
});
this.stateService.reachedState('initialized_layout').then(() => {
const editors = this.all as EditorPreviewWidget[];
const currentPreview = editors.find(editor => editor.isPreview);
if (currentPreview) {
this.handleNewPreview(currentPreview);
}
this.layoutIsSet = true;
});
document.addEventListener('dblclick', this.convertEditorOnDoubleClick.bind(this));
}
protected override async doOpen(widget: EditorPreviewWidget, uri: URI, options?: EditorOpenerOptions): Promise<void> {
const { preview, widgetOptions = { area: 'main' }, mode = 'activate' } = options ?? {};
if (!widget.isAttached) {
await this.shell.addWidget(widget, widgetOptions);
} else if (!preview && widget.isPreview) {
widget.convertToNonPreview();
}
if (mode === 'activate') {
await this.shell.activateWidget(widget.id);
} else if (mode === 'reveal') {
await this.shell.revealWidget(widget.id);
}
await this.revealSelection(widget, uri, options);
}
protected handleNewPreview(newPreviewWidget: EditorPreviewWidget): void {
if (newPreviewWidget.isPreview) {
const tabbar = this.shell.getTabBarFor(newPreviewWidget);
if (tabbar) {
for (const title of tabbar.titles) {
if (title.owner !== newPreviewWidget && title.owner instanceof EditorPreviewWidget && title.owner.isPreview) {
title.owner.dispose();
}
}
}
}
}
protected override tryGetPendingWidget(uri: URI, options?: EditorOpenerOptions): MaybePromise<EditorWidget> | undefined {
return super.tryGetPendingWidget(uri, { ...options, preview: true } as WidgetOpenerOptions) ??
super.tryGetPendingWidget(uri, { ...options, preview: false } as WidgetOpenerOptions);
}
protected override async getWidget(uri: URI, options?: EditorOpenerOptions): Promise<EditorWidget | undefined> {
return (await super.getWidget(uri, { ...options, preview: true } as WidgetOpenerOptions)) ?? super.getWidget(uri, { ...options, preview: false } as WidgetOpenerOptions);
}
protected override async getOrCreateWidget(uri: URI, options?: EditorOpenerOptions): Promise<EditorWidget> {
return this.tryGetPendingWidget(uri, options) ?? super.getOrCreateWidget(uri, options);
}
protected override createWidgetOptions(uri: URI, options?: EditorOpenerOptions): EditorPreviewOptions {
const navigatableOptions = super.createWidgetOptions(uri, options) as EditorPreviewOptions;
navigatableOptions.preview = !!(options?.preview && this.preferences['editor.enablePreview']);
return navigatableOptions;
}
protected convertEditorOnDoubleClick(event: Event): void {
const widget = this.shell.findTargetedWidget(event);
if (widget instanceof EditorPreviewWidget && widget.isPreview) {
widget.convertToNonPreview();
}
}
}

View File

@@ -0,0 +1,106 @@
// *****************************************************************************
// Copyright (C) 2021 Ericsson and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { injectable, inject } from '@theia/core/shared/inversify';
import { TreeDecorator, TreeDecoration } from '@theia/core/lib/browser/tree/tree-decorator';
import { Emitter } from '@theia/core/lib/common/event';
import { Tree } from '@theia/core/lib/browser/tree/tree';
import {
ApplicationShell,
DepthFirstTreeIterator,
FrontendApplication,
FrontendApplicationContribution,
NavigatableWidget,
Saveable,
Widget,
} from '@theia/core/lib/browser';
import { Disposable } from '@theia/core/lib/common';
import { OpenEditorNode } from '@theia/navigator/lib/browser/open-editors-widget/navigator-open-editors-tree-model';
import { EditorPreviewWidget } from './editor-preview-widget';
@injectable()
export class EditorPreviewTreeDecorator implements TreeDecorator, FrontendApplicationContribution {
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
readonly id = 'theia-open-editors-file-decorator';
protected decorationsMap = new Map<string, TreeDecoration.Data>();
protected readonly decorationsChangedEmitter = new Emitter();
readonly onDidChangeDecorations = this.decorationsChangedEmitter.event;
protected readonly toDisposeOnDirtyChanged = new Map<string, Disposable>();
protected readonly toDisposeOnPreviewPinned = new Map<string, Disposable>();
onDidInitializeLayout(app: FrontendApplication): void {
this.shell.onDidAddWidget(widget => this.registerEditorListeners(widget));
this.shell.onDidRemoveWidget(widget => this.unregisterEditorListeners(widget));
this.editorWidgets.forEach(widget => this.registerEditorListeners(widget));
}
protected registerEditorListeners(widget: Widget): void {
const saveable = Saveable.get(widget);
if (saveable) {
this.toDisposeOnDirtyChanged.set(widget.id, saveable.onDirtyChanged(() => {
this.fireDidChangeDecorations((tree: Tree) => this.collectDecorators(tree));
}));
}
if (widget instanceof EditorPreviewWidget) {
this.toDisposeOnPreviewPinned.set(widget.id, widget.onDidChangePreviewState(() => {
this.fireDidChangeDecorations((tree: Tree) => this.collectDecorators(tree));
this.toDisposeOnPreviewPinned.get(widget.id)?.dispose();
this.toDisposeOnDirtyChanged.delete(widget.id);
}));
}
}
protected unregisterEditorListeners(widget: Widget): void {
this.toDisposeOnDirtyChanged.get(widget.id)?.dispose();
this.toDisposeOnDirtyChanged.delete(widget.id);
this.toDisposeOnPreviewPinned.get(widget.id)?.dispose();
this.toDisposeOnPreviewPinned.delete(widget.id);
}
protected get editorWidgets(): NavigatableWidget[] {
return this.shell.widgets.filter((widget): widget is NavigatableWidget => NavigatableWidget.is(widget));
}
protected fireDidChangeDecorations(event: (tree: Tree) => Map<string, TreeDecoration.Data>): void {
this.decorationsChangedEmitter.fire(event);
}
decorations(tree: Tree): Map<string, TreeDecoration.Data> {
return this.collectDecorators(tree);
}
// Add workspace root as caption suffix and italicize if PreviewWidget
protected collectDecorators(tree: Tree): Map<string, TreeDecoration.Data> {
const result = new Map<string, TreeDecoration.Data>();
if (tree.root === undefined) {
return result;
}
for (const node of new DepthFirstTreeIterator(tree.root)) {
if (OpenEditorNode.is(node)) {
const { widget } = node;
const isPreviewWidget = widget instanceof EditorPreviewWidget && widget.isPreview;
const decorations: TreeDecoration.Data = {
fontData: { style: isPreviewWidget ? 'italic' : undefined }
};
result.set(node.id, decorations);
}
}
return result;
}
}

View File

@@ -0,0 +1,45 @@
// *****************************************************************************
// Copyright (C) 2018-2021 Google and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import URI from '@theia/core/lib/common/uri';
import { EditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
import { injectable } from '@theia/core/shared/inversify';
import { EditorPreviewWidget } from './editor-preview-widget';
import { NavigatableWidgetOptions } from '@theia/core/lib/browser';
export interface EditorPreviewOptions extends NavigatableWidgetOptions {
preview?: boolean;
}
@injectable()
export class EditorPreviewWidgetFactory extends EditorWidgetFactory {
static override ID: string = 'editor-preview-widget';
override readonly id = EditorPreviewWidgetFactory.ID;
override async createWidget(options: EditorPreviewOptions): Promise<EditorPreviewWidget> {
const uri = new URI(options.uri);
const editor = await this.createEditor(uri, options) as EditorPreviewWidget;
if (options.preview) {
editor.initializePreview();
}
return editor;
}
protected override async constructEditor(uri: URI): Promise<EditorPreviewWidget> {
const textEditor = await this.editorProvider(uri);
return new EditorPreviewWidget(textEditor, this.selectionService);
}
}

View File

@@ -0,0 +1,90 @@
// *****************************************************************************
// Copyright (C) 2021 Ericsson and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { TabBar, Widget, PINNED_CLASS } from '@theia/core/lib/browser';
import { EditorWidget, TextEditor } from '@theia/editor/lib/browser';
import { Disposable, DisposableCollection, Emitter, SelectionService, UNTITLED_SCHEME } from '@theia/core/lib/common';
const PREVIEW_TITLE_CLASS = 'theia-editor-preview-title-unpinned';
export class EditorPreviewWidget extends EditorWidget {
protected _isPreview = false;
protected readonly onDidChangePreviewStateEmitter = new Emitter<void>();
readonly onDidChangePreviewState = this.onDidChangePreviewStateEmitter.event;
get isPreview(): boolean {
return this._isPreview;
}
constructor(
editor: TextEditor,
selectionService: SelectionService
) {
super(editor, selectionService);
this.toDispose.push(this.onDidChangePreviewStateEmitter);
}
initializePreview(): void {
const oneTimeListeners = new DisposableCollection();
this._isPreview = true;
this.title.className += ` ${PREVIEW_TITLE_CLASS}`;
const oneTimeDirtyChangeListener = this.saveable.onDirtyChanged(() => {
this.convertToNonPreview();
oneTimeListeners.dispose();
});
oneTimeListeners.push(oneTimeDirtyChangeListener);
const oneTimeTitleChangeHandler = () => {
if (this.title.className.includes(PINNED_CLASS)) {
this.convertToNonPreview();
oneTimeListeners.dispose();
}
};
this.title.changed.connect(oneTimeTitleChangeHandler);
oneTimeListeners.push(Disposable.create(() => this.title.changed.disconnect(oneTimeTitleChangeHandler)));
this.toDispose.push(oneTimeListeners);
}
convertToNonPreview(): void {
if (this._isPreview) {
this._isPreview = false;
this.currentTabbar = undefined;
this.title.className = this.title.className.replace(PREVIEW_TITLE_CLASS, '');
this.onDidChangePreviewStateEmitter.fire();
this.onDidChangePreviewStateEmitter.dispose();
}
}
protected override handleTabBarChange(oldTabBar?: TabBar<Widget> | undefined, newTabBar?: TabBar<Widget> | undefined): void {
super.handleTabBarChange(oldTabBar, newTabBar);
if (this._isPreview) {
if (oldTabBar && newTabBar) { this.convertToNonPreview(); }
}
}
override storeState(): { isPreview: boolean, editorState: object } | undefined {
if (this.getResourceUri()?.scheme !== UNTITLED_SCHEME) {
const { _isPreview: isPreview } = this;
return { isPreview, editorState: this.editor.storeViewState() };
}
}
override restoreState(oldState: { isPreview: boolean, editorState: object }): void {
if (!oldState.isPreview) {
this.convertToNonPreview();
}
this.editor.restoreViewState(oldState.editorState);
}
}

View File

@@ -0,0 +1,23 @@
/********************************************************************************
* Copyright (C) 2018 Google and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
********************************************************************************/
.theia-editor-preview {
height: 100%;
}
.theia-editor-preview-title-unpinned .lm-TabBar-tabLabel {
font-style: italic;
}

View File

@@ -0,0 +1,17 @@
/********************************************************************************
* Copyright (C) 2018 Google and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
********************************************************************************/
@import "./editor-preview-widget.css";

View File

@@ -0,0 +1,52 @@
// *****************************************************************************
// Copyright (C) 2018 Google and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { interfaces } from '@theia/core/shared/inversify';
import { createPreferenceProxy, PreferenceContribution, PreferenceProxy, PreferenceSchema, PreferenceService } from '@theia/core/lib/common';
import { nls } from '@theia/core/lib/common/nls';
export const EditorPreviewConfigSchema: PreferenceSchema = {
properties: {
'editor.enablePreview': {
type: 'boolean',
// eslint-disable-next-line max-len
description: nls.localizeByDefault("Controls whether preview mode is used when editors open. There is a maximum of one preview mode editor per editor group. This editor displays its filename in italics on its tab or title label and in the Open Editors view. Its contents will be replaced by the next editor opened in preview mode. Making a change in a preview mode editor will persist it, as will a double-click on its label, or the 'Keep Open' option in its label context menu. Opening a file from Explorer with a double-click persists its editor immediately."),
default: true
},
}
};
export interface EditorPreviewConfiguration {
'editor.enablePreview': boolean;
}
export const EditorPreviewPreferenceContribution = Symbol('EditorPreviewPreferenceContribution');
export const EditorPreviewPreferences = Symbol('EditorPreviewPreferences');
export type EditorPreviewPreferences = PreferenceProxy<EditorPreviewConfiguration>;
export function createEditorPreviewPreferences(preferences: PreferenceService, schema: PreferenceSchema = EditorPreviewConfigSchema): EditorPreviewPreferences {
return createPreferenceProxy(preferences, schema);
}
export function bindEditorPreviewPreferences(bind: interfaces.Bind): void {
bind(EditorPreviewPreferences).toDynamicValue(ctx => {
const preferences = ctx.container.get<PreferenceService>(PreferenceService);
const contribution = ctx.container.get<PreferenceContribution>(EditorPreviewPreferenceContribution);
return createEditorPreviewPreferences(preferences, contribution.schema);
}).inSingletonScope();
bind(EditorPreviewPreferenceContribution).toConstantValue({ schema: EditorPreviewConfigSchema });
bind(PreferenceContribution).toService(EditorPreviewPreferenceContribution);
}

View File

@@ -0,0 +1,22 @@
// *****************************************************************************
// Copyright (C) 2025 STMicroelectronics and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
import { ContainerModule } from '@theia/core/shared/inversify';
import { bindEditorPreviewPreferences } from '../common/editor-preview-preferences';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bindEditorPreviewPreferences(bind);
});

View File

@@ -0,0 +1,28 @@
// *****************************************************************************
// Copyright (C) 2018 Google and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
/* note: this bogus test file is required so that
we are able to run mocha unit tests on this
package, without having any actual unit tests in it.
This way a coverage report will be generated,
showing 0% coverage, instead of no report.
This file can be removed once we have real unit
tests in place. */
describe('editor package', () => {
it('support code coverage statistics', () => true);
});