@codingame/monaco-vscode-timeline-service-override 3.2.3 → 4.1.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.
@@ -1,89 +0,0 @@
1
- import { Event } from 'vscode/vscode/vs/base/common/event';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { URI } from 'vscode/vscode/vs/base/common/uri';
4
- import { FileType, hasReadWriteCapability } from 'vscode/vscode/vs/platform/files/common/files';
5
- import { isEqual } from 'vscode/vscode/vs/base/common/resources';
6
- import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
7
-
8
- class LocalHistoryFileSystemProvider {
9
- static { this.SCHEMA = 'vscode-local-history'; }
10
- static toLocalHistoryFileSystem(resource) {
11
- const serializedLocalHistoryResource = {
12
- location: ( resource.location.toString(true)),
13
- associatedResource: ( resource.associatedResource.toString(true))
14
- };
15
- return resource.associatedResource.with({
16
- scheme: LocalHistoryFileSystemProvider.SCHEMA,
17
- query: JSON.stringify(serializedLocalHistoryResource)
18
- });
19
- }
20
- static fromLocalHistoryFileSystem(resource) {
21
- const serializedLocalHistoryResource = JSON.parse(resource.query);
22
- return {
23
- location: ( URI.parse(serializedLocalHistoryResource.location)),
24
- associatedResource: ( URI.parse(serializedLocalHistoryResource.associatedResource))
25
- };
26
- }
27
- static { this.EMPTY_RESOURCE = ( URI.from({ scheme: LocalHistoryFileSystemProvider.SCHEMA, path: '/empty' })); }
28
- static { this.EMPTY = {
29
- location: LocalHistoryFileSystemProvider.EMPTY_RESOURCE,
30
- associatedResource: LocalHistoryFileSystemProvider.EMPTY_RESOURCE
31
- }; }
32
- get capabilities() {
33
- return 2 | 2048 ;
34
- }
35
- constructor(fileService) {
36
- this.fileService = fileService;
37
- this.mapSchemeToProvider = ( new Map());
38
- this.onDidChangeCapabilities = Event.None;
39
- this.onDidChangeFile = Event.None;
40
- }
41
- async withProvider(resource) {
42
- const scheme = resource.scheme;
43
- let providerPromise = this.mapSchemeToProvider.get(scheme);
44
- if (!providerPromise) {
45
- const provider = this.fileService.getProvider(scheme);
46
- if (provider) {
47
- providerPromise = Promise.resolve(provider);
48
- }
49
- else {
50
- providerPromise = ( new Promise(resolve => {
51
- const disposable = this.fileService.onDidChangeFileSystemProviderRegistrations(e => {
52
- if (e.added && e.provider && e.scheme === scheme) {
53
- disposable.dispose();
54
- resolve(e.provider);
55
- }
56
- });
57
- }));
58
- }
59
- this.mapSchemeToProvider.set(scheme, providerPromise);
60
- }
61
- return providerPromise;
62
- }
63
- async stat(resource) {
64
- const location = LocalHistoryFileSystemProvider.fromLocalHistoryFileSystem(resource).location;
65
- if (isEqual(LocalHistoryFileSystemProvider.EMPTY_RESOURCE, location)) {
66
- return { type: FileType.File, ctime: 0, mtime: 0, size: 0 };
67
- }
68
- return (await this.withProvider(location)).stat(location);
69
- }
70
- async readFile(resource) {
71
- const location = LocalHistoryFileSystemProvider.fromLocalHistoryFileSystem(resource).location;
72
- if (isEqual(LocalHistoryFileSystemProvider.EMPTY_RESOURCE, location)) {
73
- return VSBuffer.fromString('').buffer;
74
- }
75
- const provider = await this.withProvider(location);
76
- if (hasReadWriteCapability(provider)) {
77
- return provider.readFile(location);
78
- }
79
- throw new Error('Unsupported');
80
- }
81
- async writeFile(resource, content, opts) { }
82
- async mkdir(resource) { }
83
- async readdir(resource) { return []; }
84
- async rename(from, to, opts) { }
85
- async delete(resource, opts) { }
86
- watch(resource, opts) { return Disposable.None; }
87
- }
88
-
89
- export { LocalHistoryFileSystemProvider };
@@ -1,138 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
4
- import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { ITimelineService } from 'vscode/vscode/vs/workbench/contrib/timeline/common/timeline';
6
- import { IWorkingCopyHistoryService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyHistory';
7
- import { URI } from 'vscode/vscode/vs/base/common/uri';
8
- import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
9
- import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
10
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
11
- import { LocalHistoryFileSystemProvider } from './localHistoryFileSystemProvider.js';
12
- import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
13
- import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
14
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
15
- import { COMPARE_WITH_FILE_LABEL, toDiffEditorArguments } from './localHistoryCommands.js';
16
- import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
17
- import { getLocalHistoryDateFormatter, LOCAL_HISTORY_ICON_ENTRY, LOCAL_HISTORY_MENU_CONTEXT_VALUE } from './localHistory.js';
18
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
19
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
20
- import { getVirtualWorkspaceAuthority } from 'vscode/vscode/vs/platform/workspace/common/virtualWorkspace';
21
-
22
- var LocalHistoryTimeline_1;
23
- let LocalHistoryTimeline = class LocalHistoryTimeline extends Disposable {
24
- static { LocalHistoryTimeline_1 = this; }
25
- static { this.ID = 'workbench.contrib.localHistoryTimeline'; }
26
- static { this.LOCAL_HISTORY_ENABLED_SETTINGS_KEY = 'workbench.localHistory.enabled'; }
27
- constructor(timelineService, workingCopyHistoryService, pathService, fileService, environmentService, configurationService, contextService) {
28
- super();
29
- this.timelineService = timelineService;
30
- this.workingCopyHistoryService = workingCopyHistoryService;
31
- this.pathService = pathService;
32
- this.fileService = fileService;
33
- this.environmentService = environmentService;
34
- this.configurationService = configurationService;
35
- this.contextService = contextService;
36
- this.id = 'timeline.localHistory';
37
- this.label = ( localizeWithPath(
38
- 'vs/workbench/contrib/localHistory/browser/localHistoryTimeline',
39
- 'localHistory',
40
- "Local History"
41
- ));
42
- this.scheme = '*';
43
- this._onDidChange = this._register(( new Emitter()));
44
- this.onDidChange = this._onDidChange.event;
45
- this.timelineProviderDisposable = this._register(( new MutableDisposable()));
46
- this.registerComponents();
47
- this.registerListeners();
48
- }
49
- registerComponents() {
50
- this.updateTimelineRegistration();
51
- this._register(this.fileService.registerProvider(LocalHistoryFileSystemProvider.SCHEMA, ( new LocalHistoryFileSystemProvider(this.fileService))));
52
- }
53
- updateTimelineRegistration() {
54
- if (this.configurationService.getValue(LocalHistoryTimeline_1.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)) {
55
- this.timelineProviderDisposable.value = this.timelineService.registerTimelineProvider(this);
56
- }
57
- else {
58
- this.timelineProviderDisposable.clear();
59
- }
60
- }
61
- registerListeners() {
62
- this._register(this.workingCopyHistoryService.onDidAddEntry(e => this.onDidChangeWorkingCopyHistoryEntry(e.entry)));
63
- this._register(this.workingCopyHistoryService.onDidChangeEntry(e => this.onDidChangeWorkingCopyHistoryEntry(e.entry)));
64
- this._register(this.workingCopyHistoryService.onDidReplaceEntry(e => this.onDidChangeWorkingCopyHistoryEntry(e.entry)));
65
- this._register(this.workingCopyHistoryService.onDidRemoveEntry(e => this.onDidChangeWorkingCopyHistoryEntry(e.entry)));
66
- this._register(this.workingCopyHistoryService.onDidRemoveEntries(() => this.onDidChangeWorkingCopyHistoryEntry(undefined )));
67
- this._register(this.workingCopyHistoryService.onDidMoveEntries(() => this.onDidChangeWorkingCopyHistoryEntry(undefined )));
68
- this._register(this.configurationService.onDidChangeConfiguration(e => {
69
- if (e.affectsConfiguration(LocalHistoryTimeline_1.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)) {
70
- this.updateTimelineRegistration();
71
- }
72
- }));
73
- }
74
- onDidChangeWorkingCopyHistoryEntry(entry) {
75
- this._onDidChange.fire({
76
- id: this.id,
77
- uri: entry?.workingCopy.resource,
78
- reset: true
79
- });
80
- }
81
- async provideTimeline(uri, options, token) {
82
- const items = [];
83
- let resource = undefined;
84
- if (uri.scheme === LocalHistoryFileSystemProvider.SCHEMA) {
85
- resource = LocalHistoryFileSystemProvider.fromLocalHistoryFileSystem(uri).associatedResource;
86
- }
87
- else if (uri.scheme === this.pathService.defaultUriScheme || uri.scheme === Schemas.vscodeUserData) {
88
- resource = uri;
89
- }
90
- else if (this.fileService.hasProvider(uri)) {
91
- resource = ( URI.from({
92
- scheme: this.pathService.defaultUriScheme,
93
- authority: this.environmentService.remoteAuthority ?? getVirtualWorkspaceAuthority(this.contextService.getWorkspace()),
94
- path: uri.path
95
- }));
96
- }
97
- if (resource) {
98
- const entries = await this.workingCopyHistoryService.getEntries(resource, token);
99
- for (const entry of entries) {
100
- items.push(this.toTimelineItem(entry));
101
- }
102
- }
103
- return {
104
- source: this.id,
105
- items
106
- };
107
- }
108
- toTimelineItem(entry) {
109
- return {
110
- handle: entry.id,
111
- label: SaveSourceRegistry.getSourceLabel(entry.source),
112
- tooltip: ( new MarkdownString(
113
- `$(history) ${getLocalHistoryDateFormatter().format(entry.timestamp)}\n\n${SaveSourceRegistry.getSourceLabel(entry.source)}`,
114
- { supportThemeIcons: true }
115
- )),
116
- source: this.id,
117
- timestamp: entry.timestamp,
118
- themeIcon: LOCAL_HISTORY_ICON_ENTRY,
119
- contextValue: LOCAL_HISTORY_MENU_CONTEXT_VALUE,
120
- command: {
121
- id: API_OPEN_DIFF_EDITOR_COMMAND_ID,
122
- title: COMPARE_WITH_FILE_LABEL.value,
123
- arguments: toDiffEditorArguments(entry, entry.workingCopy.resource)
124
- }
125
- };
126
- }
127
- };
128
- LocalHistoryTimeline = LocalHistoryTimeline_1 = ( __decorate([
129
- ( __param(0, ITimelineService)),
130
- ( __param(1, IWorkingCopyHistoryService)),
131
- ( __param(2, IPathService)),
132
- ( __param(3, IFileService)),
133
- ( __param(4, IWorkbenchEnvironmentService)),
134
- ( __param(5, IConfigurationService)),
135
- ( __param(6, IWorkspaceContextService))
136
- ], LocalHistoryTimeline));
137
-
138
- export { LocalHistoryTimeline };
@@ -1,6 +0,0 @@
1
- import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
-
3
- var css = ".monaco-workbench .timeline-tree-view{position:relative}.monaco-workbench .timeline-tree-view .message.timeline-subtle{opacity:.5;padding:10px 22px 0;pointer-events:none;position:absolute;z-index:1}.timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .monaco-icon-label{flex:1;overflow:hidden;text-overflow:ellipsis}.timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container{margin-left:2px;margin-right:4px;opacity:.5;overflow:hidden;text-overflow:ellipsis}.timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate:before{border-right:1px solid;content:\" \";display:block;height:100%;opacity:.25;position:absolute;right:10px;width:1px}.timeline-tree-view .monaco-list .monaco-list-row.focused .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate:before,.timeline-tree-view .monaco-list .monaco-list-row.selected .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate:before,.timeline-tree-view .monaco-list .monaco-list-row:hover .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate:before{display:none}.timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container .timeline-timestamp{display:inline-block}.timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp{visibility:hidden;width:10px}.timeline-tree-view .monaco-list .monaco-list-row.focused .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp,.timeline-tree-view .monaco-list .monaco-list-row.selected .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp,.timeline-tree-view .monaco-list .monaco-list-row:hover .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp{visibility:visible!important;width:auto}";
4
- n(css,{});
5
-
6
- export { css, css as default };
@@ -1,120 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
3
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
4
- import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/views';
5
- import { VIEW_CONTAINER } from 'vscode/vscode/vs/workbench/contrib/files/browser/explorerViewlet';
6
- import { TimelinePaneId, ITimelineService } from 'vscode/vscode/vs/workbench/contrib/timeline/common/timeline';
7
- import { TimelineHasProviderContext } from '../common/timelineService.js';
8
- import { TimelinePane } from './timelinePane.js';
9
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
10
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
11
- import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
12
- import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
13
- import { ExplorerFolderContext } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
14
- import { ResourceContextKey } from 'vscode/vscode/vs/workbench/common/contextkeys';
15
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
16
- import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
17
-
18
- const timelineViewIcon = registerIcon('timeline-view-icon', Codicon.history, ( localizeWithPath(
19
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
20
- 'timelineViewIcon',
21
- 'View icon of the timeline view.'
22
- )));
23
- const timelineOpenIcon = registerIcon('timeline-open', Codicon.history, ( localizeWithPath(
24
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
25
- 'timelineOpenIcon',
26
- 'Icon for the open timeline action.'
27
- )));
28
- class TimelinePaneDescriptor {
29
- constructor() {
30
- this.id = TimelinePaneId;
31
- this.name = TimelinePane.TITLE;
32
- this.containerIcon = timelineViewIcon;
33
- this.ctorDescriptor = ( new SyncDescriptor(TimelinePane));
34
- this.order = 2;
35
- this.weight = 30;
36
- this.collapsed = true;
37
- this.canToggleVisibility = true;
38
- this.hideByDefault = false;
39
- this.canMoveView = true;
40
- this.when = TimelineHasProviderContext;
41
- this.focusCommand = { id: 'timeline.focus' };
42
- }
43
- }
44
- const configurationRegistry = ( Registry.as(Extensions.Configuration));
45
- configurationRegistry.registerConfiguration({
46
- id: 'timeline',
47
- order: 1001,
48
- title: ( localizeWithPath(
49
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
50
- 'timelineConfigurationTitle',
51
- "Timeline"
52
- )),
53
- type: 'object',
54
- properties: {
55
- 'timeline.pageSize': {
56
- type: ['number', 'null'],
57
- default: null,
58
- markdownDescription: ( localizeWithPath(
59
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
60
- 'timeline.pageSize',
61
- "The number of items to show in the Timeline view by default and when loading more items. Setting to `null` (the default) will automatically choose a page size based on the visible area of the Timeline view."
62
- )),
63
- },
64
- 'timeline.pageOnScroll': {
65
- type: 'boolean',
66
- default: false,
67
- description: ( localizeWithPath(
68
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
69
- 'timeline.pageOnScroll',
70
- "Experimental. Controls whether the Timeline view will load the next page of items when you scroll to the end of the list."
71
- )),
72
- },
73
- }
74
- });
75
- ( Registry.as(Extensions$1.ViewsRegistry)).registerViews([( new TimelinePaneDescriptor())], VIEW_CONTAINER);
76
- var OpenTimelineAction;
77
- ( (function(OpenTimelineAction) {
78
- OpenTimelineAction.ID = 'files.openTimeline';
79
- OpenTimelineAction.LABEL = ( localizeWithPath(
80
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
81
- 'files.openTimeline',
82
- "Open Timeline"
83
- ));
84
- function handler() {
85
- return (accessor, arg) => {
86
- const service = accessor.get(ITimelineService);
87
- return service.setUri(arg);
88
- };
89
- }
90
- OpenTimelineAction.handler = handler;
91
- })(OpenTimelineAction || (OpenTimelineAction = {})));
92
- CommandsRegistry.registerCommand(OpenTimelineAction.ID, OpenTimelineAction.handler());
93
- MenuRegistry.appendMenuItem(MenuId.ExplorerContext, ({
94
- group: '4_timeline',
95
- order: 1,
96
- command: {
97
- id: OpenTimelineAction.ID,
98
- title: OpenTimelineAction.LABEL,
99
- icon: timelineOpenIcon
100
- },
101
- when: ( ContextKeyExpr.and(( ExplorerFolderContext.toNegated()), ResourceContextKey.HasResource, TimelineHasProviderContext))
102
- }));
103
- const timelineFilter = registerIcon('timeline-filter', Codicon.filter, ( localizeWithPath(
104
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
105
- 'timelineFilter',
106
- 'Icon for the filter timeline action.'
107
- )));
108
- MenuRegistry.appendMenuItem(MenuId.TimelineTitle, {
109
- submenu: MenuId.TimelineFilterSubMenu,
110
- title: ( localizeWithPath(
111
- 'vs/workbench/contrib/timeline/browser/timeline.contribution',
112
- 'filterTimeline',
113
- "Filter Timeline"
114
- )),
115
- group: 'navigation',
116
- order: 100,
117
- icon: timelineFilter
118
- });
119
-
120
- export { TimelinePaneDescriptor };