@theia/terminal 1.45.0 → 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.
- package/README.md +30 -30
- package/lib/browser/base/terminal-service.d.ts +34 -34
- package/lib/browser/base/terminal-service.js +7 -7
- package/lib/browser/base/terminal-widget.d.ts +192 -192
- package/lib/browser/base/terminal-widget.js +34 -34
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +28 -28
- package/lib/browser/search/terminal-search-container.d.ts +3 -3
- package/lib/browser/search/terminal-search-container.js +28 -28
- package/lib/browser/search/terminal-search-widget.d.ts +30 -30
- package/lib/browser/search/terminal-search-widget.js +147 -147
- package/lib/browser/shell-terminal-profile.d.ts +20 -20
- package/lib/browser/shell-terminal-profile.js +42 -42
- package/lib/browser/terminal-contribution.d.ts +3 -3
- package/lib/browser/terminal-contribution.js +20 -20
- package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
- package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
- package/lib/browser/terminal-file-link-provider.d.ts +24 -24
- package/lib/browser/terminal-file-link-provider.js +200 -200
- package/lib/browser/terminal-frontend-contribution.d.ts +115 -115
- package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/terminal-frontend-contribution.js +1078 -1056
- package/lib/browser/terminal-frontend-contribution.js.map +1 -1
- package/lib/browser/terminal-frontend-module.d.ts +5 -5
- package/lib/browser/terminal-frontend-module.js +117 -117
- package/lib/browser/terminal-link-helpers.d.ts +27 -27
- package/lib/browser/terminal-link-helpers.js +155 -155
- package/lib/browser/terminal-link-provider.d.ts +51 -51
- package/lib/browser/terminal-link-provider.js +197 -197
- package/lib/browser/terminal-preferences.d.ts +61 -61
- package/lib/browser/terminal-preferences.d.ts.map +1 -1
- package/lib/browser/terminal-preferences.js +357 -356
- package/lib/browser/terminal-preferences.js.map +1 -1
- package/lib/browser/terminal-profile-service.d.ts +58 -58
- package/lib/browser/terminal-profile-service.js +158 -158
- package/lib/browser/terminal-quick-open-service.d.ts +36 -36
- package/lib/browser/terminal-quick-open-service.js +137 -137
- package/lib/browser/terminal-theme-service.d.ts +21 -21
- package/lib/browser/terminal-theme-service.d.ts.map +1 -1
- package/lib/browser/terminal-theme-service.js +222 -218
- package/lib/browser/terminal-theme-service.js.map +1 -1
- package/lib/browser/terminal-url-link-provider.d.ts +11 -11
- package/lib/browser/terminal-url-link-provider.js +76 -76
- package/lib/browser/terminal-widget-impl.d.ts +180 -187
- package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
- package/lib/browser/terminal-widget-impl.js +857 -867
- package/lib/browser/terminal-widget-impl.js.map +1 -1
- package/lib/common/base-terminal-protocol.d.ts +55 -55
- package/lib/common/base-terminal-protocol.js +84 -84
- package/lib/common/shell-terminal-protocol.d.ts +66 -66
- package/lib/common/shell-terminal-protocol.js +35 -35
- package/lib/common/terminal-common-module.d.ts +7 -7
- package/lib/common/terminal-common-module.js +31 -31
- package/lib/common/terminal-protocol.d.ts +12 -12
- package/lib/common/terminal-protocol.js +21 -21
- package/lib/common/terminal-watcher.d.ts +13 -13
- package/lib/common/terminal-watcher.js +70 -70
- package/lib/node/base-terminal-server.d.ts +24 -24
- package/lib/node/base-terminal-server.js +168 -168
- package/lib/node/buffering-stream.d.ts +39 -39
- package/lib/node/buffering-stream.js +75 -75
- package/lib/node/buffering-stream.spec.d.ts +1 -1
- package/lib/node/buffering-stream.spec.js +43 -43
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.js +28 -28
- package/lib/node/shell-process.d.ts +27 -27
- package/lib/node/shell-process.js +107 -107
- package/lib/node/shell-process.js.map +1 -1
- package/lib/node/shell-terminal-server.d.ts +30 -30
- package/lib/node/shell-terminal-server.js +212 -212
- package/lib/node/shell-terminal-server.spec.d.ts +1 -1
- package/lib/node/shell-terminal-server.spec.js +35 -35
- package/lib/node/terminal-backend-contribution.d.ts +9 -9
- package/lib/node/terminal-backend-contribution.js +75 -75
- package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
- package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
- package/lib/node/terminal-backend-module.d.ts +11 -11
- package/lib/node/terminal-backend-module.js +69 -69
- package/lib/node/terminal-server.d.ts +9 -9
- package/lib/node/terminal-server.js +64 -64
- package/lib/node/terminal-server.spec.d.ts +1 -1
- package/lib/node/terminal-server.spec.js +41 -41
- package/lib/node/test/terminal-test-container.d.ts +2 -2
- package/lib/node/test/terminal-test-container.js +40 -40
- package/lib/package.spec.js +25 -25
- package/package.json +12 -12
- package/src/browser/base/terminal-service.ts +60 -60
- package/src/browser/base/terminal-widget.ts +254 -254
- package/src/browser/index.ts +17 -17
- package/src/browser/search/terminal-search-container.ts +28 -28
- package/src/browser/search/terminal-search-widget.tsx +161 -161
- package/src/browser/shell-terminal-profile.ts +45 -45
- package/src/browser/style/terminal-search.css +99 -99
- package/src/browser/style/terminal.css +32 -32
- package/src/browser/terminal-contribution.ts +19 -19
- package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
- package/src/browser/terminal-file-link-provider.ts +200 -200
- package/src/browser/terminal-frontend-contribution.ts +1120 -1098
- package/src/browser/terminal-frontend-module.ts +136 -136
- package/src/browser/terminal-link-helpers.ts +187 -187
- package/src/browser/terminal-link-provider.ts +203 -203
- package/src/browser/terminal-preferences.ts +428 -427
- package/src/browser/terminal-profile-service.ts +180 -180
- package/src/browser/terminal-quick-open-service.ts +132 -132
- package/src/browser/terminal-theme-service.ts +213 -209
- package/src/browser/terminal-url-link-provider.ts +66 -66
- package/src/browser/terminal-widget-impl.ts +939 -936
- package/src/common/base-terminal-protocol.ts +125 -125
- package/src/common/shell-terminal-protocol.ts +103 -103
- package/src/common/terminal-common-module.ts +30 -30
- package/src/common/terminal-protocol.ts +32 -32
- package/src/common/terminal-watcher.ts +69 -69
- package/src/node/base-terminal-server.ts +173 -173
- package/src/node/buffering-stream.spec.ts +46 -46
- package/src/node/buffering-stream.ts +95 -95
- package/src/node/index.ts +17 -17
- package/src/node/shell-process.ts +101 -101
- package/src/node/shell-terminal-server.spec.ts +40 -40
- package/src/node/shell-terminal-server.ts +221 -221
- package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
- package/src/node/terminal-backend-contribution.ts +60 -60
- package/src/node/terminal-backend-module.ts +82 -82
- package/src/node/terminal-server.spec.ts +47 -47
- package/src/node/terminal-server.ts +52 -52
- package/src/node/test/terminal-test-container.ts +39 -39
- package/src/package.spec.ts +28 -28
|
@@ -1,209 +1,213 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 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 { ITheme } from 'xterm';
|
|
18
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
19
|
-
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
20
|
-
import { ColorDefaults } from '@theia/core/lib/common/color';
|
|
21
|
-
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
22
|
-
import { ThemeChangeEvent } from '@theia/core/lib/common/theme';
|
|
23
|
-
import { Event } from '@theia/core';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* It should be aligned with https://github.com/microsoft/vscode/blob/0dfa355b3ad185a6289ba28a99c141ab9e72d2be/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts#L40
|
|
27
|
-
*/
|
|
28
|
-
export const terminalAnsiColorMap: { [key: string]: { index: number, defaults: ColorDefaults } } = {
|
|
29
|
-
'terminal.ansiBlack': {
|
|
30
|
-
index: 0,
|
|
31
|
-
defaults: {
|
|
32
|
-
light: '#000000',
|
|
33
|
-
dark: '#000000',
|
|
34
|
-
hcDark: '#000000',
|
|
35
|
-
hcLight: '#292929'
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
'terminal.ansiRed': {
|
|
39
|
-
index: 1,
|
|
40
|
-
defaults: {
|
|
41
|
-
light: '#cd3131',
|
|
42
|
-
dark: '#cd3131',
|
|
43
|
-
hcDark: '#cd0000',
|
|
44
|
-
hcLight: '#cd3131'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
'terminal.ansiGreen': {
|
|
48
|
-
index: 2,
|
|
49
|
-
defaults: {
|
|
50
|
-
light: '#00BC00',
|
|
51
|
-
dark: '#0DBC79',
|
|
52
|
-
hcDark: '#00cd00',
|
|
53
|
-
hcLight: '#00bc00'
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
'terminal.ansiYellow': {
|
|
57
|
-
index: 3,
|
|
58
|
-
defaults: {
|
|
59
|
-
light: '#949800',
|
|
60
|
-
dark: '#e5e510',
|
|
61
|
-
hcDark: '#cdcd00',
|
|
62
|
-
hcLight: '#949800'
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
'terminal.ansiBlue': {
|
|
66
|
-
index: 4,
|
|
67
|
-
defaults: {
|
|
68
|
-
light: '#0451a5',
|
|
69
|
-
dark: '#2472c8',
|
|
70
|
-
hcDark: '#0000ee',
|
|
71
|
-
hcLight: '#0451a5'
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
'terminal.ansiMagenta': {
|
|
75
|
-
index: 5,
|
|
76
|
-
defaults: {
|
|
77
|
-
light: '#bc05bc',
|
|
78
|
-
dark: '#bc3fbc',
|
|
79
|
-
hcDark: '#cd00cd',
|
|
80
|
-
hcLight: '#bc05bc'
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
'terminal.ansiCyan': {
|
|
84
|
-
index: 6,
|
|
85
|
-
defaults: {
|
|
86
|
-
light: '#0598bc',
|
|
87
|
-
dark: '#11a8cd',
|
|
88
|
-
hcDark: '#00cdcd',
|
|
89
|
-
hcLight: '#0598b'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
'terminal.ansiWhite': {
|
|
93
|
-
index: 7,
|
|
94
|
-
defaults: {
|
|
95
|
-
light: '#555555',
|
|
96
|
-
dark: '#e5e5e5',
|
|
97
|
-
hcDark: '#e5e5e5',
|
|
98
|
-
hcLight: '#555555'
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
'terminal.ansiBrightBlack': {
|
|
102
|
-
index: 8,
|
|
103
|
-
defaults: {
|
|
104
|
-
light: '#666666',
|
|
105
|
-
dark: '#666666',
|
|
106
|
-
hcDark: '#7f7f7f',
|
|
107
|
-
hcLight: '#666666'
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
'terminal.ansiBrightRed': {
|
|
111
|
-
index: 9,
|
|
112
|
-
defaults: {
|
|
113
|
-
light: '#cd3131',
|
|
114
|
-
dark: '#f14c4c',
|
|
115
|
-
hcDark: '#ff0000',
|
|
116
|
-
hcLight: '#cd3131'
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
'terminal.ansiBrightGreen': {
|
|
120
|
-
index: 10,
|
|
121
|
-
defaults: {
|
|
122
|
-
light: '#14CE14',
|
|
123
|
-
dark: '#23d18b',
|
|
124
|
-
hcDark: '#00ff00',
|
|
125
|
-
hcLight: '#00bc00'
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
'terminal.ansiBrightYellow': {
|
|
129
|
-
index: 11,
|
|
130
|
-
defaults: {
|
|
131
|
-
light: '#b5ba00',
|
|
132
|
-
dark: '#f5f543',
|
|
133
|
-
hcDark: '#ffff00',
|
|
134
|
-
hcLight: '#b5ba00'
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
'terminal.ansiBrightBlue': {
|
|
138
|
-
index: 12,
|
|
139
|
-
defaults: {
|
|
140
|
-
light: '#0451a5',
|
|
141
|
-
dark: '#3b8eea',
|
|
142
|
-
hcDark: '#5c5cff',
|
|
143
|
-
hcLight: '#0451a5'
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
'terminal.ansiBrightMagenta': {
|
|
147
|
-
index: 13,
|
|
148
|
-
defaults: {
|
|
149
|
-
light: '#bc05bc',
|
|
150
|
-
dark: '#d670d6',
|
|
151
|
-
hcDark: '#ff00ff',
|
|
152
|
-
hcLight: '#bc05bc'
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
'terminal.ansiBrightCyan': {
|
|
156
|
-
index: 14,
|
|
157
|
-
defaults: {
|
|
158
|
-
light: '#0598bc',
|
|
159
|
-
dark: '#29b8db',
|
|
160
|
-
hcDark: '#00ffff',
|
|
161
|
-
hcLight: '#0598bc'
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
'terminal.ansiBrightWhite': {
|
|
165
|
-
index: 15,
|
|
166
|
-
defaults: {
|
|
167
|
-
light: '#a5a5a5',
|
|
168
|
-
dark: '#e5e5e5',
|
|
169
|
-
hcDark: '#ffffff',
|
|
170
|
-
hcLight: '#a5a5a5'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
@injectable()
|
|
176
|
-
export class TerminalThemeService {
|
|
177
|
-
|
|
178
|
-
@inject(ColorRegistry) protected readonly colorRegistry: ColorRegistry;
|
|
179
|
-
@inject(ThemeService) protected readonly themeService: ThemeService;
|
|
180
|
-
|
|
181
|
-
get onDidChange(): Event<ThemeChangeEvent> {
|
|
182
|
-
return this.themeService.onDidColorThemeChange;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
get theme(): ITheme {
|
|
186
|
-
const foregroundColor = this.colorRegistry.getCurrentColor('terminal.foreground');
|
|
187
|
-
const backgroundColor = this.colorRegistry.getCurrentColor('terminal.background') || this.colorRegistry.getCurrentColor('panel.background');
|
|
188
|
-
const cursorColor = this.colorRegistry.getCurrentColor('terminalCursor.foreground') || foregroundColor;
|
|
189
|
-
const cursorAccentColor = this.colorRegistry.getCurrentColor('terminalCursor.background') || backgroundColor;
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 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 { ITheme } from 'xterm';
|
|
18
|
+
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
20
|
+
import { ColorDefaults } from '@theia/core/lib/common/color';
|
|
21
|
+
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
22
|
+
import { ThemeChangeEvent } from '@theia/core/lib/common/theme';
|
|
23
|
+
import { Event } from '@theia/core';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* It should be aligned with https://github.com/microsoft/vscode/blob/0dfa355b3ad185a6289ba28a99c141ab9e72d2be/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts#L40
|
|
27
|
+
*/
|
|
28
|
+
export const terminalAnsiColorMap: { [key: string]: { index: number, defaults: ColorDefaults } } = {
|
|
29
|
+
'terminal.ansiBlack': {
|
|
30
|
+
index: 0,
|
|
31
|
+
defaults: {
|
|
32
|
+
light: '#000000',
|
|
33
|
+
dark: '#000000',
|
|
34
|
+
hcDark: '#000000',
|
|
35
|
+
hcLight: '#292929'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
'terminal.ansiRed': {
|
|
39
|
+
index: 1,
|
|
40
|
+
defaults: {
|
|
41
|
+
light: '#cd3131',
|
|
42
|
+
dark: '#cd3131',
|
|
43
|
+
hcDark: '#cd0000',
|
|
44
|
+
hcLight: '#cd3131'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
'terminal.ansiGreen': {
|
|
48
|
+
index: 2,
|
|
49
|
+
defaults: {
|
|
50
|
+
light: '#00BC00',
|
|
51
|
+
dark: '#0DBC79',
|
|
52
|
+
hcDark: '#00cd00',
|
|
53
|
+
hcLight: '#00bc00'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
'terminal.ansiYellow': {
|
|
57
|
+
index: 3,
|
|
58
|
+
defaults: {
|
|
59
|
+
light: '#949800',
|
|
60
|
+
dark: '#e5e510',
|
|
61
|
+
hcDark: '#cdcd00',
|
|
62
|
+
hcLight: '#949800'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
'terminal.ansiBlue': {
|
|
66
|
+
index: 4,
|
|
67
|
+
defaults: {
|
|
68
|
+
light: '#0451a5',
|
|
69
|
+
dark: '#2472c8',
|
|
70
|
+
hcDark: '#0000ee',
|
|
71
|
+
hcLight: '#0451a5'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
'terminal.ansiMagenta': {
|
|
75
|
+
index: 5,
|
|
76
|
+
defaults: {
|
|
77
|
+
light: '#bc05bc',
|
|
78
|
+
dark: '#bc3fbc',
|
|
79
|
+
hcDark: '#cd00cd',
|
|
80
|
+
hcLight: '#bc05bc'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
'terminal.ansiCyan': {
|
|
84
|
+
index: 6,
|
|
85
|
+
defaults: {
|
|
86
|
+
light: '#0598bc',
|
|
87
|
+
dark: '#11a8cd',
|
|
88
|
+
hcDark: '#00cdcd',
|
|
89
|
+
hcLight: '#0598b'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
'terminal.ansiWhite': {
|
|
93
|
+
index: 7,
|
|
94
|
+
defaults: {
|
|
95
|
+
light: '#555555',
|
|
96
|
+
dark: '#e5e5e5',
|
|
97
|
+
hcDark: '#e5e5e5',
|
|
98
|
+
hcLight: '#555555'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
'terminal.ansiBrightBlack': {
|
|
102
|
+
index: 8,
|
|
103
|
+
defaults: {
|
|
104
|
+
light: '#666666',
|
|
105
|
+
dark: '#666666',
|
|
106
|
+
hcDark: '#7f7f7f',
|
|
107
|
+
hcLight: '#666666'
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
'terminal.ansiBrightRed': {
|
|
111
|
+
index: 9,
|
|
112
|
+
defaults: {
|
|
113
|
+
light: '#cd3131',
|
|
114
|
+
dark: '#f14c4c',
|
|
115
|
+
hcDark: '#ff0000',
|
|
116
|
+
hcLight: '#cd3131'
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
'terminal.ansiBrightGreen': {
|
|
120
|
+
index: 10,
|
|
121
|
+
defaults: {
|
|
122
|
+
light: '#14CE14',
|
|
123
|
+
dark: '#23d18b',
|
|
124
|
+
hcDark: '#00ff00',
|
|
125
|
+
hcLight: '#00bc00'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
'terminal.ansiBrightYellow': {
|
|
129
|
+
index: 11,
|
|
130
|
+
defaults: {
|
|
131
|
+
light: '#b5ba00',
|
|
132
|
+
dark: '#f5f543',
|
|
133
|
+
hcDark: '#ffff00',
|
|
134
|
+
hcLight: '#b5ba00'
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
'terminal.ansiBrightBlue': {
|
|
138
|
+
index: 12,
|
|
139
|
+
defaults: {
|
|
140
|
+
light: '#0451a5',
|
|
141
|
+
dark: '#3b8eea',
|
|
142
|
+
hcDark: '#5c5cff',
|
|
143
|
+
hcLight: '#0451a5'
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
'terminal.ansiBrightMagenta': {
|
|
147
|
+
index: 13,
|
|
148
|
+
defaults: {
|
|
149
|
+
light: '#bc05bc',
|
|
150
|
+
dark: '#d670d6',
|
|
151
|
+
hcDark: '#ff00ff',
|
|
152
|
+
hcLight: '#bc05bc'
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
'terminal.ansiBrightCyan': {
|
|
156
|
+
index: 14,
|
|
157
|
+
defaults: {
|
|
158
|
+
light: '#0598bc',
|
|
159
|
+
dark: '#29b8db',
|
|
160
|
+
hcDark: '#00ffff',
|
|
161
|
+
hcLight: '#0598bc'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
'terminal.ansiBrightWhite': {
|
|
165
|
+
index: 15,
|
|
166
|
+
defaults: {
|
|
167
|
+
light: '#a5a5a5',
|
|
168
|
+
dark: '#e5e5e5',
|
|
169
|
+
hcDark: '#ffffff',
|
|
170
|
+
hcLight: '#a5a5a5'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
@injectable()
|
|
176
|
+
export class TerminalThemeService {
|
|
177
|
+
|
|
178
|
+
@inject(ColorRegistry) protected readonly colorRegistry: ColorRegistry;
|
|
179
|
+
@inject(ThemeService) protected readonly themeService: ThemeService;
|
|
180
|
+
|
|
181
|
+
get onDidChange(): Event<ThemeChangeEvent> {
|
|
182
|
+
return this.themeService.onDidColorThemeChange;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get theme(): ITheme {
|
|
186
|
+
const foregroundColor = this.colorRegistry.getCurrentColor('terminal.foreground');
|
|
187
|
+
const backgroundColor = this.colorRegistry.getCurrentColor('terminal.background') || this.colorRegistry.getCurrentColor('panel.background');
|
|
188
|
+
const cursorColor = this.colorRegistry.getCurrentColor('terminalCursor.foreground') || foregroundColor;
|
|
189
|
+
const cursorAccentColor = this.colorRegistry.getCurrentColor('terminalCursor.background') || backgroundColor;
|
|
190
|
+
const selectionBackgroundColor = this.colorRegistry.getCurrentColor('terminal.selectionBackground');
|
|
191
|
+
const selectionInactiveBackground = this.colorRegistry.getCurrentColor('terminal.inactiveSelectionBackground');
|
|
192
|
+
const selectionForegroundColor = this.colorRegistry.getCurrentColor('terminal.selectionForeground');
|
|
193
|
+
|
|
194
|
+
const theme: ITheme = {
|
|
195
|
+
background: backgroundColor,
|
|
196
|
+
foreground: foregroundColor,
|
|
197
|
+
cursor: cursorColor,
|
|
198
|
+
cursorAccent: cursorAccentColor,
|
|
199
|
+
selectionBackground: selectionBackgroundColor,
|
|
200
|
+
selectionInactiveBackground: selectionInactiveBackground,
|
|
201
|
+
selectionForeground: selectionForegroundColor
|
|
202
|
+
};
|
|
203
|
+
// eslint-disable-next-line guard-for-in
|
|
204
|
+
for (const id in terminalAnsiColorMap) {
|
|
205
|
+
const colorId = id.substring(13);
|
|
206
|
+
const colorName = colorId.charAt(0).toLowerCase() + colorId.slice(1);
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
208
|
+
(theme as any)[colorName] = this.colorRegistry.getCurrentColor(id);
|
|
209
|
+
}
|
|
210
|
+
return theme;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 STMicroelectronics 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 { OpenerService, open } from '@theia/core/lib/browser';
|
|
19
|
-
import { TerminalWidget } from './base/terminal-widget';
|
|
20
|
-
import { TerminalLink, TerminalLinkProvider } from './terminal-link-provider';
|
|
21
|
-
import URI from '@theia/core/lib/common/uri';
|
|
22
|
-
|
|
23
|
-
@injectable()
|
|
24
|
-
export class UrlLinkProvider implements TerminalLinkProvider {
|
|
25
|
-
|
|
26
|
-
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
27
|
-
|
|
28
|
-
protected readonly urlRegExp = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
|
29
|
-
protected readonly localhostRegExp = /(https?:\/\/)?(localhost|127\.0\.0\.1|0\.0\.0\.0)(:[0-9]{1,5})?([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
|
30
|
-
|
|
31
|
-
async provideLinks(line: string, terminal: TerminalWidget): Promise<TerminalLink[]> {
|
|
32
|
-
return [...this.matchUrlLinks(line), ...this.matchLocalhostLinks(line)];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
protected matchUrlLinks(line: string): TerminalLink[] {
|
|
36
|
-
const links: TerminalLink[] = [];
|
|
37
|
-
let regExpResult: RegExpExecArray | null;
|
|
38
|
-
while (regExpResult = this.urlRegExp.exec(line)) {
|
|
39
|
-
const match = regExpResult![0];
|
|
40
|
-
links.push({
|
|
41
|
-
startIndex: this.urlRegExp.lastIndex - match.length,
|
|
42
|
-
length: match.length,
|
|
43
|
-
handle: () => open(this.openerService, new URI(match)).then()
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return links;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected matchLocalhostLinks(line: string): TerminalLink[] {
|
|
50
|
-
const links: TerminalLink[] = [];
|
|
51
|
-
let regExpResult: RegExpExecArray | null;
|
|
52
|
-
while (regExpResult = this.localhostRegExp.exec(line)) {
|
|
53
|
-
const match = regExpResult![0];
|
|
54
|
-
links.push({
|
|
55
|
-
startIndex: this.localhostRegExp.lastIndex - match.length,
|
|
56
|
-
length: match.length,
|
|
57
|
-
handle: async () => {
|
|
58
|
-
const uri = match.startsWith('http') ? match : `http://${match}`;
|
|
59
|
-
open(this.openerService, new URI(uri));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return links;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 STMicroelectronics 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 { OpenerService, open } from '@theia/core/lib/browser';
|
|
19
|
+
import { TerminalWidget } from './base/terminal-widget';
|
|
20
|
+
import { TerminalLink, TerminalLinkProvider } from './terminal-link-provider';
|
|
21
|
+
import URI from '@theia/core/lib/common/uri';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class UrlLinkProvider implements TerminalLinkProvider {
|
|
25
|
+
|
|
26
|
+
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
27
|
+
|
|
28
|
+
protected readonly urlRegExp = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
|
29
|
+
protected readonly localhostRegExp = /(https?:\/\/)?(localhost|127\.0\.0\.1|0\.0\.0\.0)(:[0-9]{1,5})?([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
|
30
|
+
|
|
31
|
+
async provideLinks(line: string, terminal: TerminalWidget): Promise<TerminalLink[]> {
|
|
32
|
+
return [...this.matchUrlLinks(line), ...this.matchLocalhostLinks(line)];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected matchUrlLinks(line: string): TerminalLink[] {
|
|
36
|
+
const links: TerminalLink[] = [];
|
|
37
|
+
let regExpResult: RegExpExecArray | null;
|
|
38
|
+
while (regExpResult = this.urlRegExp.exec(line)) {
|
|
39
|
+
const match = regExpResult![0];
|
|
40
|
+
links.push({
|
|
41
|
+
startIndex: this.urlRegExp.lastIndex - match.length,
|
|
42
|
+
length: match.length,
|
|
43
|
+
handle: () => open(this.openerService, new URI(match)).then()
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return links;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected matchLocalhostLinks(line: string): TerminalLink[] {
|
|
50
|
+
const links: TerminalLink[] = [];
|
|
51
|
+
let regExpResult: RegExpExecArray | null;
|
|
52
|
+
while (regExpResult = this.localhostRegExp.exec(line)) {
|
|
53
|
+
const match = regExpResult![0];
|
|
54
|
+
links.push({
|
|
55
|
+
startIndex: this.localhostRegExp.lastIndex - match.length,
|
|
56
|
+
length: match.length,
|
|
57
|
+
handle: async () => {
|
|
58
|
+
const uri = match.startsWith('http') ? match : `http://${match}`;
|
|
59
|
+
open(this.openerService, new URI(uri));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return links;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|