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

Make Notebook preferences registration substitutable #13926

Merged
merged 1 commit into from
Jul 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
*--------------------------------------------------------------------------------------------*/

import { nls } from '@theia/core';
import { PreferenceSchema } from '@theia/core/lib/browser';
import { interfaces } from '@theia/core/shared/inversify';
import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser';

export namespace NotebookPreferences {
export const NOTEBOOK_LINE_NUMBERS = 'notebook.lineNumbers';
Expand Down Expand Up @@ -81,3 +82,11 @@ export const notebookPreferenceSchema: PreferenceSchema = {

}
};

export const NotebookPreferenceContribution = Symbol('NotebookPreferenceContribution');

export function bindNotebookPreferences(bind: interfaces.Bind): void {
// We don't need a NotebookPreferenceConfiguration class, so there's no preference proxy to bind
bind(NotebookPreferenceContribution).toConstantValue({ schema: notebookPreferenceSchema });
bind(PreferenceContribution).toService(NotebookPreferenceContribution);
}
6 changes: 3 additions & 3 deletions packages/notebook/src/browser/notebook-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import '../../src/browser/style/index.css';

import { ContainerModule } from '@theia/core/shared/inversify';
import { FrontendApplicationContribution, KeybindingContribution, LabelProviderContribution, OpenHandler, PreferenceContribution, WidgetFactory } from '@theia/core/lib/browser';
import { FrontendApplicationContribution, KeybindingContribution, LabelProviderContribution, OpenHandler, WidgetFactory } from '@theia/core/lib/browser';
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
import { NotebookOpenHandler } from './notebook-open-handler';
import { CommandContribution, MenuContribution, ResourceResolver, } from '@theia/core';
Expand Down Expand Up @@ -44,7 +44,7 @@ import { NotebookOutlineContribution } from './contributions/notebook-outline-co
import { NotebookLabelProviderContribution } from './contributions/notebook-label-provider-contribution';
import { NotebookOutputActionContribution } from './contributions/notebook-output-action-contribution';
import { NotebookClipboardService } from './service/notebook-clipboard-service';
import { notebookPreferenceSchema } from './contributions/notebook-preferences';
import { bindNotebookPreferences } from './contributions/notebook-preferences';
import { NotebookOptionsService } from './service/notebook-options';

export default new ContainerModule((bind, unbind, isBound, rebind) => {
Expand Down Expand Up @@ -106,6 +106,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(NotebookLabelProviderContribution).toSelf().inSingletonScope();
bind(LabelProviderContribution).toService(NotebookLabelProviderContribution);

bind(PreferenceContribution).toConstantValue({ schema: notebookPreferenceSchema });
bindNotebookPreferences(bind);
bind(NotebookOptionsService).toSelf().inSingletonScope();
});
Loading