@theia/console 1.34.2 → 1.34.3

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 (36) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +30 -30
  3. package/lib/browser/ansi-console-item.d.ts +12 -12
  4. package/lib/browser/ansi-console-item.js +38 -38
  5. package/lib/browser/console-content-widget.d.ts +17 -17
  6. package/lib/browser/console-content-widget.js +90 -90
  7. package/lib/browser/console-contribution.d.ts +33 -33
  8. package/lib/browser/console-contribution.js +144 -144
  9. package/lib/browser/console-frontend-module.d.ts +4 -4
  10. package/lib/browser/console-frontend-module.js +36 -36
  11. package/lib/browser/console-history.d.ts +19 -19
  12. package/lib/browser/console-history.js +74 -74
  13. package/lib/browser/console-keybinding-contexts.d.ts +39 -39
  14. package/lib/browser/console-keybinding-contexts.js +118 -118
  15. package/lib/browser/console-manager.d.ts +7 -7
  16. package/lib/browser/console-manager.js +48 -48
  17. package/lib/browser/console-session-manager.d.ts +31 -31
  18. package/lib/browser/console-session-manager.js +116 -116
  19. package/lib/browser/console-session.d.ts +27 -27
  20. package/lib/browser/console-session.js +56 -56
  21. package/lib/browser/console-widget.d.ts +62 -62
  22. package/lib/browser/console-widget.js +247 -247
  23. package/lib/package.spec.js +25 -25
  24. package/package.json +5 -5
  25. package/src/browser/ansi-console-item.tsx +48 -48
  26. package/src/browser/console-content-widget.tsx +91 -91
  27. package/src/browser/console-contribution.ts +144 -144
  28. package/src/browser/console-frontend-module.ts +37 -37
  29. package/src/browser/console-history.ts +76 -76
  30. package/src/browser/console-keybinding-contexts.ts +107 -107
  31. package/src/browser/console-manager.ts +37 -37
  32. package/src/browser/console-session-manager.ts +121 -121
  33. package/src/browser/console-session.ts +61 -61
  34. package/src/browser/console-widget.ts +273 -273
  35. package/src/browser/style/index.css +49 -49
  36. package/src/package.spec.ts +28 -28
