blob: e180e8e9d3ca9b9bb68e05def56fed6f25ed95a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Command } from 'vs/editor/common/languages';
import { ISequence } from 'vs/base/common/sequence';
import { IAction } from 'vs/base/common/actions';
import { IMenu } from 'vs/platform/actions/common/actions';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IMarkdownString } from 'vs/base/common/htmlContent';
export const VIEWLET_ID = 'workbench.view.scm';
export const VIEW_PANE_ID = 'workbench.scm';
export const REPOSITORIES_VIEW_PANE_ID = 'workbench.scm.repositories';
export interface IBaselineResourceProvider {
getBaselineResource(resource: URI): Promise<URI>;
}
export const ISCMService = createDecorator<ISCMService>('scm');
export interface ISCMResourceDecorations {
icon?: URI | ThemeIcon;
iconDark?: URI | ThemeIcon;
tooltip?: string;
strikeThrough?: boolean;
faded?: boolean;
}
export interface ISCMResource {
readonly resourceGroup: ISCMResourceGroup;
readonly sourceUri: URI;
readonly decorations: ISCMResourceDecorations;
readonly contextValue: string | undefined;
readonly command: Command | undefined;
open(preserveFocus: boolean): Promise<void>;
}
export interface ISCMResourceGroup extends ISequence<ISCMResource> {
readonly provider: ISCMProvider;
readonly label: string;
readonly id: string;
readonly hideWhenEmpty: boolean;
readonly onDidChange: Event<void>;
}
export interface ISCMProvider extends IDisposable {
readonly label: string;
readonly id: string;
readonly contextValue: string;
readonly groups: ISequence<ISCMResourceGroup>;
// TODO@Joao: remove
readonly onDidChangeResources: Event<void>;
readonly rootUri?: URI;
readonly count?: number;
readonly commitTemplate: string;
readonly onDidChangeCommitTemplate: Event<string>;
readonly onDidChangeStatusBarCommands?: Event<Command[]>;
readonly acceptInputCommand?: Command;
readonly actionButton?: ISCMActionButtonDescriptor;
readonly statusBarCommands?: Command[];
readonly onDidChange: Event<void>;
getOriginalResource(uri: URI): Promise<URI | null>;
}
export const enum InputValidationType {
Error = 0,
Warning = 1,
Information = 2
}
export interface IInputValidation {
message: string | IMarkdownString;
type: InputValidationType;
}
export interface IInputValidator {
(value: string, cursorPosition: number): Promise<IInputValidation | undefined>;
}
export enum SCMInputChangeReason {
HistoryPrevious,
HistoryNext
}
export interface ISCMInputChangeEvent {
readonly value: string;
readonly reason?: SCMInputChangeReason;
}
export interface ISCMActionButtonDescriptor {
command: Command;
description?: string;
}
export interface ISCMActionButton {
readonly type: 'actionButton';
readonly repository: ISCMRepository;
readonly button?: ISCMActionButtonDescriptor;
}
export interface ISCMInput {
readonly repository: ISCMRepository;
readonly value: string;
setValue(value: string, fromKeyboard: boolean): void;
readonly onDidChange: Event<ISCMInputChangeEvent>;
placeholder: string;
readonly onDidChangePlaceholder: Event<string>;
validateInput: IInputValidator;
readonly onDidChangeValidateInput: Event<void>;
visible: boolean;
readonly onDidChangeVisibility: Event<boolean>;
setFocus(): void;
readonly onDidChangeFocus: Event<void>;
showValidationMessage(message: string | IMarkdownString, type: InputValidationType): void;
readonly onDidChangeValidationMessage: Event<IInputValidation>;
showNextHistoryValue(): void;
showPreviousHistoryValue(): void;
}
export interface ISCMRepository extends IDisposable {
readonly id: string;
readonly provider: ISCMProvider;
readonly input: ISCMInput;
}
export interface ISCMService {
readonly _serviceBrand: undefined;
readonly onDidAddRepository: Event<ISCMRepository>;
readonly onDidRemoveRepository: Event<ISCMRepository>;
readonly repositories: Iterable<ISCMRepository>;
readonly repositoryCount: number;
registerSCMProvider(provider: ISCMProvider): ISCMRepository;
getRepository(id: string): ISCMRepository | undefined;
}
export interface ISCMTitleMenu {
readonly actions: IAction[];
readonly secondaryActions: IAction[];
readonly onDidChangeTitle: Event<void>;
readonly menu: IMenu;
}
export interface ISCMRepositoryMenus {
readonly titleMenu: ISCMTitleMenu;
readonly repositoryMenu: IMenu;
getResourceGroupMenu(group: ISCMResourceGroup): IMenu;
getResourceMenu(resource: ISCMResource): IMenu;
getResourceFolderMenu(group: ISCMResourceGroup): IMenu;
}
export interface ISCMMenus {
getRepositoryMenus(provider: ISCMProvider): ISCMRepositoryMenus;
}
export const enum ISCMRepositorySortKey {
DiscoveryTime = 'discoveryTime',
Name = 'name',
Path = 'path'
}
export const ISCMViewService = createDecorator<ISCMViewService>('scmView');
export interface ISCMViewVisibleRepositoryChangeEvent {
readonly added: Iterable<ISCMRepository>;
readonly removed: Iterable<ISCMRepository>;
}
export interface ISCMViewService {
readonly _serviceBrand: undefined;
readonly menus: ISCMMenus;
repositories: ISCMRepository[];
readonly onDidChangeRepositories: Event<ISCMViewVisibleRepositoryChangeEvent>;
visibleRepositories: ISCMRepository[];
readonly onDidChangeVisibleRepositories: Event<ISCMViewVisibleRepositoryChangeEvent>;
isVisible(repository: ISCMRepository): boolean;
toggleVisibility(repository: ISCMRepository, visible?: boolean): void;
toggleSortKey(sortKey: ISCMRepositorySortKey): void;
readonly focusedRepository: ISCMRepository | undefined;
readonly onDidFocusRepository: Event<ISCMRepository | undefined>;
focus(repository: ISCMRepository): void;
}
|