@theia/output 1.45.1 → 1.46.0-next.72

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.
Files changed (44) hide show
  1. package/README.md +33 -33
  2. package/lib/browser/output-channel.d.ts +125 -125
  3. package/lib/browser/output-channel.js +334 -334
  4. package/lib/browser/output-commands.d.ts +17 -17
  5. package/lib/browser/output-commands.js +84 -84
  6. package/lib/browser/output-context-menu.d.ts +11 -11
  7. package/lib/browser/output-context-menu.js +42 -42
  8. package/lib/browser/output-contribution.d.ts +29 -29
  9. package/lib/browser/output-contribution.js +284 -284
  10. package/lib/browser/output-editor-factory.d.ts +12 -12
  11. package/lib/browser/output-editor-factory.d.ts.map +1 -1
  12. package/lib/browser/output-editor-factory.js +79 -84
  13. package/lib/browser/output-editor-factory.js.map +1 -1
  14. package/lib/browser/output-editor-model-factory.d.ts +15 -15
  15. package/lib/browser/output-editor-model-factory.js +61 -61
  16. package/lib/browser/output-frontend-module.d.ts +3 -3
  17. package/lib/browser/output-frontend-module.js +50 -50
  18. package/lib/browser/output-preferences.d.ts +11 -11
  19. package/lib/browser/output-preferences.js +46 -46
  20. package/lib/browser/output-resource.d.ts +18 -18
  21. package/lib/browser/output-resource.js +54 -54
  22. package/lib/browser/output-toolbar-contribution.d.ts +21 -21
  23. package/lib/browser/output-toolbar-contribution.js +125 -125
  24. package/lib/browser/output-widget.d.ts +48 -48
  25. package/lib/browser/output-widget.js +248 -248
  26. package/lib/common/output-uri.d.ts +7 -7
  27. package/lib/common/output-uri.js +47 -47
  28. package/lib/common/output-uri.spec.d.ts +1 -1
  29. package/lib/common/output-uri.spec.js +50 -50
  30. package/package.json +7 -7
  31. package/src/browser/output-channel.ts +366 -366
  32. package/src/browser/output-commands.ts +100 -100
  33. package/src/browser/output-context-menu.ts +34 -34
  34. package/src/browser/output-contribution.ts +274 -274
  35. package/src/browser/output-editor-factory.ts +68 -74
  36. package/src/browser/output-editor-model-factory.ts +54 -54
  37. package/src/browser/output-frontend-module.ts +53 -53
  38. package/src/browser/output-preferences.ts +58 -58
  39. package/src/browser/output-resource.ts +65 -65
  40. package/src/browser/output-toolbar-contribution.tsx +116 -116
  41. package/src/browser/output-widget.ts +256 -256
  42. package/src/browser/style/output.css +31 -31
  43. package/src/common/output-uri.spec.ts +53 -53
  44. package/src/common/output-uri.ts +47 -47
