@codingame/monaco-vscode-timeline-service-override 11.1.1 → 12.0.0
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/index.d.ts +2 -1
- package/index.js +15 -1
- package/package.json +25 -7
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.contribution.js +3 -2
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.js +6 -10
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.js +53 -54
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider.js +3 -2
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.js +21 -20
- package/vscode/src/vs/workbench/contrib/timeline/browser/media/timelinePane.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/timeline/browser/timeline.contribution.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/timeline/browser/timeline.contribution.js +18 -20
- package/vscode/src/vs/workbench/contrib/timeline/browser/timelinePane.d.ts +136 -0
- package/vscode/src/vs/workbench/contrib/timeline/browser/timelinePane.js +118 -121
- package/vscode/src/vs/workbench/contrib/timeline/common/timelineService.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/timeline/common/timelineService.js +2 -1
- package/timeline.js +0 -13
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
+
import './vscode/src/vs/workbench/contrib/timeline/browser/timeline.contribution.js';
|
|
5
|
+
import './vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.contribution.js';
|
|
6
|
+
import { ITimelineService } from 'vscode/vscode/vs/workbench/contrib/timeline/common/timeline.service';
|
|
7
|
+
import { TimelineService } from './vscode/src/vs/workbench/contrib/timeline/common/timelineService.js';
|
|
8
|
+
|
|
9
|
+
function getServiceOverride() {
|
|
10
|
+
return {
|
|
11
|
+
[ITimelineService.toString()]: new SyncDescriptor(TimelineService, [], true)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-timeline-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - timeline service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,22 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common": "12.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-b71b5434-ce96-5581-8993-e8da380bd63f-common": "12.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-cc9ccbec-e2a1-599d-84ae-46f5efc666e3-common": "12.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-d6e33d82-c101-549d-a885-0807ab3e0cfb-common": "12.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-f48982c4-9e82-55e2-b800-20e6d1e6096f-common": "12.0.0",
|
|
23
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@codingame/monaco-vscode-working-copy-service-override": "12.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"@codingame/monaco-vscode-working-copy-service-override": {
|
|
30
|
+
"optional": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
17
33
|
"main": "index.js",
|
|
18
34
|
"module": "index.js",
|
|
19
35
|
"types": "index.d.ts",
|
|
@@ -22,10 +38,12 @@
|
|
|
22
38
|
"default": "./index.js"
|
|
23
39
|
},
|
|
24
40
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
41
|
+
"default": "./vscode/src/*.js",
|
|
42
|
+
"types": "./vscode/src/*.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./*": {
|
|
45
|
+
"default": "./*.js",
|
|
46
|
+
"types": "./*.d.ts"
|
|
26
47
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.1"
|
|
30
48
|
}
|
|
31
49
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
|
|
1
2
|
import './localHistoryCommands.js';
|
|
2
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
3
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
3
4
|
import { LocalHistoryTimeline } from './localHistoryTimeline.js';
|
|
4
5
|
|
|
5
|
-
registerWorkbenchContribution2(LocalHistoryTimeline.ID, LocalHistoryTimeline,
|
|
6
|
+
registerWorkbenchContribution2(LocalHistoryTimeline.ID, LocalHistoryTimeline, WorkbenchPhase.BlockRestore );
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ILocalHistoryDateFormatter {
|
|
2
|
+
format: (timestamp: number) => string;
|
|
3
|
+
}
|
|
4
|
+
export declare function getLocalHistoryDateFormatter(): ILocalHistoryDateFormatter;
|
|
5
|
+
export declare const LOCAL_HISTORY_MENU_CONTEXT_VALUE = "localHistory:item";
|
|
6
|
+
export declare const LOCAL_HISTORY_MENU_CONTEXT_KEY: import("vscode/vscode/vs/platform/contextkey/common/contextkey").ContextKeyExpression;
|
|
7
|
+
export declare const LOCAL_HISTORY_ICON_ENTRY: import("vscode/vscode/vs/base/common/themables").ThemeIcon;
|
|
8
|
+
export declare const LOCAL_HISTORY_ICON_RESTORE: import("vscode/vscode/vs/base/common/themables").ThemeIcon;
|
|
9
|
+
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
+
|
|
1
2
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
3
4
|
import { language } from 'vscode/vscode/vs/base/common/platform';
|
|
4
5
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
6
|
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
7
|
+
import { safeIntl } from 'vscode/vscode/vs/base/common/date';
|
|
6
8
|
|
|
7
9
|
let localHistoryDateFormatter = undefined;
|
|
8
10
|
function getLocalHistoryDateFormatter() {
|
|
9
11
|
if (!localHistoryDateFormatter) {
|
|
10
12
|
const options = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
formatter = new Intl.DateTimeFormat(language, options);
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
formatter = new Intl.DateTimeFormat(undefined, options);
|
|
17
|
-
}
|
|
13
|
+
const formatter = safeIntl.DateTimeFormat(language, options);
|
|
18
14
|
localHistoryDateFormatter = {
|
|
19
15
|
format: date => formatter.format(date)
|
|
20
16
|
};
|
|
@@ -22,8 +18,8 @@ function getLocalHistoryDateFormatter() {
|
|
|
22
18
|
return localHistoryDateFormatter;
|
|
23
19
|
}
|
|
24
20
|
const LOCAL_HISTORY_MENU_CONTEXT_VALUE = 'localHistory:item';
|
|
25
|
-
const LOCAL_HISTORY_MENU_CONTEXT_KEY = (
|
|
26
|
-
const LOCAL_HISTORY_ICON_ENTRY = registerIcon('localHistory-icon', Codicon.circleOutline, ( localize(
|
|
27
|
-
const LOCAL_HISTORY_ICON_RESTORE = registerIcon('localHistory-restore', Codicon.check, ( localize(
|
|
21
|
+
const LOCAL_HISTORY_MENU_CONTEXT_KEY = ( ContextKeyExpr.equals('timelineItem', LOCAL_HISTORY_MENU_CONTEXT_VALUE));
|
|
22
|
+
const LOCAL_HISTORY_ICON_ENTRY = registerIcon('localHistory-icon', Codicon.circleOutline, ( localize(6960, "Icon for a local history entry in the timeline view.")));
|
|
23
|
+
const LOCAL_HISTORY_ICON_RESTORE = registerIcon('localHistory-restore', Codicon.check, ( localize(6961, "Icon for restoring contents of a local history entry.")));
|
|
28
24
|
|
|
29
25
|
export { LOCAL_HISTORY_ICON_ENTRY, LOCAL_HISTORY_ICON_RESTORE, LOCAL_HISTORY_MENU_CONTEXT_KEY, LOCAL_HISTORY_MENU_CONTEXT_VALUE, getLocalHistoryDateFormatter };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
2
|
+
import { IWorkingCopyHistoryEntry } from "@codingame/monaco-vscode-working-copy-service-override/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory";
|
|
3
|
+
import { IWorkingCopyHistoryService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service";
|
|
4
|
+
import { IEditorOptions } from "vscode/vscode/vs/platform/editor/common/editor";
|
|
5
|
+
export interface ITimelineCommandArgument {
|
|
6
|
+
uri: URI;
|
|
7
|
+
handle: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const COMPARE_WITH_FILE_LABEL: import("vscode/vscode/vs/nls").ILocalizedString;
|
|
10
|
+
export declare function toDiffEditorArguments(entry: IWorkingCopyHistoryEntry, resource: URI, options?: IEditorOptions): unknown[];
|
|
11
|
+
export declare function toDiffEditorArguments(previousEntry: IWorkingCopyHistoryEntry, entry: IWorkingCopyHistoryEntry, options?: IEditorOptions): unknown[];
|
|
12
|
+
export declare function findLocalHistoryEntry(workingCopyHistoryService: IWorkingCopyHistoryService, descriptor: ITimelineCommandArgument): Promise<{
|
|
13
|
+
entry: IWorkingCopyHistoryEntry | undefined;
|
|
14
|
+
previous: IWorkingCopyHistoryEntry | undefined;
|
|
15
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
4
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
@@ -5,7 +6,7 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
|
5
6
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
6
7
|
import { CancellationToken, CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
7
8
|
import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service';
|
|
8
|
-
import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
9
|
+
import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from '@codingame/monaco-vscode-f48982c4-9e82-55e2-b800-20e6d1e6096f-common/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
9
10
|
import { LocalHistoryFileSystemProvider } from './localHistoryFileSystemProvider.js';
|
|
10
11
|
import { ContextKeyExpr, RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
11
12
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
@@ -30,9 +31,9 @@ import { ResourceSet } from 'vscode/vscode/vs/base/common/map';
|
|
|
30
31
|
import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history.service';
|
|
31
32
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
32
33
|
|
|
33
|
-
const LOCAL_HISTORY_CATEGORY = ( localize2(
|
|
34
|
-
const CTX_LOCAL_HISTORY_ENABLED = (
|
|
35
|
-
const COMPARE_WITH_FILE_LABEL = ( localize2(
|
|
34
|
+
const LOCAL_HISTORY_CATEGORY = ( localize2(6962, 'Local History'));
|
|
35
|
+
const CTX_LOCAL_HISTORY_ENABLED = ( ContextKeyExpr.has('config.workbench.localHistory.enabled'));
|
|
36
|
+
const COMPARE_WITH_FILE_LABEL = ( localize2(6963, 'Compare with File'));
|
|
36
37
|
registerAction2(class extends Action2 {
|
|
37
38
|
constructor() {
|
|
38
39
|
super({
|
|
@@ -59,7 +60,7 @@ registerAction2(class extends Action2 {
|
|
|
59
60
|
constructor() {
|
|
60
61
|
super({
|
|
61
62
|
id: 'workbench.action.localHistory.compareWithPrevious',
|
|
62
|
-
title: ( localize2(
|
|
63
|
+
title: ( localize2(6964, 'Compare with Previous')),
|
|
63
64
|
menu: {
|
|
64
65
|
id: MenuId.TimelineItemContext,
|
|
65
66
|
group: '1_compare',
|
|
@@ -82,12 +83,12 @@ registerAction2(class extends Action2 {
|
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
let itemSelectedForCompare = undefined;
|
|
85
|
-
const LocalHistoryItemSelectedForCompare = (
|
|
86
|
+
const LocalHistoryItemSelectedForCompare = ( new RawContextKey('localHistoryItemSelectedForCompare', false, true));
|
|
86
87
|
registerAction2(class extends Action2 {
|
|
87
88
|
constructor() {
|
|
88
89
|
super({
|
|
89
90
|
id: 'workbench.action.localHistory.selectForCompare',
|
|
90
|
-
title: ( localize2(
|
|
91
|
+
title: ( localize2(6965, 'Select for Compare')),
|
|
91
92
|
menu: {
|
|
92
93
|
id: MenuId.TimelineItemContext,
|
|
93
94
|
group: '2_compare_with',
|
|
@@ -110,12 +111,12 @@ registerAction2(class extends Action2 {
|
|
|
110
111
|
constructor() {
|
|
111
112
|
super({
|
|
112
113
|
id: 'workbench.action.localHistory.compareWithSelected',
|
|
113
|
-
title: ( localize2(
|
|
114
|
+
title: ( localize2(6966, 'Compare with Selected')),
|
|
114
115
|
menu: {
|
|
115
116
|
id: MenuId.TimelineItemContext,
|
|
116
117
|
group: '2_compare_with',
|
|
117
118
|
order: 1,
|
|
118
|
-
when: (
|
|
119
|
+
when: ( ContextKeyExpr.and(LOCAL_HISTORY_MENU_CONTEXT_KEY, LocalHistoryItemSelectedForCompare))
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
}
|
|
@@ -139,7 +140,7 @@ registerAction2(class extends Action2 {
|
|
|
139
140
|
constructor() {
|
|
140
141
|
super({
|
|
141
142
|
id: 'workbench.action.localHistory.open',
|
|
142
|
-
title: ( localize2(
|
|
143
|
+
title: ( localize2(6967, 'Show Contents')),
|
|
143
144
|
menu: {
|
|
144
145
|
id: MenuId.TimelineItemContext,
|
|
145
146
|
group: '3_contents',
|
|
@@ -157,7 +158,7 @@ registerAction2(class extends Action2 {
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
});
|
|
160
|
-
const RESTORE_CONTENTS_LABEL = ( localize2(
|
|
161
|
+
const RESTORE_CONTENTS_LABEL = ( localize2(6968, 'Restore Contents'));
|
|
161
162
|
registerAction2(class extends Action2 {
|
|
162
163
|
constructor() {
|
|
163
164
|
super({
|
|
@@ -167,7 +168,7 @@ registerAction2(class extends Action2 {
|
|
|
167
168
|
id: MenuId.EditorTitle,
|
|
168
169
|
group: 'navigation',
|
|
169
170
|
order: -10,
|
|
170
|
-
when: (
|
|
171
|
+
when: ( ResourceContextKey.Scheme.isEqualTo(LocalHistoryFileSystemProvider.SCHEMA))
|
|
171
172
|
},
|
|
172
173
|
icon: LOCAL_HISTORY_ICON_RESTORE
|
|
173
174
|
});
|
|
@@ -194,7 +195,7 @@ registerAction2(class extends Action2 {
|
|
|
194
195
|
return restore(accessor, item);
|
|
195
196
|
}
|
|
196
197
|
});
|
|
197
|
-
const restoreSaveSource = SaveSourceRegistry.registerSource('localHistoryRestore.source', ( localize(
|
|
198
|
+
const restoreSaveSource = SaveSourceRegistry.registerSource('localHistoryRestore.source', ( localize(6969, "File Restored")));
|
|
198
199
|
async function restore(accessor, item) {
|
|
199
200
|
const fileService = accessor.get(IFileService);
|
|
200
201
|
const dialogService = accessor.get(IDialogService);
|
|
@@ -206,12 +207,12 @@ async function restore(accessor, item) {
|
|
|
206
207
|
const { confirmed } = await dialogService.confirm({
|
|
207
208
|
type: 'warning',
|
|
208
209
|
message: ( localize(
|
|
209
|
-
|
|
210
|
+
6970,
|
|
210
211
|
"Do you want to restore the contents of '{0}'?",
|
|
211
212
|
basename(entry.workingCopy.resource)
|
|
212
213
|
)),
|
|
213
|
-
detail: ( localize(
|
|
214
|
-
primaryButton: ( localize(
|
|
214
|
+
detail: ( localize(6971, "Restoring will discard any unsaved changes.")),
|
|
215
|
+
primaryButton: ( localize(6972, "&&Restore"))
|
|
215
216
|
});
|
|
216
217
|
if (!confirmed) {
|
|
217
218
|
return;
|
|
@@ -228,7 +229,7 @@ async function restore(accessor, item) {
|
|
|
228
229
|
await fileService.cloneFile(entry.location, entry.workingCopy.resource);
|
|
229
230
|
}
|
|
230
231
|
catch (error) {
|
|
231
|
-
await dialogService.error(( localize(
|
|
232
|
+
await dialogService.error(( localize(6973, "Unable to restore '{0}'.", basename(entry.workingCopy.resource))), toErrorMessage(error));
|
|
232
233
|
return;
|
|
233
234
|
}
|
|
234
235
|
if (workingCopies) {
|
|
@@ -248,7 +249,7 @@ registerAction2(class extends Action2 {
|
|
|
248
249
|
constructor() {
|
|
249
250
|
super({
|
|
250
251
|
id: 'workbench.action.localHistory.restoreViaPicker',
|
|
251
|
-
title: ( localize2(
|
|
252
|
+
title: ( localize2(6974, 'Find Entry to Restore')),
|
|
252
253
|
f1: true,
|
|
253
254
|
category: LOCAL_HISTORY_CATEGORY,
|
|
254
255
|
precondition: CTX_LOCAL_HISTORY_ENABLED
|
|
@@ -264,57 +265,55 @@ registerAction2(class extends Action2 {
|
|
|
264
265
|
const fileService = accessor.get(IFileService);
|
|
265
266
|
const commandService = accessor.get(ICommandService);
|
|
266
267
|
const historyService = accessor.get(IHistoryService);
|
|
267
|
-
const resourcePickerDisposables = (
|
|
268
|
+
const resourcePickerDisposables = ( new DisposableStore());
|
|
268
269
|
const resourcePicker = resourcePickerDisposables.add(quickInputService.createQuickPick());
|
|
269
|
-
let cts = (
|
|
270
|
+
let cts = ( new CancellationTokenSource());
|
|
270
271
|
resourcePickerDisposables.add(resourcePicker.onDidHide(() => cts.dispose(true)));
|
|
271
272
|
resourcePicker.busy = true;
|
|
272
273
|
resourcePicker.show();
|
|
273
|
-
const resources = (
|
|
274
|
-
const recentEditorResources = (
|
|
275
|
-
coalesce(( (historyService.getHistory().map(({ resource }) => resource))))
|
|
276
|
-
)));
|
|
274
|
+
const resources = ( new ResourceSet(await workingCopyHistoryService.getAll(cts.token)));
|
|
275
|
+
const recentEditorResources = ( new ResourceSet(coalesce(( historyService.getHistory().map(({ resource }) => resource)))));
|
|
277
276
|
const resourcesSortedByRecency = [];
|
|
278
277
|
for (const resource of recentEditorResources) {
|
|
279
|
-
if ((
|
|
278
|
+
if (( resources.has(resource))) {
|
|
280
279
|
resourcesSortedByRecency.push(resource);
|
|
281
280
|
resources.delete(resource);
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
283
|
resourcesSortedByRecency.push(...[...resources].sort((r1, r2) => r1.fsPath < r2.fsPath ? -1 : 1));
|
|
285
284
|
resourcePicker.busy = false;
|
|
286
|
-
resourcePicker.placeholder = ( localize(
|
|
285
|
+
resourcePicker.placeholder = ( localize(6975, "Select the file to show local history for"));
|
|
287
286
|
resourcePicker.matchOnLabel = true;
|
|
288
287
|
resourcePicker.matchOnDescription = true;
|
|
289
|
-
resourcePicker.items = (
|
|
288
|
+
resourcePicker.items = ( [...resourcesSortedByRecency].map(resource => ({
|
|
290
289
|
resource,
|
|
291
290
|
label: basenameOrAuthority(resource),
|
|
292
291
|
description: labelService.getUriLabel(dirname(resource), { relative: true }),
|
|
293
292
|
iconClasses: getIconClasses(modelService, languageService, resource)
|
|
294
|
-
})))
|
|
293
|
+
})));
|
|
295
294
|
await Event.toPromise(resourcePicker.onDidAccept);
|
|
296
295
|
resourcePickerDisposables.dispose();
|
|
297
296
|
const resource = resourcePicker.selectedItems.at(0)?.resource;
|
|
298
297
|
if (!resource) {
|
|
299
298
|
return;
|
|
300
299
|
}
|
|
301
|
-
const entryPickerDisposables = (
|
|
300
|
+
const entryPickerDisposables = ( new DisposableStore());
|
|
302
301
|
const entryPicker = entryPickerDisposables.add(quickInputService.createQuickPick());
|
|
303
|
-
cts = (
|
|
302
|
+
cts = ( new CancellationTokenSource());
|
|
304
303
|
entryPickerDisposables.add(entryPicker.onDidHide(() => cts.dispose(true)));
|
|
305
304
|
entryPicker.busy = true;
|
|
306
305
|
entryPicker.show();
|
|
307
306
|
const entries = await workingCopyHistoryService.getEntries(resource, cts.token);
|
|
308
307
|
entryPicker.busy = false;
|
|
309
308
|
entryPicker.canAcceptInBackground = true;
|
|
310
|
-
entryPicker.placeholder = ( localize(
|
|
309
|
+
entryPicker.placeholder = ( localize(6976, "Select the local history entry to open"));
|
|
311
310
|
entryPicker.matchOnLabel = true;
|
|
312
311
|
entryPicker.matchOnDescription = true;
|
|
313
|
-
entryPicker.items = (
|
|
312
|
+
entryPicker.items = ( Array.from(entries).reverse().map(entry => ({
|
|
314
313
|
entry,
|
|
315
314
|
label: `$(circle-outline) ${SaveSourceRegistry.getSourceLabel(entry.source)}`,
|
|
316
315
|
description: toLocalHistoryEntryDateLabel(entry.timestamp)
|
|
317
|
-
})))
|
|
316
|
+
})));
|
|
318
317
|
entryPickerDisposables.add(entryPicker.onDidAccept(async (e) => {
|
|
319
318
|
if (!e.inBackground) {
|
|
320
319
|
entryPickerDisposables.dispose();
|
|
@@ -331,12 +330,12 @@ registerAction2(class extends Action2 {
|
|
|
331
330
|
}));
|
|
332
331
|
}
|
|
333
332
|
});
|
|
334
|
-
MenuRegistry.appendMenuItem(MenuId.TimelineTitle, { command: { id: 'workbench.action.localHistory.restoreViaPicker', title: ( localize2(
|
|
333
|
+
MenuRegistry.appendMenuItem(MenuId.TimelineTitle, { command: { id: 'workbench.action.localHistory.restoreViaPicker', title: ( localize2(6977, 'Local History: Find Entry to Restore...')) }, group: 'submenu', order: 1, when: CTX_LOCAL_HISTORY_ENABLED });
|
|
335
334
|
registerAction2(class extends Action2 {
|
|
336
335
|
constructor() {
|
|
337
336
|
super({
|
|
338
337
|
id: 'workbench.action.localHistory.rename',
|
|
339
|
-
title: ( localize2(
|
|
338
|
+
title: ( localize2(6978, 'Rename')),
|
|
340
339
|
menu: {
|
|
341
340
|
id: MenuId.TimelineItemContext,
|
|
342
341
|
group: '5_edit',
|
|
@@ -350,11 +349,11 @@ registerAction2(class extends Action2 {
|
|
|
350
349
|
const quickInputService = accessor.get(IQuickInputService);
|
|
351
350
|
const { entry } = await findLocalHistoryEntry(workingCopyHistoryService, item);
|
|
352
351
|
if (entry) {
|
|
353
|
-
const disposables = (
|
|
352
|
+
const disposables = ( new DisposableStore());
|
|
354
353
|
const inputBox = disposables.add(quickInputService.createInputBox());
|
|
355
|
-
inputBox.title = ( localize(
|
|
354
|
+
inputBox.title = ( localize(6979, "Rename Local History Entry"));
|
|
356
355
|
inputBox.ignoreFocusOut = true;
|
|
357
|
-
inputBox.placeholder = ( localize(
|
|
356
|
+
inputBox.placeholder = ( localize(6980, "Enter the new name of the local history entry"));
|
|
358
357
|
inputBox.value = SaveSourceRegistry.getSourceLabel(entry.source);
|
|
359
358
|
inputBox.show();
|
|
360
359
|
disposables.add(inputBox.onDidAccept(() => {
|
|
@@ -370,7 +369,7 @@ registerAction2(class extends Action2 {
|
|
|
370
369
|
constructor() {
|
|
371
370
|
super({
|
|
372
371
|
id: 'workbench.action.localHistory.delete',
|
|
373
|
-
title: ( localize2(
|
|
372
|
+
title: ( localize2(6981, 'Delete')),
|
|
374
373
|
menu: {
|
|
375
374
|
id: MenuId.TimelineItemContext,
|
|
376
375
|
group: '5_edit',
|
|
@@ -388,13 +387,13 @@ registerAction2(class extends Action2 {
|
|
|
388
387
|
const { confirmed } = await dialogService.confirm({
|
|
389
388
|
type: 'warning',
|
|
390
389
|
message: ( localize(
|
|
391
|
-
|
|
390
|
+
6982,
|
|
392
391
|
"Do you want to delete the local history entry of '{0}' from {1}?",
|
|
393
392
|
entry.workingCopy.name,
|
|
394
393
|
toLocalHistoryEntryDateLabel(entry.timestamp)
|
|
395
394
|
)),
|
|
396
|
-
detail: ( localize(
|
|
397
|
-
primaryButton: ( localize(
|
|
395
|
+
detail: ( localize(6983, "This action is irreversible!")),
|
|
396
|
+
primaryButton: ( localize(6984, "&&Delete")),
|
|
398
397
|
});
|
|
399
398
|
if (!confirmed) {
|
|
400
399
|
return;
|
|
@@ -408,7 +407,7 @@ registerAction2(class extends Action2 {
|
|
|
408
407
|
constructor() {
|
|
409
408
|
super({
|
|
410
409
|
id: 'workbench.action.localHistory.deleteAll',
|
|
411
|
-
title: ( localize2(
|
|
410
|
+
title: ( localize2(6985, 'Delete All')),
|
|
412
411
|
f1: true,
|
|
413
412
|
category: LOCAL_HISTORY_CATEGORY,
|
|
414
413
|
precondition: CTX_LOCAL_HISTORY_ENABLED
|
|
@@ -419,9 +418,9 @@ registerAction2(class extends Action2 {
|
|
|
419
418
|
const workingCopyHistoryService = accessor.get(IWorkingCopyHistoryService);
|
|
420
419
|
const { confirmed } = await dialogService.confirm({
|
|
421
420
|
type: 'warning',
|
|
422
|
-
message: ( localize(
|
|
423
|
-
detail: ( localize(
|
|
424
|
-
primaryButton: ( localize(
|
|
421
|
+
message: ( localize(6986, "Do you want to delete all entries of all files in local history?")),
|
|
422
|
+
detail: ( localize(6987, "This action is irreversible!")),
|
|
423
|
+
primaryButton: ( localize(6988, "&&Delete All")),
|
|
425
424
|
});
|
|
426
425
|
if (!confirmed) {
|
|
427
426
|
return;
|
|
@@ -433,10 +432,10 @@ registerAction2(class extends Action2 {
|
|
|
433
432
|
constructor() {
|
|
434
433
|
super({
|
|
435
434
|
id: 'workbench.action.localHistory.create',
|
|
436
|
-
title: ( localize2(
|
|
435
|
+
title: ( localize2(6989, 'Create Entry')),
|
|
437
436
|
f1: true,
|
|
438
437
|
category: LOCAL_HISTORY_CATEGORY,
|
|
439
|
-
precondition: (
|
|
438
|
+
precondition: ( ContextKeyExpr.and(CTX_LOCAL_HISTORY_ENABLED, ActiveEditorContext))
|
|
440
439
|
});
|
|
441
440
|
}
|
|
442
441
|
async run(accessor) {
|
|
@@ -449,12 +448,12 @@ registerAction2(class extends Action2 {
|
|
|
449
448
|
if (resource?.scheme !== pathService.defaultUriScheme && resource?.scheme !== Schemas.vscodeUserData) {
|
|
450
449
|
return;
|
|
451
450
|
}
|
|
452
|
-
const disposables = (
|
|
451
|
+
const disposables = ( new DisposableStore());
|
|
453
452
|
const inputBox = disposables.add(quickInputService.createInputBox());
|
|
454
|
-
inputBox.title = ( localize(
|
|
453
|
+
inputBox.title = ( localize(6990, "Create Local History Entry"));
|
|
455
454
|
inputBox.ignoreFocusOut = true;
|
|
456
455
|
inputBox.placeholder = ( localize(
|
|
457
|
-
|
|
456
|
+
6991,
|
|
458
457
|
"Enter the new name of the local history entry for '{0}'",
|
|
459
458
|
labelService.getUriBasenameLabel(resource)
|
|
460
459
|
));
|
|
@@ -473,7 +472,7 @@ async function openEntry(entry, editorService, options) {
|
|
|
473
472
|
await editorService.openEditor({
|
|
474
473
|
resource,
|
|
475
474
|
label: ( localize(
|
|
476
|
-
|
|
475
|
+
6992,
|
|
477
476
|
"{0} ({1} • {2})",
|
|
478
477
|
entry.workingCopy.name,
|
|
479
478
|
SaveSourceRegistry.getSourceLabel(entry.source),
|
|
@@ -495,7 +494,7 @@ function toDiffEditorArguments(arg1, arg2, options) {
|
|
|
495
494
|
const resource = arg2;
|
|
496
495
|
modifiedResource = resource;
|
|
497
496
|
label = ( localize(
|
|
498
|
-
|
|
497
|
+
6993,
|
|
499
498
|
"{0} ({1} • {2}) ↔ {3}",
|
|
500
499
|
arg1.workingCopy.name,
|
|
501
500
|
SaveSourceRegistry.getSourceLabel(arg1.source),
|
|
@@ -507,7 +506,7 @@ function toDiffEditorArguments(arg1, arg2, options) {
|
|
|
507
506
|
const modified = arg2;
|
|
508
507
|
modifiedResource = LocalHistoryFileSystemProvider.toLocalHistoryFileSystem({ location: modified.location, associatedResource: modified.workingCopy.resource });
|
|
509
508
|
label = ( localize(
|
|
510
|
-
|
|
509
|
+
6994,
|
|
511
510
|
"{0} ({1} • {2}) ↔ {3} ({4} • {5})",
|
|
512
511
|
arg1.workingCopy.name,
|
|
513
512
|
SaveSourceRegistry.getSourceLabel(arg1.source),
|
package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { IFileDeleteOptions, IFileOverwriteOptions, FileType, IFileWriteOptions, IFileSystemProvider, IFileSystemProviderWithFileReadWriteCapability, IStat, IWatchOptions } from "vscode/vscode/vs/platform/files/common/files";
|
|
5
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
6
|
+
interface ILocalHistoryResource {
|
|
7
|
+
readonly location: URI;
|
|
8
|
+
readonly associatedResource: URI;
|
|
9
|
+
}
|
|
10
|
+
export declare class LocalHistoryFileSystemProvider implements IFileSystemProvider, IFileSystemProviderWithFileReadWriteCapability {
|
|
11
|
+
private readonly fileService;
|
|
12
|
+
static readonly SCHEMA = "vscode-local-history";
|
|
13
|
+
static toLocalHistoryFileSystem(resource: ILocalHistoryResource): URI;
|
|
14
|
+
static fromLocalHistoryFileSystem(resource: URI): ILocalHistoryResource;
|
|
15
|
+
private static readonly EMPTY_RESOURCE;
|
|
16
|
+
static readonly EMPTY: ILocalHistoryResource;
|
|
17
|
+
get capabilities(): number;
|
|
18
|
+
constructor(fileService: IFileService);
|
|
19
|
+
private readonly mapSchemeToProvider;
|
|
20
|
+
private withProvider;
|
|
21
|
+
stat(resource: URI): Promise<IStat>;
|
|
22
|
+
readFile(resource: URI): Promise<Uint8Array>;
|
|
23
|
+
readonly onDidChangeCapabilities: Event<any>;
|
|
24
|
+
readonly onDidChangeFile: Event<any>;
|
|
25
|
+
writeFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void>;
|
|
26
|
+
mkdir(resource: URI): Promise<void>;
|
|
27
|
+
readdir(resource: URI): Promise<[
|
|
28
|
+
string,
|
|
29
|
+
FileType
|
|
30
|
+
][]>;
|
|
31
|
+
rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;
|
|
32
|
+
delete(resource: URI, opts: IFileDeleteOptions): Promise<void>;
|
|
33
|
+
watch(resource: URI, opts: IWatchOptions): IDisposable;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
|
|
1
2
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
2
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
4
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
-
import { FileType, hasReadWriteCapability } from 'vscode/vscode/vs/platform/files/common/files';
|
|
5
|
+
import { FileSystemProviderCapabilities, FileType, hasReadWriteCapability } from 'vscode/vscode/vs/platform/files/common/files';
|
|
5
6
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
6
7
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
7
8
|
|
|
@@ -30,7 +31,7 @@ class LocalHistoryFileSystemProvider {
|
|
|
30
31
|
associatedResource: LocalHistoryFileSystemProvider.EMPTY_RESOURCE
|
|
31
32
|
}; }
|
|
32
33
|
get capabilities() {
|
|
33
|
-
return
|
|
34
|
+
return FileSystemProviderCapabilities.FileReadWrite | FileSystemProviderCapabilities.Readonly;
|
|
34
35
|
}
|
|
35
36
|
constructor(fileService) {
|
|
36
37
|
this.fileService = fileService;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IWorkbenchContribution } from "vscode/vscode/vs/workbench/common/contributions";
|
|
4
|
+
import { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProvider } from "vscode/vscode/vs/workbench/contrib/timeline/common/timeline";
|
|
5
|
+
import { ITimelineService } from "vscode/vscode/vs/workbench/contrib/timeline/common/timeline.service";
|
|
6
|
+
import { IWorkingCopyHistoryService } from "vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory.service";
|
|
7
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
8
|
+
import { IPathService } from "vscode/vscode/vs/workbench/services/path/common/pathService.service";
|
|
9
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
10
|
+
import { IWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
11
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
12
|
+
import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
|
|
13
|
+
export declare class LocalHistoryTimeline extends Disposable implements IWorkbenchContribution, TimelineProvider {
|
|
14
|
+
private readonly timelineService;
|
|
15
|
+
private readonly workingCopyHistoryService;
|
|
16
|
+
private readonly pathService;
|
|
17
|
+
private readonly fileService;
|
|
18
|
+
private readonly environmentService;
|
|
19
|
+
private readonly configurationService;
|
|
20
|
+
private readonly contextService;
|
|
21
|
+
static readonly ID = "workbench.contrib.localHistoryTimeline";
|
|
22
|
+
private static readonly LOCAL_HISTORY_ENABLED_SETTINGS_KEY;
|
|
23
|
+
readonly id = "timeline.localHistory";
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly scheme = "*";
|
|
26
|
+
private readonly _onDidChange;
|
|
27
|
+
readonly onDidChange: import("vscode/vscode/vs/base/common/event").Event<TimelineChangeEvent>;
|
|
28
|
+
private readonly timelineProviderDisposable;
|
|
29
|
+
constructor(timelineService: ITimelineService, workingCopyHistoryService: IWorkingCopyHistoryService, pathService: IPathService, fileService: IFileService, environmentService: IWorkbenchEnvironmentService, configurationService: IConfigurationService, contextService: IWorkspaceContextService);
|
|
30
|
+
private registerComponents;
|
|
31
|
+
private updateTimelineRegistration;
|
|
32
|
+
private registerListeners;
|
|
33
|
+
private onDidChangeWorkingCopyHistoryEntry;
|
|
34
|
+
provideTimeline(uri: URI, options: TimelineOptions, token: CancellationToken): Promise<Timeline>;
|
|
35
|
+
private toTimelineItem;
|
|
36
|
+
}
|