@theia/scm 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.
- package/README.md +31 -31
- package/lib/browser/decorations/scm-decorations-service.d.ts +14 -14
- package/lib/browser/decorations/scm-decorations-service.js +101 -101
- package/lib/browser/decorations/scm-navigator-decorator.d.ts +25 -25
- package/lib/browser/decorations/scm-navigator-decorator.js +132 -132
- package/lib/browser/decorations/scm-tab-bar-decorator.d.ts +17 -17
- package/lib/browser/decorations/scm-tab-bar-decorator.js +93 -93
- package/lib/browser/dirty-diff/content-lines.d.ts +12 -12
- package/lib/browser/dirty-diff/content-lines.js +106 -106
- package/lib/browser/dirty-diff/content-lines.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/content-lines.spec.js +39 -39
- package/lib/browser/dirty-diff/diff-computer.d.ts +29 -29
- package/lib/browser/dirty-diff/diff-computer.js +102 -102
- package/lib/browser/dirty-diff/diff-computer.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/diff-computer.spec.js +315 -315
- package/lib/browser/dirty-diff/dirty-diff-decorator.d.ts +14 -14
- package/lib/browser/dirty-diff/dirty-diff-decorator.js +98 -98
- package/lib/browser/dirty-diff/dirty-diff-module.d.ts +3 -3
- package/lib/browser/dirty-diff/dirty-diff-module.js +24 -24
- package/lib/browser/scm-amend-component.d.ts +123 -123
- package/lib/browser/scm-amend-component.js +463 -463
- package/lib/browser/scm-amend-widget.d.ts +20 -20
- package/lib/browser/scm-amend-widget.js +101 -101
- package/lib/browser/scm-avatar-service.d.ts +3 -3
- package/lib/browser/scm-avatar-service.js +36 -36
- package/lib/browser/scm-commit-widget.d.ts +52 -52
- package/lib/browser/scm-commit-widget.js +199 -199
- package/lib/browser/scm-context-key-service.d.ts +10 -10
- package/lib/browser/scm-context-key-service.js +58 -58
- package/lib/browser/scm-contribution.d.ts +83 -83
- package/lib/browser/scm-contribution.js +356 -356
- package/lib/browser/scm-frontend-module.d.ts +6 -6
- package/lib/browser/scm-frontend-module.js +130 -130
- package/lib/browser/scm-groups-tree-model.d.ts +14 -14
- package/lib/browser/scm-groups-tree-model.js +97 -97
- package/lib/browser/scm-input.d.ts +53 -53
- package/lib/browser/scm-input.js +127 -127
- package/lib/browser/scm-layout-migrations.d.ts +9 -9
- package/lib/browser/scm-layout-migrations.js +79 -79
- package/lib/browser/scm-no-repository-widget.d.ts +8 -8
- package/lib/browser/scm-no-repository-widget.js +49 -49
- package/lib/browser/scm-preferences.d.ts +11 -11
- package/lib/browser/scm-preferences.js +51 -51
- package/lib/browser/scm-provider.d.ts +58 -58
- package/lib/browser/scm-provider.js +19 -19
- package/lib/browser/scm-quick-open-service.d.ts +11 -11
- package/lib/browser/scm-quick-open-service.js +73 -73
- package/lib/browser/scm-repository.d.ts +17 -17
- package/lib/browser/scm-repository.js +41 -41
- package/lib/browser/scm-service.d.ts +26 -26
- package/lib/browser/scm-service.js +108 -108
- package/lib/browser/scm-tree-label-provider.d.ts +7 -7
- package/lib/browser/scm-tree-label-provider.js +57 -57
- package/lib/browser/scm-tree-model.d.ts +74 -74
- package/lib/browser/scm-tree-model.js +351 -351
- package/lib/browser/scm-tree-widget.d.ts +208 -208
- package/lib/browser/scm-tree-widget.js +703 -703
- package/lib/browser/scm-widget.d.ts +40 -40
- package/lib/browser/scm-widget.js +218 -218
- package/package.json +6 -6
- package/src/browser/decorations/scm-decorations-service.ts +78 -78
- package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
- package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
- package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
- package/src/browser/dirty-diff/content-lines.ts +112 -112
- package/src/browser/dirty-diff/diff-computer.spec.ts +387 -387
- package/src/browser/dirty-diff/diff-computer.ts +129 -129
- package/src/browser/dirty-diff/dirty-diff-decorator.ts +107 -107
- package/src/browser/dirty-diff/dirty-diff-module.ts +24 -24
- package/src/browser/scm-amend-component.tsx +600 -600
- package/src/browser/scm-amend-widget.tsx +77 -77
- package/src/browser/scm-avatar-service.ts +27 -27
- package/src/browser/scm-commit-widget.tsx +215 -215
- package/src/browser/scm-context-key-service.ts +46 -46
- package/src/browser/scm-contribution.ts +361 -361
- package/src/browser/scm-frontend-module.ts +149 -149
- package/src/browser/scm-groups-tree-model.ts +78 -78
- package/src/browser/scm-input.ts +164 -164
- package/src/browser/scm-layout-migrations.ts +64 -64
- package/src/browser/scm-no-repository-widget.tsx +41 -41
- package/src/browser/scm-preferences.ts +63 -63
- package/src/browser/scm-provider.ts +91 -91
- package/src/browser/scm-quick-open-service.ts +48 -48
- package/src/browser/scm-repository.ts +52 -52
- package/src/browser/scm-service.ts +108 -108
- package/src/browser/scm-tree-label-provider.ts +44 -44
- package/src/browser/scm-tree-model.ts +405 -405
- package/src/browser/scm-tree-widget.tsx +838 -838
- package/src/browser/scm-widget.tsx +204 -204
- package/src/browser/style/dirty-diff-decorator.css +52 -52
- package/src/browser/style/dirty-diff.css +50 -50
- package/src/browser/style/index.css +271 -271
- package/src/browser/style/scm-amend-component.css +94 -94
- package/src/browser/style/scm.svg +4 -4
|
@@ -1,361 +1,361 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. 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
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
17
|
-
import { Emitter } from '@theia/core/lib/common/event';
|
|
18
|
-
import {
|
|
19
|
-
AbstractViewContribution,
|
|
20
|
-
FrontendApplicationContribution, LabelProvider,
|
|
21
|
-
StatusBar,
|
|
22
|
-
StatusBarAlignment,
|
|
23
|
-
StatusBarEntry,
|
|
24
|
-
KeybindingRegistry,
|
|
25
|
-
ViewContainerTitleOptions,
|
|
26
|
-
codicon,
|
|
27
|
-
StylingParticipant,
|
|
28
|
-
ColorTheme,
|
|
29
|
-
CssStyleCollector
|
|
30
|
-
} from '@theia/core/lib/browser';
|
|
31
|
-
import { TabBarToolbarContribution, TabBarToolbarRegistry, TabBarToolbarItem } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
32
|
-
import { CommandRegistry, Command, Disposable, DisposableCollection, CommandService } from '@theia/core/lib/common';
|
|
33
|
-
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
34
|
-
import { ScmService } from './scm-service';
|
|
35
|
-
import { ScmWidget } from '../browser/scm-widget';
|
|
36
|
-
import URI from '@theia/core/lib/common/uri';
|
|
37
|
-
import { ScmQuickOpenService } from './scm-quick-open-service';
|
|
38
|
-
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
|
39
|
-
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
40
|
-
import { Color } from '@theia/core/lib/common/color';
|
|
41
|
-
import { ScmCommand } from './scm-provider';
|
|
42
|
-
import { ScmDecorationsService } from '../browser/decorations/scm-decorations-service';
|
|
43
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
44
|
-
import { isHighContrast } from '@theia/core/lib/common/theme';
|
|
45
|
-
|
|
46
|
-
export const SCM_WIDGET_FACTORY_ID = ScmWidget.ID;
|
|
47
|
-
export const SCM_VIEW_CONTAINER_ID = 'scm-view-container';
|
|
48
|
-
export const SCM_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = {
|
|
49
|
-
label: nls.localizeByDefault('Source Control'),
|
|
50
|
-
iconClass: codicon('source-control'),
|
|
51
|
-
closeable: true
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export namespace SCM_COMMANDS {
|
|
55
|
-
export const CHANGE_REPOSITORY = {
|
|
56
|
-
id: 'scm.change.repository',
|
|
57
|
-
category: nls.localizeByDefault('Source Control'),
|
|
58
|
-
originalCategory: 'Source Control',
|
|
59
|
-
label: nls.localize('theia/scm/changeRepository', 'Change Repository...'),
|
|
60
|
-
originalLabel: 'Change Repository...'
|
|
61
|
-
};
|
|
62
|
-
export const ACCEPT_INPUT = {
|
|
63
|
-
id: 'scm.acceptInput'
|
|
64
|
-
};
|
|
65
|
-
export const TREE_VIEW_MODE = {
|
|
66
|
-
id: 'scm.viewmode.tree',
|
|
67
|
-
tooltip: nls.localizeByDefault('View as Tree'),
|
|
68
|
-
iconClass: codicon('list-tree'),
|
|
69
|
-
originalLabel: 'View as Tree',
|
|
70
|
-
label: nls.localizeByDefault('View as Tree')
|
|
71
|
-
};
|
|
72
|
-
export const LIST_VIEW_MODE = {
|
|
73
|
-
id: 'scm.viewmode.list',
|
|
74
|
-
tooltip: nls.localizeByDefault('View as List'),
|
|
75
|
-
iconClass: codicon('list-flat'),
|
|
76
|
-
originalLabel: 'View as List',
|
|
77
|
-
label: nls.localizeByDefault('View as List')
|
|
78
|
-
};
|
|
79
|
-
export const COLLAPSE_ALL = {
|
|
80
|
-
id: 'scm.collapseAll',
|
|
81
|
-
category: nls.localizeByDefault('Source Control'),
|
|
82
|
-
originalCategory: 'Source Control',
|
|
83
|
-
tooltip: nls.localizeByDefault('Collapse All'),
|
|
84
|
-
iconClass: codicon('collapse-all'),
|
|
85
|
-
label: nls.localizeByDefault('Collapse All'),
|
|
86
|
-
originalLabel: 'Collapse All'
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export namespace ScmColors {
|
|
91
|
-
export const editorGutterModifiedBackground = 'editorGutter.modifiedBackground';
|
|
92
|
-
export const editorGutterAddedBackground = 'editorGutter.addedBackground';
|
|
93
|
-
export const editorGutterDeletedBackground = 'editorGutter.deletedBackground';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@injectable()
|
|
97
|
-
export class ScmContribution extends AbstractViewContribution<ScmWidget> implements
|
|
98
|
-
FrontendApplicationContribution,
|
|
99
|
-
TabBarToolbarContribution,
|
|
100
|
-
ColorContribution,
|
|
101
|
-
StylingParticipant {
|
|
102
|
-
|
|
103
|
-
@inject(StatusBar) protected readonly statusBar: StatusBar;
|
|
104
|
-
@inject(ScmService) protected readonly scmService: ScmService;
|
|
105
|
-
@inject(ScmQuickOpenService) protected readonly scmQuickOpenService: ScmQuickOpenService;
|
|
106
|
-
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
107
|
-
@inject(CommandService) protected readonly commands: CommandService;
|
|
108
|
-
@inject(CommandRegistry) protected readonly commandRegistry: CommandRegistry;
|
|
109
|
-
@inject(ContextKeyService) protected readonly contextKeys: ContextKeyService;
|
|
110
|
-
@inject(ScmDecorationsService) protected readonly scmDecorationsService: ScmDecorationsService;
|
|
111
|
-
|
|
112
|
-
protected scmFocus: ContextKey<boolean>;
|
|
113
|
-
|
|
114
|
-
constructor() {
|
|
115
|
-
super({
|
|
116
|
-
viewContainerId: SCM_VIEW_CONTAINER_ID,
|
|
117
|
-
widgetId: SCM_WIDGET_FACTORY_ID,
|
|
118
|
-
widgetName: SCM_VIEW_CONTAINER_TITLE_OPTIONS.label,
|
|
119
|
-
defaultWidgetOptions: {
|
|
120
|
-
area: 'left',
|
|
121
|
-
rank: 300
|
|
122
|
-
},
|
|
123
|
-
toggleCommandId: 'scmView:toggle',
|
|
124
|
-
toggleKeybinding: 'ctrlcmd+shift+g'
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@postConstruct()
|
|
129
|
-
protected init(): void {
|
|
130
|
-
this.scmFocus = this.contextKeys.createKey('scmFocus', false);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
async initializeLayout(): Promise<void> {
|
|
134
|
-
await this.openView();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
onStart(): void {
|
|
138
|
-
this.updateStatusBar();
|
|
139
|
-
this.scmService.onDidAddRepository(() => this.updateStatusBar());
|
|
140
|
-
this.scmService.onDidRemoveRepository(() => this.updateStatusBar());
|
|
141
|
-
this.scmService.onDidChangeSelectedRepository(() => this.updateStatusBar());
|
|
142
|
-
this.scmService.onDidChangeStatusBarCommands(() => this.updateStatusBar());
|
|
143
|
-
this.labelProvider.onDidChange(() => this.updateStatusBar());
|
|
144
|
-
|
|
145
|
-
this.updateContextKeys();
|
|
146
|
-
this.shell.onDidChangeCurrentWidget(() => this.updateContextKeys());
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
protected updateContextKeys(): void {
|
|
150
|
-
this.scmFocus.set(this.shell.currentWidget instanceof ScmWidget);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
override registerCommands(commandRegistry: CommandRegistry): void {
|
|
154
|
-
super.registerCommands(commandRegistry);
|
|
155
|
-
commandRegistry.registerCommand(SCM_COMMANDS.CHANGE_REPOSITORY, {
|
|
156
|
-
execute: () => this.scmQuickOpenService.changeRepository(),
|
|
157
|
-
isEnabled: () => this.scmService.repositories.length > 1
|
|
158
|
-
});
|
|
159
|
-
commandRegistry.registerCommand(SCM_COMMANDS.ACCEPT_INPUT, {
|
|
160
|
-
execute: () => this.acceptInput(),
|
|
161
|
-
isEnabled: () => !!this.scmFocus.get() && !!this.acceptInputCommand()
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
166
|
-
const viewModeEmitter = new Emitter<void>();
|
|
167
|
-
const registerToggleViewItem = (command: Command, mode: 'tree' | 'list') => {
|
|
168
|
-
const id = command.id;
|
|
169
|
-
const item: TabBarToolbarItem = {
|
|
170
|
-
id,
|
|
171
|
-
command: id,
|
|
172
|
-
tooltip: command.label,
|
|
173
|
-
onDidChange: viewModeEmitter.event
|
|
174
|
-
};
|
|
175
|
-
this.commandRegistry.registerCommand({ id, iconClass: command && command.iconClass }, {
|
|
176
|
-
execute: widget => {
|
|
177
|
-
if (widget instanceof ScmWidget) {
|
|
178
|
-
widget.viewMode = mode;
|
|
179
|
-
viewModeEmitter.fire();
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
isVisible: widget => {
|
|
183
|
-
if (widget instanceof ScmWidget) {
|
|
184
|
-
return !!this.scmService.selectedRepository
|
|
185
|
-
&& widget.viewMode !== mode;
|
|
186
|
-
}
|
|
187
|
-
return false;
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
registry.registerItem(item);
|
|
191
|
-
};
|
|
192
|
-
registerToggleViewItem(SCM_COMMANDS.TREE_VIEW_MODE, 'tree');
|
|
193
|
-
registerToggleViewItem(SCM_COMMANDS.LIST_VIEW_MODE, 'list');
|
|
194
|
-
|
|
195
|
-
this.commandRegistry.registerCommand(SCM_COMMANDS.COLLAPSE_ALL, {
|
|
196
|
-
execute: widget => {
|
|
197
|
-
if (widget instanceof ScmWidget && widget.viewMode === 'tree') {
|
|
198
|
-
widget.collapseScmTree();
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
isVisible: widget => {
|
|
202
|
-
if (widget instanceof ScmWidget) {
|
|
203
|
-
return !!this.scmService.selectedRepository && widget.viewMode === 'tree';
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
registry.registerItem({
|
|
210
|
-
...SCM_COMMANDS.COLLAPSE_ALL,
|
|
211
|
-
command: SCM_COMMANDS.COLLAPSE_ALL.id
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
override registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
216
|
-
super.registerKeybindings(keybindings);
|
|
217
|
-
keybindings.registerKeybinding({
|
|
218
|
-
command: SCM_COMMANDS.ACCEPT_INPUT.id,
|
|
219
|
-
keybinding: 'ctrlcmd+enter',
|
|
220
|
-
when: 'scmFocus'
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
protected async acceptInput(): Promise<void> {
|
|
225
|
-
const command = this.acceptInputCommand();
|
|
226
|
-
if (command && command.command) {
|
|
227
|
-
await this.commands.executeCommand(command.command, ...command.arguments ? command.arguments : []);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
protected acceptInputCommand(): ScmCommand | undefined {
|
|
231
|
-
const repository = this.scmService.selectedRepository;
|
|
232
|
-
if (!repository) {
|
|
233
|
-
return undefined;
|
|
234
|
-
}
|
|
235
|
-
return repository.provider.acceptInputCommand;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
protected readonly statusBarDisposable = new DisposableCollection();
|
|
239
|
-
protected updateStatusBar(): void {
|
|
240
|
-
this.statusBarDisposable.dispose();
|
|
241
|
-
const repository = this.scmService.selectedRepository;
|
|
242
|
-
if (!repository) {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const name = this.labelProvider.getName(new URI(repository.provider.rootUri));
|
|
246
|
-
if (this.scmService.repositories.length > 1) {
|
|
247
|
-
this.setStatusBarEntry(SCM_COMMANDS.CHANGE_REPOSITORY.id, {
|
|
248
|
-
text: `$(database) ${name}`,
|
|
249
|
-
tooltip: name.toString(),
|
|
250
|
-
command: SCM_COMMANDS.CHANGE_REPOSITORY.id,
|
|
251
|
-
alignment: StatusBarAlignment.LEFT,
|
|
252
|
-
priority: 100
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
const label = repository.provider.rootUri ? `${name} (${repository.provider.label})` : repository.provider.label;
|
|
256
|
-
this.scmService.statusBarCommands.forEach((value, index) => this.setStatusBarEntry(`scm.status.${index}`, {
|
|
257
|
-
text: value.title,
|
|
258
|
-
tooltip: label + (value.tooltip ? ` - ${value.tooltip}` : ''),
|
|
259
|
-
command: value.command,
|
|
260
|
-
arguments: value.arguments,
|
|
261
|
-
alignment: StatusBarAlignment.LEFT,
|
|
262
|
-
priority: 100
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
protected setStatusBarEntry(id: string, entry: StatusBarEntry): void {
|
|
266
|
-
this.statusBar.setElement(id, entry);
|
|
267
|
-
this.statusBarDisposable.push(Disposable.create(() => this.statusBar.removeElement(id)));
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* It should be aligned with https://github.com/microsoft/vscode/blob/0dfa355b3ad185a6289ba28a99c141ab9e72d2be/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts#L808
|
|
272
|
-
*/
|
|
273
|
-
registerColors(colors: ColorRegistry): void {
|
|
274
|
-
colors.register(
|
|
275
|
-
{
|
|
276
|
-
id: ScmColors.editorGutterModifiedBackground, defaults: {
|
|
277
|
-
dark: '#1B81A8',
|
|
278
|
-
light: '#2090D3',
|
|
279
|
-
hcDark: '#1B81A8',
|
|
280
|
-
hcLight: '#2090D3'
|
|
281
|
-
}, description: 'Editor gutter background color for lines that are modified.'
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
id: ScmColors.editorGutterAddedBackground, defaults: {
|
|
285
|
-
dark: '#487E02',
|
|
286
|
-
light: '#48985D',
|
|
287
|
-
hcDark: '#487E02',
|
|
288
|
-
hcLight: '#48985D'
|
|
289
|
-
}, description: 'Editor gutter background color for lines that are added.'
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
id: ScmColors.editorGutterDeletedBackground, defaults: {
|
|
293
|
-
dark: 'editorError.foreground',
|
|
294
|
-
light: 'editorError.foreground',
|
|
295
|
-
hcDark: 'editorError.foreground',
|
|
296
|
-
hcLight: 'editorError.foreground'
|
|
297
|
-
}, description: 'Editor gutter background color for lines that are deleted.'
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
id: 'minimapGutter.modifiedBackground', defaults: {
|
|
301
|
-
dark: 'editorGutter.modifiedBackground',
|
|
302
|
-
light: 'editorGutter.modifiedBackground',
|
|
303
|
-
hcDark: 'editorGutter.modifiedBackground',
|
|
304
|
-
hcLight: 'editorGutter.modifiedBackground'
|
|
305
|
-
}, description: 'Minimap gutter background color for lines that are modified.'
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
id: 'minimapGutter.addedBackground', defaults: {
|
|
309
|
-
dark: 'editorGutter.addedBackground',
|
|
310
|
-
light: 'editorGutter.addedBackground',
|
|
311
|
-
hcDark: 'editorGutter.modifiedBackground',
|
|
312
|
-
hcLight: 'editorGutter.modifiedBackground'
|
|
313
|
-
}, description: 'Minimap gutter background color for lines that are added.'
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
id: 'minimapGutter.deletedBackground', defaults: {
|
|
317
|
-
dark: 'editorGutter.deletedBackground',
|
|
318
|
-
light: 'editorGutter.deletedBackground',
|
|
319
|
-
hcDark: 'editorGutter.deletedBackground',
|
|
320
|
-
hcLight: 'editorGutter.deletedBackground'
|
|
321
|
-
}, description: 'Minimap gutter background color for lines that are deleted.'
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
id: 'editorOverviewRuler.modifiedForeground', defaults: {
|
|
325
|
-
dark: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
326
|
-
light: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
327
|
-
hcDark: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
328
|
-
hcLight: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6)
|
|
329
|
-
}, description: 'Overview ruler marker color for modified content.'
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
id: 'editorOverviewRuler.addedForeground', defaults: {
|
|
333
|
-
dark: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
334
|
-
light: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
335
|
-
hcDark: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
336
|
-
hcLight: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6)
|
|
337
|
-
}, description: 'Overview ruler marker color for added content.'
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
id: 'editorOverviewRuler.deletedForeground', defaults: {
|
|
341
|
-
dark: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
342
|
-
light: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
343
|
-
hcDark: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
344
|
-
hcLight: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6)
|
|
345
|
-
}, description: 'Overview ruler marker color for deleted content.'
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void {
|
|
351
|
-
const contrastBorder = theme.getColor('contrastBorder');
|
|
352
|
-
if (contrastBorder && isHighContrast(theme.type)) {
|
|
353
|
-
collector.addRule(`
|
|
354
|
-
.theia-scm-input-message-container textarea {
|
|
355
|
-
outline: var(--theia-border-width) solid ${contrastBorder};
|
|
356
|
-
outline-offset: -1px;
|
|
357
|
-
}
|
|
358
|
-
`);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. 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
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
17
|
+
import { Emitter } from '@theia/core/lib/common/event';
|
|
18
|
+
import {
|
|
19
|
+
AbstractViewContribution,
|
|
20
|
+
FrontendApplicationContribution, LabelProvider,
|
|
21
|
+
StatusBar,
|
|
22
|
+
StatusBarAlignment,
|
|
23
|
+
StatusBarEntry,
|
|
24
|
+
KeybindingRegistry,
|
|
25
|
+
ViewContainerTitleOptions,
|
|
26
|
+
codicon,
|
|
27
|
+
StylingParticipant,
|
|
28
|
+
ColorTheme,
|
|
29
|
+
CssStyleCollector
|
|
30
|
+
} from '@theia/core/lib/browser';
|
|
31
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry, TabBarToolbarItem } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
32
|
+
import { CommandRegistry, Command, Disposable, DisposableCollection, CommandService } from '@theia/core/lib/common';
|
|
33
|
+
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
34
|
+
import { ScmService } from './scm-service';
|
|
35
|
+
import { ScmWidget } from '../browser/scm-widget';
|
|
36
|
+
import URI from '@theia/core/lib/common/uri';
|
|
37
|
+
import { ScmQuickOpenService } from './scm-quick-open-service';
|
|
38
|
+
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
|
39
|
+
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
40
|
+
import { Color } from '@theia/core/lib/common/color';
|
|
41
|
+
import { ScmCommand } from './scm-provider';
|
|
42
|
+
import { ScmDecorationsService } from '../browser/decorations/scm-decorations-service';
|
|
43
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
44
|
+
import { isHighContrast } from '@theia/core/lib/common/theme';
|
|
45
|
+
|
|
46
|
+
export const SCM_WIDGET_FACTORY_ID = ScmWidget.ID;
|
|
47
|
+
export const SCM_VIEW_CONTAINER_ID = 'scm-view-container';
|
|
48
|
+
export const SCM_VIEW_CONTAINER_TITLE_OPTIONS: ViewContainerTitleOptions = {
|
|
49
|
+
label: nls.localizeByDefault('Source Control'),
|
|
50
|
+
iconClass: codicon('source-control'),
|
|
51
|
+
closeable: true
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export namespace SCM_COMMANDS {
|
|
55
|
+
export const CHANGE_REPOSITORY = {
|
|
56
|
+
id: 'scm.change.repository',
|
|
57
|
+
category: nls.localizeByDefault('Source Control'),
|
|
58
|
+
originalCategory: 'Source Control',
|
|
59
|
+
label: nls.localize('theia/scm/changeRepository', 'Change Repository...'),
|
|
60
|
+
originalLabel: 'Change Repository...'
|
|
61
|
+
};
|
|
62
|
+
export const ACCEPT_INPUT = {
|
|
63
|
+
id: 'scm.acceptInput'
|
|
64
|
+
};
|
|
65
|
+
export const TREE_VIEW_MODE = {
|
|
66
|
+
id: 'scm.viewmode.tree',
|
|
67
|
+
tooltip: nls.localizeByDefault('View as Tree'),
|
|
68
|
+
iconClass: codicon('list-tree'),
|
|
69
|
+
originalLabel: 'View as Tree',
|
|
70
|
+
label: nls.localizeByDefault('View as Tree')
|
|
71
|
+
};
|
|
72
|
+
export const LIST_VIEW_MODE = {
|
|
73
|
+
id: 'scm.viewmode.list',
|
|
74
|
+
tooltip: nls.localizeByDefault('View as List'),
|
|
75
|
+
iconClass: codicon('list-flat'),
|
|
76
|
+
originalLabel: 'View as List',
|
|
77
|
+
label: nls.localizeByDefault('View as List')
|
|
78
|
+
};
|
|
79
|
+
export const COLLAPSE_ALL = {
|
|
80
|
+
id: 'scm.collapseAll',
|
|
81
|
+
category: nls.localizeByDefault('Source Control'),
|
|
82
|
+
originalCategory: 'Source Control',
|
|
83
|
+
tooltip: nls.localizeByDefault('Collapse All'),
|
|
84
|
+
iconClass: codicon('collapse-all'),
|
|
85
|
+
label: nls.localizeByDefault('Collapse All'),
|
|
86
|
+
originalLabel: 'Collapse All'
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export namespace ScmColors {
|
|
91
|
+
export const editorGutterModifiedBackground = 'editorGutter.modifiedBackground';
|
|
92
|
+
export const editorGutterAddedBackground = 'editorGutter.addedBackground';
|
|
93
|
+
export const editorGutterDeletedBackground = 'editorGutter.deletedBackground';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@injectable()
|
|
97
|
+
export class ScmContribution extends AbstractViewContribution<ScmWidget> implements
|
|
98
|
+
FrontendApplicationContribution,
|
|
99
|
+
TabBarToolbarContribution,
|
|
100
|
+
ColorContribution,
|
|
101
|
+
StylingParticipant {
|
|
102
|
+
|
|
103
|
+
@inject(StatusBar) protected readonly statusBar: StatusBar;
|
|
104
|
+
@inject(ScmService) protected readonly scmService: ScmService;
|
|
105
|
+
@inject(ScmQuickOpenService) protected readonly scmQuickOpenService: ScmQuickOpenService;
|
|
106
|
+
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
107
|
+
@inject(CommandService) protected readonly commands: CommandService;
|
|
108
|
+
@inject(CommandRegistry) protected readonly commandRegistry: CommandRegistry;
|
|
109
|
+
@inject(ContextKeyService) protected readonly contextKeys: ContextKeyService;
|
|
110
|
+
@inject(ScmDecorationsService) protected readonly scmDecorationsService: ScmDecorationsService;
|
|
111
|
+
|
|
112
|
+
protected scmFocus: ContextKey<boolean>;
|
|
113
|
+
|
|
114
|
+
constructor() {
|
|
115
|
+
super({
|
|
116
|
+
viewContainerId: SCM_VIEW_CONTAINER_ID,
|
|
117
|
+
widgetId: SCM_WIDGET_FACTORY_ID,
|
|
118
|
+
widgetName: SCM_VIEW_CONTAINER_TITLE_OPTIONS.label,
|
|
119
|
+
defaultWidgetOptions: {
|
|
120
|
+
area: 'left',
|
|
121
|
+
rank: 300
|
|
122
|
+
},
|
|
123
|
+
toggleCommandId: 'scmView:toggle',
|
|
124
|
+
toggleKeybinding: 'ctrlcmd+shift+g'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@postConstruct()
|
|
129
|
+
protected init(): void {
|
|
130
|
+
this.scmFocus = this.contextKeys.createKey('scmFocus', false);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async initializeLayout(): Promise<void> {
|
|
134
|
+
await this.openView();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
onStart(): void {
|
|
138
|
+
this.updateStatusBar();
|
|
139
|
+
this.scmService.onDidAddRepository(() => this.updateStatusBar());
|
|
140
|
+
this.scmService.onDidRemoveRepository(() => this.updateStatusBar());
|
|
141
|
+
this.scmService.onDidChangeSelectedRepository(() => this.updateStatusBar());
|
|
142
|
+
this.scmService.onDidChangeStatusBarCommands(() => this.updateStatusBar());
|
|
143
|
+
this.labelProvider.onDidChange(() => this.updateStatusBar());
|
|
144
|
+
|
|
145
|
+
this.updateContextKeys();
|
|
146
|
+
this.shell.onDidChangeCurrentWidget(() => this.updateContextKeys());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
protected updateContextKeys(): void {
|
|
150
|
+
this.scmFocus.set(this.shell.currentWidget instanceof ScmWidget);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
override registerCommands(commandRegistry: CommandRegistry): void {
|
|
154
|
+
super.registerCommands(commandRegistry);
|
|
155
|
+
commandRegistry.registerCommand(SCM_COMMANDS.CHANGE_REPOSITORY, {
|
|
156
|
+
execute: () => this.scmQuickOpenService.changeRepository(),
|
|
157
|
+
isEnabled: () => this.scmService.repositories.length > 1
|
|
158
|
+
});
|
|
159
|
+
commandRegistry.registerCommand(SCM_COMMANDS.ACCEPT_INPUT, {
|
|
160
|
+
execute: () => this.acceptInput(),
|
|
161
|
+
isEnabled: () => !!this.scmFocus.get() && !!this.acceptInputCommand()
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
166
|
+
const viewModeEmitter = new Emitter<void>();
|
|
167
|
+
const registerToggleViewItem = (command: Command, mode: 'tree' | 'list') => {
|
|
168
|
+
const id = command.id;
|
|
169
|
+
const item: TabBarToolbarItem = {
|
|
170
|
+
id,
|
|
171
|
+
command: id,
|
|
172
|
+
tooltip: command.label,
|
|
173
|
+
onDidChange: viewModeEmitter.event
|
|
174
|
+
};
|
|
175
|
+
this.commandRegistry.registerCommand({ id, iconClass: command && command.iconClass }, {
|
|
176
|
+
execute: widget => {
|
|
177
|
+
if (widget instanceof ScmWidget) {
|
|
178
|
+
widget.viewMode = mode;
|
|
179
|
+
viewModeEmitter.fire();
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
isVisible: widget => {
|
|
183
|
+
if (widget instanceof ScmWidget) {
|
|
184
|
+
return !!this.scmService.selectedRepository
|
|
185
|
+
&& widget.viewMode !== mode;
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
registry.registerItem(item);
|
|
191
|
+
};
|
|
192
|
+
registerToggleViewItem(SCM_COMMANDS.TREE_VIEW_MODE, 'tree');
|
|
193
|
+
registerToggleViewItem(SCM_COMMANDS.LIST_VIEW_MODE, 'list');
|
|
194
|
+
|
|
195
|
+
this.commandRegistry.registerCommand(SCM_COMMANDS.COLLAPSE_ALL, {
|
|
196
|
+
execute: widget => {
|
|
197
|
+
if (widget instanceof ScmWidget && widget.viewMode === 'tree') {
|
|
198
|
+
widget.collapseScmTree();
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
isVisible: widget => {
|
|
202
|
+
if (widget instanceof ScmWidget) {
|
|
203
|
+
return !!this.scmService.selectedRepository && widget.viewMode === 'tree';
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
registry.registerItem({
|
|
210
|
+
...SCM_COMMANDS.COLLAPSE_ALL,
|
|
211
|
+
command: SCM_COMMANDS.COLLAPSE_ALL.id
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
override registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
216
|
+
super.registerKeybindings(keybindings);
|
|
217
|
+
keybindings.registerKeybinding({
|
|
218
|
+
command: SCM_COMMANDS.ACCEPT_INPUT.id,
|
|
219
|
+
keybinding: 'ctrlcmd+enter',
|
|
220
|
+
when: 'scmFocus'
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
protected async acceptInput(): Promise<void> {
|
|
225
|
+
const command = this.acceptInputCommand();
|
|
226
|
+
if (command && command.command) {
|
|
227
|
+
await this.commands.executeCommand(command.command, ...command.arguments ? command.arguments : []);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
protected acceptInputCommand(): ScmCommand | undefined {
|
|
231
|
+
const repository = this.scmService.selectedRepository;
|
|
232
|
+
if (!repository) {
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
return repository.provider.acceptInputCommand;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
protected readonly statusBarDisposable = new DisposableCollection();
|
|
239
|
+
protected updateStatusBar(): void {
|
|
240
|
+
this.statusBarDisposable.dispose();
|
|
241
|
+
const repository = this.scmService.selectedRepository;
|
|
242
|
+
if (!repository) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const name = this.labelProvider.getName(new URI(repository.provider.rootUri));
|
|
246
|
+
if (this.scmService.repositories.length > 1) {
|
|
247
|
+
this.setStatusBarEntry(SCM_COMMANDS.CHANGE_REPOSITORY.id, {
|
|
248
|
+
text: `$(database) ${name}`,
|
|
249
|
+
tooltip: name.toString(),
|
|
250
|
+
command: SCM_COMMANDS.CHANGE_REPOSITORY.id,
|
|
251
|
+
alignment: StatusBarAlignment.LEFT,
|
|
252
|
+
priority: 100
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
const label = repository.provider.rootUri ? `${name} (${repository.provider.label})` : repository.provider.label;
|
|
256
|
+
this.scmService.statusBarCommands.forEach((value, index) => this.setStatusBarEntry(`scm.status.${index}`, {
|
|
257
|
+
text: value.title,
|
|
258
|
+
tooltip: label + (value.tooltip ? ` - ${value.tooltip}` : ''),
|
|
259
|
+
command: value.command,
|
|
260
|
+
arguments: value.arguments,
|
|
261
|
+
alignment: StatusBarAlignment.LEFT,
|
|
262
|
+
priority: 100
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
protected setStatusBarEntry(id: string, entry: StatusBarEntry): void {
|
|
266
|
+
this.statusBar.setElement(id, entry);
|
|
267
|
+
this.statusBarDisposable.push(Disposable.create(() => this.statusBar.removeElement(id)));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* It should be aligned with https://github.com/microsoft/vscode/blob/0dfa355b3ad185a6289ba28a99c141ab9e72d2be/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts#L808
|
|
272
|
+
*/
|
|
273
|
+
registerColors(colors: ColorRegistry): void {
|
|
274
|
+
colors.register(
|
|
275
|
+
{
|
|
276
|
+
id: ScmColors.editorGutterModifiedBackground, defaults: {
|
|
277
|
+
dark: '#1B81A8',
|
|
278
|
+
light: '#2090D3',
|
|
279
|
+
hcDark: '#1B81A8',
|
|
280
|
+
hcLight: '#2090D3'
|
|
281
|
+
}, description: 'Editor gutter background color for lines that are modified.'
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: ScmColors.editorGutterAddedBackground, defaults: {
|
|
285
|
+
dark: '#487E02',
|
|
286
|
+
light: '#48985D',
|
|
287
|
+
hcDark: '#487E02',
|
|
288
|
+
hcLight: '#48985D'
|
|
289
|
+
}, description: 'Editor gutter background color for lines that are added.'
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: ScmColors.editorGutterDeletedBackground, defaults: {
|
|
293
|
+
dark: 'editorError.foreground',
|
|
294
|
+
light: 'editorError.foreground',
|
|
295
|
+
hcDark: 'editorError.foreground',
|
|
296
|
+
hcLight: 'editorError.foreground'
|
|
297
|
+
}, description: 'Editor gutter background color for lines that are deleted.'
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: 'minimapGutter.modifiedBackground', defaults: {
|
|
301
|
+
dark: 'editorGutter.modifiedBackground',
|
|
302
|
+
light: 'editorGutter.modifiedBackground',
|
|
303
|
+
hcDark: 'editorGutter.modifiedBackground',
|
|
304
|
+
hcLight: 'editorGutter.modifiedBackground'
|
|
305
|
+
}, description: 'Minimap gutter background color for lines that are modified.'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: 'minimapGutter.addedBackground', defaults: {
|
|
309
|
+
dark: 'editorGutter.addedBackground',
|
|
310
|
+
light: 'editorGutter.addedBackground',
|
|
311
|
+
hcDark: 'editorGutter.modifiedBackground',
|
|
312
|
+
hcLight: 'editorGutter.modifiedBackground'
|
|
313
|
+
}, description: 'Minimap gutter background color for lines that are added.'
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: 'minimapGutter.deletedBackground', defaults: {
|
|
317
|
+
dark: 'editorGutter.deletedBackground',
|
|
318
|
+
light: 'editorGutter.deletedBackground',
|
|
319
|
+
hcDark: 'editorGutter.deletedBackground',
|
|
320
|
+
hcLight: 'editorGutter.deletedBackground'
|
|
321
|
+
}, description: 'Minimap gutter background color for lines that are deleted.'
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: 'editorOverviewRuler.modifiedForeground', defaults: {
|
|
325
|
+
dark: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
326
|
+
light: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
327
|
+
hcDark: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6),
|
|
328
|
+
hcLight: Color.transparent(ScmColors.editorGutterModifiedBackground, 0.6)
|
|
329
|
+
}, description: 'Overview ruler marker color for modified content.'
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: 'editorOverviewRuler.addedForeground', defaults: {
|
|
333
|
+
dark: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
334
|
+
light: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
335
|
+
hcDark: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6),
|
|
336
|
+
hcLight: Color.transparent(ScmColors.editorGutterAddedBackground, 0.6)
|
|
337
|
+
}, description: 'Overview ruler marker color for added content.'
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'editorOverviewRuler.deletedForeground', defaults: {
|
|
341
|
+
dark: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
342
|
+
light: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
343
|
+
hcDark: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6),
|
|
344
|
+
hcLight: Color.transparent(ScmColors.editorGutterDeletedBackground, 0.6)
|
|
345
|
+
}, description: 'Overview ruler marker color for deleted content.'
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
registerThemeStyle(theme: ColorTheme, collector: CssStyleCollector): void {
|
|
351
|
+
const contrastBorder = theme.getColor('contrastBorder');
|
|
352
|
+
if (contrastBorder && isHighContrast(theme.type)) {
|
|
353
|
+
collector.addRule(`
|
|
354
|
+
.theia-scm-input-message-container textarea {
|
|
355
|
+
outline: var(--theia-border-width) solid ${contrastBorder};
|
|
356
|
+
outline-offset: -1px;
|
|
357
|
+
}
|
|
358
|
+
`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|