@@ -1,74 +1,68 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import URI from '@theia/core/lib/common/uri';
19
- import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
20
- import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
21
- import { MonacoContextMenuService } from '@theia/monaco/lib/browser/monaco-context-menu';
22
- import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
23
- import { OutputUri } from '../common/output-uri';
24
- import { OutputContextMenuService } from './output-context-menu';
25
- import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
26
-
27
- @injectable()
28
- export class OutputEditorFactory implements MonacoEditorFactory {
29
-
30
- @inject(MonacoEditorServices)
31
- protected readonly services: MonacoEditorServices;
32
-
33
- @inject(OutputContextMenuService)
34
- protected readonly contextMenuService: MonacoContextMenuService;
35
-
36
- readonly scheme: string = OutputUri.SCHEME;
37
-
38
- create(model: MonacoEditorModel, defaultsOptions: MonacoEditor.IOptions, defaultOverrides: EditorServiceOverrides): MonacoEditor {
39
- const uri = new URI(model.uri);
40
- const options = this.createOptions(model, defaultsOptions);
41
- const overrides = this.createOverrides(model, defaultOverrides);
42
- return new MonacoEditor(uri, model, document.createElement('div'), this.services, options, overrides);
43
- }
44
-
45
- protected createOptions(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions): MonacoEditor.IOptions {
46
- return {
47
- ...defaultOptions,
48
- overviewRulerLanes: 3,
49
- lineNumbersMinChars: 3,
50
- fixedOverflowWidgets: true,
51
- wordWrap: 'off',
52
- lineNumbers: 'off',
53
- glyphMargin: false,
54
- lineDecorationsWidth: 20,
55
- rulers: [],
56
- folding: false,
57
- scrollBeyondLastLine: false,
58
- readOnly: true,
59
- renderLineHighlight: 'none',
60
- minimap: { enabled: false },
61
- matchBrackets: 'never'
62
- };
63
- }
64
-
65
- protected *createOverrides(model: MonacoEditorModel, defaultOverrides: EditorServiceOverrides): EditorServiceOverrides {
66
- yield [IContextMenuService, this.contextMenuService];
67
- for (const [identifier, provider] of defaultOverrides) {
68
- if (identifier !== IContextMenuService) {
69
- yield [identifier, provider];
70
- }
71
- }
72
- }
73
-
74
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import URI from '@theia/core/lib/common/uri';
19
+ import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
20
+ import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
21
+ import { MonacoContextMenuService } from '@theia/monaco/lib/browser/monaco-context-menu';
22
+ import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
23
+ import { OutputUri } from '../common/output-uri';
24
+ import { OutputContextMenuService } from './output-context-menu';
25
+ import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
26
+
27
+ @injectable()
28
+ export class OutputEditorFactory implements MonacoEditorFactory {
29
+
30
+ @inject(MonacoEditorServices)
31
+ protected readonly services: MonacoEditorServices;
32
+
33
+ @inject(OutputContextMenuService)
34
+ protected readonly contextMenuService: MonacoContextMenuService;
35
+
36
+ readonly scheme: string = OutputUri.SCHEME;
37
+
38
+ create(model: MonacoEditorModel, defaultsOptions: MonacoEditor.IOptions): MonacoEditor {
39
+ const uri = new URI(model.uri);
40
+ const options = this.createOptions(model, defaultsOptions);
41
+ const overrides = this.createOverrides(model);
42
+ return new MonacoEditor(uri, model, document.createElement('div'), this.services, options, overrides);
43
+ }
44
+
45
+ protected createOptions(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions): MonacoEditor.IOptions {
46
+ return {
47
+ ...defaultOptions,
48
+ overviewRulerLanes: 3,
49
+ lineNumbersMinChars: 3,
50
+ fixedOverflowWidgets: true,
51
+ wordWrap: 'off',
52
+ lineNumbers: 'off',
53
+ glyphMargin: false,
54
+ lineDecorationsWidth: 20,
55
+ rulers: [],
56
+ folding: false,
57
+ scrollBeyondLastLine: false,
58
+ readOnly: true,
59
+ renderLineHighlight: 'none',
60
+ minimap: { enabled: false },
61
+ matchBrackets: 'never'
62
+ };
63
+ }
64
+
65
+ protected *createOverrides(model: MonacoEditorModel): EditorServiceOverrides {
66
+ yield [IContextMenuService, this.contextMenuService];
67
+ }
68
+ }
@@ -1,54 +1,54 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { Resource } from '@theia/core/lib/common/resource';
19
- import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
20
- import { OutputUri } from '../common/output-uri';
21
- import { MonacoEditorModelFactory } from '@theia/monaco/lib/browser/monaco-text-model-service';
22
- import { MonacoToProtocolConverter } from '@theia/monaco/lib/browser/monaco-to-protocol-converter';
23
- import { ProtocolToMonacoConverter } from '@theia/monaco/lib/browser/protocol-to-monaco-converter';
24
-
25
- @injectable()
26
- export class OutputEditorModelFactory implements MonacoEditorModelFactory {
27
-
28
- @inject(MonacoToProtocolConverter)
29
- protected readonly m2p: MonacoToProtocolConverter;
30
-
31
- @inject(ProtocolToMonacoConverter)
32
- protected readonly p2m: ProtocolToMonacoConverter;
33
-
34
- readonly scheme: string = OutputUri.SCHEME;
35
-
36
- createModel(
37
- resource: Resource
38
- ): MonacoEditorModel {
39
- return new OutputEditorModel(resource, this.m2p, this.p2m);
40
- }
41
-
42
- }
43
-
44
- export class OutputEditorModel extends MonacoEditorModel {
45
-
46
- override get readOnly(): boolean {
47
- return true;
48
- }
49
-
50
- protected override setDirty(dirty: boolean): void {
51
- // NOOP
52
- }
53
-
54
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { Resource } from '@theia/core/lib/common/resource';
19
+ import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
20
+ import { OutputUri } from '../common/output-uri';
21
+ import { MonacoEditorModelFactory } from '@theia/monaco/lib/browser/monaco-text-model-service';
22
+ import { MonacoToProtocolConverter } from '@theia/monaco/lib/browser/monaco-to-protocol-converter';
23
+ import { ProtocolToMonacoConverter } from '@theia/monaco/lib/browser/protocol-to-monaco-converter';
24
+
25
+ @injectable()
26
+ export class OutputEditorModelFactory implements MonacoEditorModelFactory {
27
+
28
+ @inject(MonacoToProtocolConverter)
29
+ protected readonly m2p: MonacoToProtocolConverter;
30
+
31
+ @inject(ProtocolToMonacoConverter)
32
+ protected readonly p2m: ProtocolToMonacoConverter;
33
+
34
+ readonly scheme: string = OutputUri.SCHEME;
35
+
36
+ createModel(
37
+ resource: Resource
38
+ ): MonacoEditorModel {
39
+ return new OutputEditorModel(resource, this.m2p, this.p2m);
40
+ }
41
+
42
+ }
43
+
44
+ export class OutputEditorModel extends MonacoEditorModel {
45
+
46
+ override get readOnly(): boolean {
47
+ return true;
48
+ }
49
+
50
+ protected override setDirty(dirty: boolean): void {
51
+ // NOOP
52
+ }
53
+
54
+ }
@@ -1,53 +1,53 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ContainerModule } from '@theia/core/shared/inversify';
18
- import { OutputWidget } from './output-widget';
19
- import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
20
- import { ResourceResolver } from '@theia/core/lib/common';
21
- import { WidgetFactory, bindViewContribution, OpenHandler } from '@theia/core/lib/browser';
22
- import { OutputChannelManager } from './output-channel';
23
- import { bindOutputPreferences } from './output-preferences';
24
- import { OutputToolbarContribution } from './output-toolbar-contribution';
25
- import { OutputContribution } from './output-contribution';
26
- import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
27
- import { OutputContextMenuService } from './output-context-menu';
28
- import { OutputEditorFactory } from './output-editor-factory';
29
- import { MonacoEditorModelFactory } from '@theia/monaco/lib/browser/monaco-text-model-service';
30
- import { OutputEditorModelFactory } from './output-editor-model-factory';
31
-
32
- export default new ContainerModule(bind => {
33
- bind(OutputChannelManager).toSelf().inSingletonScope();
34
- bind(ResourceResolver).toService(OutputChannelManager);
35
- bind(OutputEditorFactory).toSelf().inSingletonScope();
36
- bind(MonacoEditorFactory).toService(OutputEditorFactory);
37
- bind(OutputEditorModelFactory).toSelf().inSingletonScope();
38
- bind(MonacoEditorModelFactory).toService(OutputEditorModelFactory);
39
- bind(OutputContextMenuService).toSelf().inSingletonScope();
40
-
41
- bindOutputPreferences(bind);
42
-
43
- bind(OutputWidget).toSelf();
44
- bind(WidgetFactory).toDynamicValue(context => ({
45
- id: OutputWidget.ID,
46
- createWidget: () => context.container.get<OutputWidget>(OutputWidget)
47
- }));
48
- bindViewContribution(bind, OutputContribution);
49
- bind(OpenHandler).to(OutputContribution).inSingletonScope();
50
-
51
- bind(OutputToolbarContribution).toSelf().inSingletonScope();
52
- bind(TabBarToolbarContribution).toService(OutputToolbarContribution);
53
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ContainerModule } from '@theia/core/shared/inversify';
18
+ import { OutputWidget } from './output-widget';
19
+ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
20
+ import { ResourceResolver } from '@theia/core/lib/common';
21
+ import { WidgetFactory, bindViewContribution, OpenHandler } from '@theia/core/lib/browser';
22
+ import { OutputChannelManager } from './output-channel';
23
+ import { bindOutputPreferences } from './output-preferences';
24
+ import { OutputToolbarContribution } from './output-toolbar-contribution';
25
+ import { OutputContribution } from './output-contribution';
26
+ import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
27
+ import { OutputContextMenuService } from './output-context-menu';
28
+ import { OutputEditorFactory } from './output-editor-factory';
29
+ import { MonacoEditorModelFactory } from '@theia/monaco/lib/browser/monaco-text-model-service';
30
+ import { OutputEditorModelFactory } from './output-editor-model-factory';
31
+
32
+ export default new ContainerModule(bind => {
33
+ bind(OutputChannelManager).toSelf().inSingletonScope();
34
+ bind(ResourceResolver).toService(OutputChannelManager);
35
+ bind(OutputEditorFactory).toSelf().inSingletonScope();
36
+ bind(MonacoEditorFactory).toService(OutputEditorFactory);
37
+ bind(OutputEditorModelFactory).toSelf().inSingletonScope();
38
+ bind(MonacoEditorModelFactory).toService(OutputEditorModelFactory);
39
+ bind(OutputContextMenuService).toSelf().inSingletonScope();
40
+
41
+ bindOutputPreferences(bind);
42
+
43
+ bind(OutputWidget).toSelf();
44
+ bind(WidgetFactory).toDynamicValue(context => ({
45
+ id: OutputWidget.ID,
46
+ createWidget: () => context.container.get<OutputWidget>(OutputWidget)
47
+ }));
48
+ bindViewContribution(bind, OutputContribution);
49
+ bind(OpenHandler).to(OutputContribution).inSingletonScope();
50
+
51
+ bind(OutputToolbarContribution).toSelf().inSingletonScope();
52
+ bind(TabBarToolbarContribution).toService(OutputToolbarContribution);
53
+ });
@@ -1,58 +1,58 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { interfaces } from '@theia/core/shared/inversify';
18
- import {
19
- PreferenceContribution,
20
- PreferenceProxy,
21
- PreferenceSchema,
22
- PreferenceService,
23
- createPreferenceProxy
24
- } from '@theia/core/lib/browser/preferences';
25
- import { nls } from '@theia/core/lib/common/nls';
26
-
27
- export const OutputConfigSchema: PreferenceSchema = {
28
- 'type': 'object',
29
- 'properties': {
30
- 'output.maxChannelHistory': {
31
- 'type': 'number',
32
- 'description': nls.localize('theia/output/maxChannelHistory', 'The maximum number of entries in an output channel.'),
33
- 'default': 1000
34
- }
35
- }
36
- };
37
-
38
- export interface OutputConfiguration {
39
- 'output.maxChannelHistory': number
40
- }
41
-
42
- export const OutputPreferenceContribution = Symbol('OutputPreferenceContribution');
43
- export const OutputPreferences = Symbol('OutputPreferences');
44
- export type OutputPreferences = PreferenceProxy<OutputConfiguration>;
45
-
46
- export function createOutputPreferences(preferences: PreferenceService, schema: PreferenceSchema = OutputConfigSchema): OutputPreferences {
47
- return createPreferenceProxy(preferences, schema);
48
- }
49
-
50
- export function bindOutputPreferences(bind: interfaces.Bind): void {
51
- bind(OutputPreferences).toDynamicValue(ctx => {
52
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
- const contribution = ctx.container.get<PreferenceContribution>(OutputPreferenceContribution);
54
- return createOutputPreferences(preferences, contribution.schema);
55
- }).inSingletonScope();
56
- bind(OutputPreferenceContribution).toConstantValue({ schema: OutputConfigSchema });
57
- bind(PreferenceContribution).toService(OutputPreferenceContribution);
58
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { interfaces } from '@theia/core/shared/inversify';
18
+ import {
19
+ PreferenceContribution,
20
+ PreferenceProxy,
21
+ PreferenceSchema,
22
+ PreferenceService,
23
+ createPreferenceProxy
24
+ } from '@theia/core/lib/browser/preferences';
25
+ import { nls } from '@theia/core/lib/common/nls';
26
+
27
+ export const OutputConfigSchema: PreferenceSchema = {
28
+ 'type': 'object',
29
+ 'properties': {
30
+ 'output.maxChannelHistory': {
31
+ 'type': 'number',
32
+ 'description': nls.localize('theia/output/maxChannelHistory', 'The maximum number of entries in an output channel.'),
33
+ 'default': 1000
34
+ }
35
+ }
36
+ };
37
+
38
+ export interface OutputConfiguration {
39
+ 'output.maxChannelHistory': number
40
+ }
41
+
42
+ export const OutputPreferenceContribution = Symbol('OutputPreferenceContribution');
43
+ export const OutputPreferences = Symbol('OutputPreferences');
44
+ export type OutputPreferences = PreferenceProxy<OutputConfiguration>;
45
+
46
+ export function createOutputPreferences(preferences: PreferenceService, schema: PreferenceSchema = OutputConfigSchema): OutputPreferences {
47
+ return createPreferenceProxy(preferences, schema);
48
+ }
49
+
50
+ export function bindOutputPreferences(bind: interfaces.Bind): void {
51
+ bind(OutputPreferences).toDynamicValue(ctx => {
52
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
+ const contribution = ctx.container.get<PreferenceContribution>(OutputPreferenceContribution);
54
+ return createOutputPreferences(preferences, contribution.schema);
55
+ }).inSingletonScope();
56
+ bind(OutputPreferenceContribution).toConstantValue({ schema: OutputConfigSchema });
57
+ bind(PreferenceContribution).toService(OutputPreferenceContribution);
58
+ }
@@ -1,65 +1,65 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import URI from '@theia/core/lib/common/uri';
18
- import { Event, Resource, ResourceReadOptions, DisposableCollection, Emitter } from '@theia/core/lib/common';
19
- import { Deferred } from '@theia/core/lib/common/promise-util';
20
- import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
21
- import { IReference } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
22
- import * as monaco from '@theia/monaco-editor-core';
23
-
24
- export class OutputResource implements Resource {
25
-
26
- protected _textModel: monaco.editor.ITextModel | undefined;
27
- protected onDidChangeContentsEmitter = new Emitter<void>();
28
- protected toDispose = new DisposableCollection(
29
- this.onDidChangeContentsEmitter
30
- );
31
-
32
- constructor(readonly uri: URI, readonly editorModelRef: Deferred<IReference<MonacoEditorModel>>) {
33
- this.editorModelRef.promise.then(modelRef => {
34
- if (this.toDispose.disposed) {
35
- modelRef.dispose();
36
- return;
37
- }
38
- const textModel = modelRef.object.textEditorModel;
39
- this._textModel = textModel;
40
- this.toDispose.push(modelRef);
41
- this.toDispose.push(this._textModel!.onDidChangeContent(() => this.onDidChangeContentsEmitter.fire()));
42
- });
43
- }
44
-
45
- get textModel(): monaco.editor.ITextModel | undefined {
46
- return this._textModel;
47
- }
48
-
49
- get onDidChangeContents(): Event<void> {
50
- return this.onDidChangeContentsEmitter.event;
51
- }
52
-
53
- async readContents(options?: ResourceReadOptions): Promise<string> {
54
- if (this._textModel) {
55
- const modelRef = await this.editorModelRef.promise;
56
- return modelRef.object.textEditorModel.getValue();
57
- }
58
- return '';
59
- }
60
-
61
- dispose(): void {
62
- this.toDispose.dispose();
63
- }
64
-
65
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import URI from '@theia/core/lib/common/uri';
18
+ import { Event, Resource, ResourceReadOptions, DisposableCollection, Emitter } from '@theia/core/lib/common';
19
+ import { Deferred } from '@theia/core/lib/common/promise-util';
20
+ import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
21
+ import { IReference } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
22
+ import * as monaco from '@theia/monaco-editor-core';
23
+
24
+ export class OutputResource implements Resource {
25
+
26
+ protected _textModel: monaco.editor.ITextModel | undefined;
27
+ protected onDidChangeContentsEmitter = new Emitter<void>();
28
+ protected toDispose = new DisposableCollection(
29
+ this.onDidChangeContentsEmitter
30
+ );
31
+
32
+ constructor(readonly uri: URI, readonly editorModelRef: Deferred<IReference<MonacoEditorModel>>) {
33
+ this.editorModelRef.promise.then(modelRef => {
34
+ if (this.toDispose.disposed) {
35
+ modelRef.dispose();
36
+ return;
37
+ }
38
+ const textModel = modelRef.object.textEditorModel;
39
+ this._textModel = textModel;
40
+ this.toDispose.push(modelRef);
41
+ this.toDispose.push(this._textModel!.onDidChangeContent(() => this.onDidChangeContentsEmitter.fire()));
42
+ });
43
+ }
44
+
45
+ get textModel(): monaco.editor.ITextModel | undefined {
46
+ return this._textModel;
47
+ }
48
+
49
+ get onDidChangeContents(): Event<void> {
50
+ return this.onDidChangeContentsEmitter.event;
51
+ }
52
+
53
+ async readContents(options?: ResourceReadOptions): Promise<string> {
54
+ if (this._textModel) {
55
+ const modelRef = await this.editorModelRef.promise;
56
+ return modelRef.object.textEditorModel.getValue();
57
+ }
58
+ return '';
59
+ }
60
+
61
+ dispose(): void {
62
+ this.toDispose.dispose();
63
+ }
64
+
65
+ }