@codingame/monaco-vscode-timeline-service-override 4.1.0 → 4.1.2
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +2 -2
- package/timeline.js +3 -3
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistory.js +37 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryCommands.js +637 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryFileSystemProvider.js +89 -0
- package/vscode/src/vs/workbench/contrib/localHistory/browser/localHistoryTimeline.js +138 -0
- package/vscode/src/vs/workbench/contrib/timeline/browser/media/timelinePane.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/timeline/browser/timeline.contribution.js +120 -0
- package/vscode/src/vs/workbench/contrib/timeline/browser/timelinePane.js +1163 -0
- package/vscode/src/vs/workbench/contrib/timeline/common/timelineService.js +108 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
4
|
+
import { TimelinePaneId } from 'vscode/vscode/vs/workbench/contrib/timeline/common/timeline';
|
|
5
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
6
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
|
+
import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
+
|
|
9
|
+
const TimelineHasProviderContext = ( new RawContextKey('timelineHasProvider', false));
|
|
10
|
+
let TimelineService = class TimelineService {
|
|
11
|
+
constructor(logService, viewsService, configurationService, contextKeyService) {
|
|
12
|
+
this.logService = logService;
|
|
13
|
+
this.viewsService = viewsService;
|
|
14
|
+
this.configurationService = configurationService;
|
|
15
|
+
this.contextKeyService = contextKeyService;
|
|
16
|
+
this._onDidChangeProviders = ( new Emitter());
|
|
17
|
+
this.onDidChangeProviders = this._onDidChangeProviders.event;
|
|
18
|
+
this._onDidChangeTimeline = ( new Emitter());
|
|
19
|
+
this.onDidChangeTimeline = this._onDidChangeTimeline.event;
|
|
20
|
+
this._onDidChangeUri = ( new Emitter());
|
|
21
|
+
this.onDidChangeUri = this._onDidChangeUri.event;
|
|
22
|
+
this.providers = ( new Map());
|
|
23
|
+
this.providerSubscriptions = ( new Map());
|
|
24
|
+
this.hasProviderContext = TimelineHasProviderContext.bindTo(this.contextKeyService);
|
|
25
|
+
this.updateHasProviderContext();
|
|
26
|
+
}
|
|
27
|
+
getSources() {
|
|
28
|
+
return ( [...( this.providers.values())].map(p => ({ id: p.id, label: p.label })));
|
|
29
|
+
}
|
|
30
|
+
getTimeline(id, uri, options, tokenSource) {
|
|
31
|
+
this.logService.trace(`TimelineService#getTimeline(${id}): uri=${( uri.toString())}`);
|
|
32
|
+
const provider = this.providers.get(id);
|
|
33
|
+
if (provider === undefined) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (typeof provider.scheme === 'string') {
|
|
37
|
+
if (provider.scheme !== '*' && provider.scheme !== uri.scheme) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (!provider.scheme.includes(uri.scheme)) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
result: provider.provideTimeline(uri, options, tokenSource.token)
|
|
46
|
+
.then(result => {
|
|
47
|
+
if (result === undefined) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
result.items = ( result.items.map(item => ({ ...item, source: provider.id })));
|
|
51
|
+
result.items.sort((a, b) => (b.timestamp - a.timestamp) || b.source.localeCompare(a.source, undefined, { numeric: true, sensitivity: 'base' }));
|
|
52
|
+
return result;
|
|
53
|
+
}),
|
|
54
|
+
options: options,
|
|
55
|
+
source: provider.id,
|
|
56
|
+
tokenSource: tokenSource,
|
|
57
|
+
uri: uri
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
registerTimelineProvider(provider) {
|
|
61
|
+
this.logService.trace(`TimelineService#registerTimelineProvider: id=${provider.id}`);
|
|
62
|
+
const id = provider.id;
|
|
63
|
+
const existing = this.providers.get(id);
|
|
64
|
+
if (existing) {
|
|
65
|
+
try {
|
|
66
|
+
existing?.dispose();
|
|
67
|
+
}
|
|
68
|
+
catch { }
|
|
69
|
+
}
|
|
70
|
+
this.providers.set(id, provider);
|
|
71
|
+
this.updateHasProviderContext();
|
|
72
|
+
if (provider.onDidChange) {
|
|
73
|
+
this.providerSubscriptions.set(id, provider.onDidChange(e => this._onDidChangeTimeline.fire(e)));
|
|
74
|
+
}
|
|
75
|
+
this._onDidChangeProviders.fire({ added: [id] });
|
|
76
|
+
return {
|
|
77
|
+
dispose: () => {
|
|
78
|
+
this.providers.delete(id);
|
|
79
|
+
this._onDidChangeProviders.fire({ removed: [id] });
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
unregisterTimelineProvider(id) {
|
|
84
|
+
this.logService.trace(`TimelineService#unregisterTimelineProvider: id=${id}`);
|
|
85
|
+
if (!( this.providers.has(id))) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.providers.delete(id);
|
|
89
|
+
this.providerSubscriptions.delete(id);
|
|
90
|
+
this.updateHasProviderContext();
|
|
91
|
+
this._onDidChangeProviders.fire({ removed: [id] });
|
|
92
|
+
}
|
|
93
|
+
setUri(uri) {
|
|
94
|
+
this.viewsService.openView(TimelinePaneId, true);
|
|
95
|
+
this._onDidChangeUri.fire(uri);
|
|
96
|
+
}
|
|
97
|
+
updateHasProviderContext() {
|
|
98
|
+
this.hasProviderContext.set(this.providers.size !== 0);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
TimelineService = ( __decorate([
|
|
102
|
+
( __param(0, ILogService)),
|
|
103
|
+
( __param(1, IViewsService)),
|
|
104
|
+
( __param(2, IConfigurationService)),
|
|
105
|
+
( __param(3, IContextKeyService))
|
|
106
|
+
], TimelineService));
|
|
107
|
+
|
|
108
|
+
export { TimelineHasProviderContext, TimelineService };
|