@@ -1,76 +1,76 @@
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 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable } from '@theia/core/shared/inversify';
18
-
19
- @injectable()
20
- export class ConsoleHistory {
21
-
22
- static limit = 50;
23
-
24
- protected values: string[] = [];
25
- protected index = -1;
26
-
27
- push(value: string): void {
28
- this.delete(value);
29
- this.values.push(value);
30
- this.trim();
31
- this.index = this.values.length;
32
- }
33
- protected delete(value: string): void {
34
- const index = this.values.indexOf(value);
35
- if (index !== -1) {
36
- this.values.splice(index, 1);
37
- }
38
- }
39
- protected trim(): void {
40
- const index = this.values.length - ConsoleHistory.limit;
41
- if (index > 0) {
42
- this.values = this.values.slice(index);
43
- }
44
- }
45
-
46
- get current(): string | undefined {
47
- return this.values[this.index];
48
- }
49
-
50
- get previous(): string | undefined {
51
- this.index = Math.max(this.index - 1, -1);
52
- return this.current;
53
- }
54
-
55
- get next(): string | undefined {
56
- this.index = Math.min(this.index + 1, this.values.length);
57
- return this.current;
58
- }
59
-
60
- store(): ConsoleHistory.Data {
61
- const { values, index } = this;
62
- return { values, index };
63
- }
64
-
65
- restore(object: ConsoleHistory): void {
66
- this.values = object.values;
67
- this.index = object.index;
68
- }
69
-
70
- }
71
- export namespace ConsoleHistory {
72
- export interface Data {
73
- values: string[],
74
- index: number
75
- }
76
- }
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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable } from '@theia/core/shared/inversify';
18
+
19
+ @injectable()
20
+ export class ConsoleHistory {
21
+
22
+ static limit = 50;
23
+
24
+ protected values: string[] = [];
25
+ protected index = -1;
26
+
27
+ push(value: string): void {
28
+ this.delete(value);
29
+ this.values.push(value);
30
+ this.trim();
31
+ this.index = this.values.length;
32
+ }
33
+ protected delete(value: string): void {
34
+ const index = this.values.indexOf(value);
35
+ if (index !== -1) {
36
+ this.values.splice(index, 1);
37
+ }
38
+ }
39
+ protected trim(): void {
40
+ const index = this.values.length - ConsoleHistory.limit;
41
+ if (index > 0) {
42
+ this.values = this.values.slice(index);
43
+ }
44
+ }
45
+
46
+ get current(): string | undefined {
47
+ return this.values[this.index];
48
+ }
49
+
50
+ get previous(): string | undefined {
51
+ this.index = Math.max(this.index - 1, -1);
52
+ return this.current;
53
+ }
54
+
55
+ get next(): string | undefined {
56
+ this.index = Math.min(this.index + 1, this.values.length);
57
+ return this.current;
58
+ }
59
+
60
+ store(): ConsoleHistory.Data {
61
+ const { values, index } = this;
62
+ return { values, index };
63
+ }
64
+
65
+ restore(object: ConsoleHistory): void {
66
+ this.values = object.values;
67
+ this.index = object.index;
68
+ }
69
+
70
+ }
71
+ export namespace ConsoleHistory {
72
+ export interface Data {
73
+ values: string[],
74
+ index: number
75
+ }
76
+ }
@@ -1,107 +1,107 @@
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 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject } from '@theia/core/shared/inversify';
18
- import { KeybindingContext } from '@theia/core/lib/browser';
19
- import { ConsoleManager } from './console-manager';
20
- import { ConsoleWidget } from './console-widget';
21
-
22
- export namespace ConsoleKeybindingContexts {
23
-
24
- /**
25
- * ID of a keybinding context that is enabled when the console content has the focus.
26
- */
27
- export const consoleContentFocus = 'consoleContentFocus';
28
-
29
- /**
30
- * ID of a keybinding context that is enabled when the console input has the focus.
31
- */
32
- export const consoleInputFocus = 'consoleInputFocus';
33
-
34
- /**
35
- * ID of a keybinding context that is enabled when the console history navigation back is enabled.
36
- */
37
- export const consoleNavigationBackEnabled = 'consoleNavigationBackEnabled';
38
-
39
- /**
40
- * ID of a keybinding context that is enabled when the console history navigation forward is enabled.
41
- */
42
- export const consoleNavigationForwardEnabled = 'consoleNavigationForwardEnabled';
43
-
44
- }
45
-
46
- @injectable()
47
- export class ConsoleInputFocusContext implements KeybindingContext {
48
-
49
- readonly id: string = ConsoleKeybindingContexts.consoleInputFocus;
50
-
51
- @inject(ConsoleManager)
52
- protected readonly manager: ConsoleManager;
53
-
54
- isEnabled(): boolean {
55
- const console = this.manager.activeConsole;
56
- return !!console && this.isConsoleEnabled(console);
57
- }
58
-
59
- protected isConsoleEnabled(console: ConsoleWidget): boolean {
60
- return console.hasInputFocus();
61
- }
62
-
63
- }
64
-
65
- @injectable()
66
- export class ConsoleContentFocusContext extends ConsoleInputFocusContext {
67
-
68
- override readonly id: string = ConsoleKeybindingContexts.consoleContentFocus;
69
-
70
- protected override isConsoleEnabled(console: ConsoleWidget): boolean {
71
- return !console.input.isFocused();
72
- }
73
-
74
- }
75
-
76
- @injectable()
77
- export class ConsoleNavigationBackEnabled extends ConsoleInputFocusContext {
78
-
79
- override readonly id: string = ConsoleKeybindingContexts.consoleNavigationBackEnabled;
80
-
81
- protected override isConsoleEnabled(console: ConsoleWidget): boolean {
82
- if (!super.isConsoleEnabled(console)) {
83
- return false;
84
- }
85
- const editor = console.input.getControl();
86
- return editor.getPosition()!.equals({ lineNumber: 1, column: 1 });
87
- }
88
-
89
- }
90
-
91
- @injectable()
92
- export class ConsoleNavigationForwardEnabled extends ConsoleInputFocusContext {
93
-
94
- override readonly id: string = ConsoleKeybindingContexts.consoleNavigationForwardEnabled;
95
-
96
- protected override isConsoleEnabled(console: ConsoleWidget): boolean {
97
- if (!super.isConsoleEnabled(console)) {
98
- return false;
99
- }
100
- const editor = console.input.getControl();
101
- const model = console.input.getControl().getModel()!;
102
- const lineNumber = model.getLineCount();
103
- const column = model.getLineMaxColumn(lineNumber);
104
- return editor.getPosition()!.equals({ lineNumber, column });
105
- }
106
-
107
- }
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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { KeybindingContext } from '@theia/core/lib/browser';
19
+ import { ConsoleManager } from './console-manager';
20
+ import { ConsoleWidget } from './console-widget';
21
+
22
+ export namespace ConsoleKeybindingContexts {
23
+
24
+ /**
25
+ * ID of a keybinding context that is enabled when the console content has the focus.
26
+ */
27
+ export const consoleContentFocus = 'consoleContentFocus';
28
+
29
+ /**
30
+ * ID of a keybinding context that is enabled when the console input has the focus.
31
+ */
32
+ export const consoleInputFocus = 'consoleInputFocus';
33
+
34
+ /**
35
+ * ID of a keybinding context that is enabled when the console history navigation back is enabled.
36
+ */
37
+ export const consoleNavigationBackEnabled = 'consoleNavigationBackEnabled';
38
+
39
+ /**
40
+ * ID of a keybinding context that is enabled when the console history navigation forward is enabled.
41
+ */
42
+ export const consoleNavigationForwardEnabled = 'consoleNavigationForwardEnabled';
43
+
44
+ }
45
+
46
+ @injectable()
47
+ export class ConsoleInputFocusContext implements KeybindingContext {
48
+
49
+ readonly id: string = ConsoleKeybindingContexts.consoleInputFocus;
50
+
51
+ @inject(ConsoleManager)
52
+ protected readonly manager: ConsoleManager;
53
+
54
+ isEnabled(): boolean {
55
+ const console = this.manager.activeConsole;
56
+ return !!console && this.isConsoleEnabled(console);
57
+ }
58
+
59
+ protected isConsoleEnabled(console: ConsoleWidget): boolean {
60
+ return console.hasInputFocus();
61
+ }
62
+
63
+ }
64
+
65
+ @injectable()
66
+ export class ConsoleContentFocusContext extends ConsoleInputFocusContext {
67
+
68
+ override readonly id: string = ConsoleKeybindingContexts.consoleContentFocus;
69
+
70
+ protected override isConsoleEnabled(console: ConsoleWidget): boolean {
71
+ return !console.input.isFocused();
72
+ }
73
+
74
+ }
75
+
76
+ @injectable()
77
+ export class ConsoleNavigationBackEnabled extends ConsoleInputFocusContext {
78
+
79
+ override readonly id: string = ConsoleKeybindingContexts.consoleNavigationBackEnabled;
80
+
81
+ protected override isConsoleEnabled(console: ConsoleWidget): boolean {
82
+ if (!super.isConsoleEnabled(console)) {
83
+ return false;
84
+ }
85
+ const editor = console.input.getControl();
86
+ return editor.getPosition()!.equals({ lineNumber: 1, column: 1 });
87
+ }
88
+
89
+ }
90
+
91
+ @injectable()
92
+ export class ConsoleNavigationForwardEnabled extends ConsoleInputFocusContext {
93
+
94
+ override readonly id: string = ConsoleKeybindingContexts.consoleNavigationForwardEnabled;
95
+
96
+ protected override isConsoleEnabled(console: ConsoleWidget): boolean {
97
+ if (!super.isConsoleEnabled(console)) {
98
+ return false;
99
+ }
100
+ const editor = console.input.getControl();
101
+ const model = console.input.getControl().getModel()!;
102
+ const lineNumber = model.getLineCount();
103
+ const column = model.getLineMaxColumn(lineNumber);
104
+ return editor.getPosition()!.equals({ lineNumber, column });
105
+ }
106
+
107
+ }
@@ -1,37 +1,37 @@
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 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject } from '@theia/core/shared/inversify';
18
- import { ApplicationShell } from '@theia/core/lib/browser';
19
- import { ConsoleWidget } from './console-widget';
20
-
21
- @injectable()
22
- export class ConsoleManager {
23
-
24
- @inject(ApplicationShell)
25
- protected readonly shell: ApplicationShell;
26
-
27
- get activeConsole(): ConsoleWidget | undefined {
28
- const widget = this.shell.activeWidget;
29
- return widget instanceof ConsoleWidget ? widget : undefined;
30
- }
31
-
32
- get currentConsole(): ConsoleWidget | undefined {
33
- const widget = this.shell.currentWidget;
34
- return widget instanceof ConsoleWidget ? widget : undefined;
35
- }
36
-
37
- }
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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject } from '@theia/core/shared/inversify';
18
+ import { ApplicationShell } from '@theia/core/lib/browser';
19
+ import { ConsoleWidget } from './console-widget';
20
+
21
+ @injectable()
22
+ export class ConsoleManager {
23
+
24
+ @inject(ApplicationShell)
25
+ protected readonly shell: ApplicationShell;
26
+
27
+ get activeConsole(): ConsoleWidget | undefined {
28
+ const widget = this.shell.activeWidget;
29
+ return widget instanceof ConsoleWidget ? widget : undefined;
30
+ }
31
+
32
+ get currentConsole(): ConsoleWidget | undefined {
33
+ const widget = this.shell.currentWidget;
34
+ return widget instanceof ConsoleWidget ? widget : undefined;
35
+ }
36
+
37
+ }