@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.1
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/assets/fake.html +10 -0
- package/assets/index-no-csp.html +1230 -0
- package/assets/index.html +1231 -0
- package/assets/service-worker.js +457 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
- package/package.json +32 -0
- package/tools/editorAssets.js +4 -0
- package/tools/url.js +10 -0
- package/viewCommon.d.ts +5 -0
- package/viewCommon.js +105 -0
- package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
- package/vscode/src/vs/workbench/browser/style.js +54 -0
- package/vscode/src/vs/workbench/browser/window.js +381 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
|
@@ -0,0 +1,1516 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
+
import { isEditorPaneWithSelection, isEditorInput, EditorResourceAccessor, EditorCloseContext, SideBySideEditor, isSideBySideEditorInput, isResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
|
|
5
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
6
|
+
import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history.service';
|
|
7
|
+
import { FILES_EXCLUDE_CONFIG, FileChangesEvent, FileOperationEvent } from 'vscode/vscode/vs/platform/files/common/files';
|
|
8
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
9
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
10
|
+
import { Disposable, DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
12
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
13
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
15
|
+
import { getExcludes, SEARCH_EXCLUDE_CONFIG } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
16
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
17
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
18
|
+
import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
19
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
20
|
+
import { coalesce, remove } from 'vscode/vscode/vs/base/common/arrays';
|
|
21
|
+
import { registerSingleton } from 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
22
|
+
import { WindowIdleValue, addDisposableListener, EventType, EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
23
|
+
import { IWorkspacesService } from 'vscode/vscode/vs/platform/workspaces/common/workspaces.service';
|
|
24
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
25
|
+
import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
26
|
+
import { ResourceGlobMatcher } from 'vscode/vscode/vs/workbench/common/resources';
|
|
27
|
+
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService.service';
|
|
28
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
29
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
30
|
+
import { LogLevel } from 'vscode/vscode/vs/platform/log/common/log';
|
|
31
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
32
|
+
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
33
|
+
|
|
34
|
+
var HistoryService_1, EditorNavigationStack_1;
|
|
35
|
+
let HistoryService = class HistoryService extends Disposable {
|
|
36
|
+
static { HistoryService_1 = this; }
|
|
37
|
+
static { this.MOUSE_NAVIGATION_SETTING = 'workbench.editor.mouseBackForwardToNavigate'; }
|
|
38
|
+
static { this.NAVIGATION_SCOPE_SETTING = 'workbench.editor.navigationScope'; }
|
|
39
|
+
constructor(editorService, editorGroupService, contextService, storageService, configurationService, fileService, workspacesService, instantiationService, layoutService, contextKeyService, logService) {
|
|
40
|
+
super();
|
|
41
|
+
this.editorService = editorService;
|
|
42
|
+
this.editorGroupService = editorGroupService;
|
|
43
|
+
this.contextService = contextService;
|
|
44
|
+
this.storageService = storageService;
|
|
45
|
+
this.configurationService = configurationService;
|
|
46
|
+
this.fileService = fileService;
|
|
47
|
+
this.workspacesService = workspacesService;
|
|
48
|
+
this.instantiationService = instantiationService;
|
|
49
|
+
this.layoutService = layoutService;
|
|
50
|
+
this.contextKeyService = contextKeyService;
|
|
51
|
+
this.logService = logService;
|
|
52
|
+
this.activeEditorListeners = this._register(( new DisposableStore()));
|
|
53
|
+
this.lastActiveEditor = undefined;
|
|
54
|
+
this.editorHelper = this.instantiationService.createInstance(EditorHelper);
|
|
55
|
+
this.canNavigateBackContextKey = (( new RawContextKey('canNavigateBack', false, ( localizeWithPath(
|
|
56
|
+
'vs/workbench/services/history/browser/historyService',
|
|
57
|
+
'canNavigateBack',
|
|
58
|
+
"Whether it is possible to navigate back in editor history"
|
|
59
|
+
))))).bindTo(this.contextKeyService);
|
|
60
|
+
this.canNavigateForwardContextKey = (( new RawContextKey('canNavigateForward', false, ( localizeWithPath(
|
|
61
|
+
'vs/workbench/services/history/browser/historyService',
|
|
62
|
+
'canNavigateForward',
|
|
63
|
+
"Whether it is possible to navigate forward in editor history"
|
|
64
|
+
))))).bindTo(this.contextKeyService);
|
|
65
|
+
this.canNavigateBackInNavigationsContextKey = (( new RawContextKey('canNavigateBackInNavigationLocations', false, ( localizeWithPath(
|
|
66
|
+
'vs/workbench/services/history/browser/historyService',
|
|
67
|
+
'canNavigateBackInNavigationLocations',
|
|
68
|
+
"Whether it is possible to navigate back in editor navigation locations history"
|
|
69
|
+
))))).bindTo(this.contextKeyService);
|
|
70
|
+
this.canNavigateForwardInNavigationsContextKey = (( new RawContextKey('canNavigateForwardInNavigationLocations', false, ( localizeWithPath(
|
|
71
|
+
'vs/workbench/services/history/browser/historyService',
|
|
72
|
+
'canNavigateForwardInNavigationLocations',
|
|
73
|
+
"Whether it is possible to navigate forward in editor navigation locations history"
|
|
74
|
+
))))).bindTo(this.contextKeyService);
|
|
75
|
+
this.canNavigateToLastNavigationLocationContextKey = (( new RawContextKey('canNavigateToLastNavigationLocation', false, ( localizeWithPath(
|
|
76
|
+
'vs/workbench/services/history/browser/historyService',
|
|
77
|
+
'canNavigateToLastNavigationLocation',
|
|
78
|
+
"Whether it is possible to navigate to the last editor navigation location"
|
|
79
|
+
))))).bindTo(this.contextKeyService);
|
|
80
|
+
this.canNavigateBackInEditsContextKey = (( new RawContextKey('canNavigateBackInEditLocations', false, ( localizeWithPath(
|
|
81
|
+
'vs/workbench/services/history/browser/historyService',
|
|
82
|
+
'canNavigateBackInEditLocations',
|
|
83
|
+
"Whether it is possible to navigate back in editor edit locations history"
|
|
84
|
+
))))).bindTo(this.contextKeyService);
|
|
85
|
+
this.canNavigateForwardInEditsContextKey = (( new RawContextKey('canNavigateForwardInEditLocations', false, ( localizeWithPath(
|
|
86
|
+
'vs/workbench/services/history/browser/historyService',
|
|
87
|
+
'canNavigateForwardInEditLocations',
|
|
88
|
+
"Whether it is possible to navigate forward in editor edit locations history"
|
|
89
|
+
))))).bindTo(this.contextKeyService);
|
|
90
|
+
this.canNavigateToLastEditLocationContextKey = (( new RawContextKey('canNavigateToLastEditLocation', false, ( localizeWithPath(
|
|
91
|
+
'vs/workbench/services/history/browser/historyService',
|
|
92
|
+
'canNavigateToLastEditLocation',
|
|
93
|
+
"Whether it is possible to navigate to the last editor edit location"
|
|
94
|
+
))))).bindTo(this.contextKeyService);
|
|
95
|
+
this.canReopenClosedEditorContextKey = (( new RawContextKey('canReopenClosedEditor', false, ( localizeWithPath(
|
|
96
|
+
'vs/workbench/services/history/browser/historyService',
|
|
97
|
+
'canReopenClosedEditor',
|
|
98
|
+
"Whether it is possible to reopen the last closed editor"
|
|
99
|
+
))))).bindTo(this.contextKeyService);
|
|
100
|
+
this._onDidChangeEditorNavigationStack = this._register(( new Emitter()));
|
|
101
|
+
this.onDidChangeEditorNavigationStack = this._onDidChangeEditorNavigationStack.event;
|
|
102
|
+
this.defaultScopedEditorNavigationStack = undefined;
|
|
103
|
+
this.editorGroupScopedNavigationStacks = ( new Map());
|
|
104
|
+
this.editorScopedNavigationStacks = ( new Map());
|
|
105
|
+
this.editorNavigationScope = 0 ;
|
|
106
|
+
this.recentlyUsedEditorsStack = undefined;
|
|
107
|
+
this.recentlyUsedEditorsStackIndex = 0;
|
|
108
|
+
this.recentlyUsedEditorsInGroupStack = undefined;
|
|
109
|
+
this.recentlyUsedEditorsInGroupStackIndex = 0;
|
|
110
|
+
this.navigatingInRecentlyUsedEditorsStack = false;
|
|
111
|
+
this.navigatingInRecentlyUsedEditorsInGroupStack = false;
|
|
112
|
+
this.recentlyClosedEditors = [];
|
|
113
|
+
this.ignoreEditorCloseEvent = false;
|
|
114
|
+
this.history = undefined;
|
|
115
|
+
this.editorHistoryListeners = ( new Map());
|
|
116
|
+
this.resourceExcludeMatcher = this._register(( new WindowIdleValue(mainWindow, () => {
|
|
117
|
+
const matcher = this._register(this.instantiationService.createInstance(ResourceGlobMatcher, root => getExcludes(root ? this.configurationService.getValue({ resource: root }) : this.configurationService.getValue()) || Object.create(null), event => event.affectsConfiguration(FILES_EXCLUDE_CONFIG) || event.affectsConfiguration(SEARCH_EXCLUDE_CONFIG)));
|
|
118
|
+
this._register(matcher.onExpressionChange(() => this.removeExcludedFromHistory()));
|
|
119
|
+
return matcher;
|
|
120
|
+
})));
|
|
121
|
+
this.registerListeners();
|
|
122
|
+
if (this.editorService.activeEditorPane) {
|
|
123
|
+
this.onDidActiveEditorChange();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
registerListeners() {
|
|
127
|
+
this.registerMouseNavigationListener();
|
|
128
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.onDidActiveEditorChange()));
|
|
129
|
+
this._register(this.editorService.onDidOpenEditorFail(event => this.remove(event.editor)));
|
|
130
|
+
this._register(this.editorService.onDidCloseEditor(event => this.onDidCloseEditor(event)));
|
|
131
|
+
this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(() => this.handleEditorEventInRecentEditorsStack()));
|
|
132
|
+
this._register(this.editorGroupService.onDidRemoveGroup(e => this.onDidRemoveGroup(e)));
|
|
133
|
+
this._register(this.fileService.onDidFilesChange(event => this.onDidFilesChange(event)));
|
|
134
|
+
this._register(this.fileService.onDidRunOperation(event => this.onDidFilesChange(event)));
|
|
135
|
+
this._register(this.storageService.onWillSaveState(() => this.saveState()));
|
|
136
|
+
this.registerEditorNavigationScopeChangeListener();
|
|
137
|
+
this._register(this.onDidChangeEditorNavigationStack(() => this.updateContextKeys()));
|
|
138
|
+
this._register(this.editorGroupService.onDidChangeActiveGroup(() => this.updateContextKeys()));
|
|
139
|
+
}
|
|
140
|
+
onDidCloseEditor(e) {
|
|
141
|
+
this.handleEditorCloseEventInHistory(e);
|
|
142
|
+
this.handleEditorCloseEventInReopen(e);
|
|
143
|
+
}
|
|
144
|
+
registerMouseNavigationListener() {
|
|
145
|
+
const mouseBackForwardSupportListener = this._register(( new DisposableStore()));
|
|
146
|
+
const handleMouseBackForwardSupport = () => {
|
|
147
|
+
mouseBackForwardSupportListener.clear();
|
|
148
|
+
if (this.configurationService.getValue(HistoryService_1.MOUSE_NAVIGATION_SETTING)) {
|
|
149
|
+
this._register(Event.runAndSubscribe(this.layoutService.onDidAddContainer, ({ container, disposables }) => {
|
|
150
|
+
const eventDisposables = disposables.add(( new DisposableStore()));
|
|
151
|
+
eventDisposables.add(addDisposableListener(container, EventType.MOUSE_DOWN, e => this.onMouseDownOrUp(e, true)));
|
|
152
|
+
eventDisposables.add(addDisposableListener(container, EventType.MOUSE_UP, e => this.onMouseDownOrUp(e, false)));
|
|
153
|
+
mouseBackForwardSupportListener.add(eventDisposables);
|
|
154
|
+
}, { container: this.layoutService.mainContainer, disposables: this._store }));
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
this._register(this.configurationService.onDidChangeConfiguration(event => {
|
|
158
|
+
if (event.affectsConfiguration(HistoryService_1.MOUSE_NAVIGATION_SETTING)) {
|
|
159
|
+
handleMouseBackForwardSupport();
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
handleMouseBackForwardSupport();
|
|
163
|
+
}
|
|
164
|
+
onMouseDownOrUp(event, isMouseDown) {
|
|
165
|
+
switch (event.button) {
|
|
166
|
+
case 3:
|
|
167
|
+
EventHelper.stop(event);
|
|
168
|
+
if (isMouseDown) {
|
|
169
|
+
this.goBack();
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case 4:
|
|
173
|
+
EventHelper.stop(event);
|
|
174
|
+
if (isMouseDown) {
|
|
175
|
+
this.goForward();
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
onDidRemoveGroup(group) {
|
|
181
|
+
this.handleEditorGroupRemoveInNavigationStacks(group);
|
|
182
|
+
}
|
|
183
|
+
onDidActiveEditorChange() {
|
|
184
|
+
const activeEditorGroup = this.editorGroupService.activeGroup;
|
|
185
|
+
const activeEditorPane = activeEditorGroup.activeEditorPane;
|
|
186
|
+
if (this.lastActiveEditor && this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor, activeEditorPane)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.lastActiveEditor = activeEditorPane?.input ? { editor: activeEditorPane.input, groupId: activeEditorPane.group.id } : undefined;
|
|
190
|
+
this.activeEditorListeners.clear();
|
|
191
|
+
if (!activeEditorPane?.group.isTransient(activeEditorPane.input)) {
|
|
192
|
+
this.handleActiveEditorChange(activeEditorGroup, activeEditorPane);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.logService.trace(`[History]: ignoring transient editor change (editor: ${activeEditorPane.input?.resource?.toString()}})`);
|
|
196
|
+
}
|
|
197
|
+
if (isEditorPaneWithSelection(activeEditorPane)) {
|
|
198
|
+
this.activeEditorListeners.add(activeEditorPane.onDidChangeSelection(e => {
|
|
199
|
+
if (!activeEditorPane.group.isTransient(activeEditorPane.input)) {
|
|
200
|
+
this.handleActiveEditorSelectionChangeEvent(activeEditorGroup, activeEditorPane, e);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${activeEditorPane.input?.resource?.toString()}})`);
|
|
204
|
+
}
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
this.updateContextKeys();
|
|
208
|
+
}
|
|
209
|
+
onDidFilesChange(event) {
|
|
210
|
+
if (event instanceof FileChangesEvent) {
|
|
211
|
+
if (event.gotDeleted()) {
|
|
212
|
+
this.remove(event);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
if (event.isOperation(1 )) {
|
|
217
|
+
this.remove(event);
|
|
218
|
+
}
|
|
219
|
+
else if (event.isOperation(2 ) && event.target.isFile) {
|
|
220
|
+
this.move(event);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
handleActiveEditorChange(group, editorPane) {
|
|
225
|
+
this.handleActiveEditorChangeInHistory(editorPane);
|
|
226
|
+
this.handleActiveEditorChangeInNavigationStacks(group, editorPane);
|
|
227
|
+
}
|
|
228
|
+
handleActiveEditorSelectionChangeEvent(group, editorPane, event) {
|
|
229
|
+
this.handleActiveEditorSelectionChangeInNavigationStacks(group, editorPane, event);
|
|
230
|
+
}
|
|
231
|
+
move(event) {
|
|
232
|
+
this.moveInHistory(event);
|
|
233
|
+
this.moveInEditorNavigationStacks(event);
|
|
234
|
+
}
|
|
235
|
+
remove(arg1) {
|
|
236
|
+
this.removeFromHistory(arg1);
|
|
237
|
+
this.removeFromEditorNavigationStacks(arg1);
|
|
238
|
+
this.removeFromRecentlyClosedEditors(arg1);
|
|
239
|
+
this.removeFromRecentlyOpened(arg1);
|
|
240
|
+
}
|
|
241
|
+
removeFromRecentlyOpened(arg1) {
|
|
242
|
+
let resource = undefined;
|
|
243
|
+
if (isEditorInput(arg1)) {
|
|
244
|
+
resource = EditorResourceAccessor.getOriginalUri(arg1);
|
|
245
|
+
}
|
|
246
|
+
else if (arg1 instanceof FileChangesEvent) ;
|
|
247
|
+
else {
|
|
248
|
+
resource = arg1.resource;
|
|
249
|
+
}
|
|
250
|
+
if (resource) {
|
|
251
|
+
this.workspacesService.removeRecentlyOpened([resource]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
clear() {
|
|
255
|
+
this.clearRecentlyOpened();
|
|
256
|
+
this.clearEditorNavigationStacks();
|
|
257
|
+
this.recentlyClosedEditors = [];
|
|
258
|
+
this.updateContextKeys();
|
|
259
|
+
}
|
|
260
|
+
updateContextKeys() {
|
|
261
|
+
this.contextKeyService.bufferChangeEvents(() => {
|
|
262
|
+
const activeStack = this.getStack();
|
|
263
|
+
this.canNavigateBackContextKey.set(activeStack.canGoBack(0 ));
|
|
264
|
+
this.canNavigateForwardContextKey.set(activeStack.canGoForward(0 ));
|
|
265
|
+
this.canNavigateBackInNavigationsContextKey.set(activeStack.canGoBack(2 ));
|
|
266
|
+
this.canNavigateForwardInNavigationsContextKey.set(activeStack.canGoForward(2 ));
|
|
267
|
+
this.canNavigateToLastNavigationLocationContextKey.set(activeStack.canGoLast(2 ));
|
|
268
|
+
this.canNavigateBackInEditsContextKey.set(activeStack.canGoBack(1 ));
|
|
269
|
+
this.canNavigateForwardInEditsContextKey.set(activeStack.canGoForward(1 ));
|
|
270
|
+
this.canNavigateToLastEditLocationContextKey.set(activeStack.canGoLast(1 ));
|
|
271
|
+
this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
registerEditorNavigationScopeChangeListener() {
|
|
275
|
+
const handleEditorNavigationScopeChange = () => {
|
|
276
|
+
this.disposeEditorNavigationStacks();
|
|
277
|
+
const configuredScope = this.configurationService.getValue(HistoryService_1.NAVIGATION_SCOPE_SETTING);
|
|
278
|
+
if (configuredScope === 'editorGroup') {
|
|
279
|
+
this.editorNavigationScope = 1 ;
|
|
280
|
+
}
|
|
281
|
+
else if (configuredScope === 'editor') {
|
|
282
|
+
this.editorNavigationScope = 2 ;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
this.editorNavigationScope = 0 ;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
this._register(this.configurationService.onDidChangeConfiguration(event => {
|
|
289
|
+
if (event.affectsConfiguration(HistoryService_1.NAVIGATION_SCOPE_SETTING)) {
|
|
290
|
+
handleEditorNavigationScopeChange();
|
|
291
|
+
}
|
|
292
|
+
}));
|
|
293
|
+
handleEditorNavigationScopeChange();
|
|
294
|
+
}
|
|
295
|
+
getStack(group = this.editorGroupService.activeGroup, editor = group.activeEditor) {
|
|
296
|
+
switch (this.editorNavigationScope) {
|
|
297
|
+
case 2 : {
|
|
298
|
+
if (!editor) {
|
|
299
|
+
return ( new NoOpEditorNavigationStacks());
|
|
300
|
+
}
|
|
301
|
+
let stacksForGroup = this.editorScopedNavigationStacks.get(group.id);
|
|
302
|
+
if (!stacksForGroup) {
|
|
303
|
+
stacksForGroup = ( new Map());
|
|
304
|
+
this.editorScopedNavigationStacks.set(group.id, stacksForGroup);
|
|
305
|
+
}
|
|
306
|
+
let stack = stacksForGroup.get(editor)?.stack;
|
|
307
|
+
if (!stack) {
|
|
308
|
+
const disposable = ( new DisposableStore());
|
|
309
|
+
stack = disposable.add(this.instantiationService.createInstance(EditorNavigationStacks, 2 ));
|
|
310
|
+
disposable.add(stack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
|
|
311
|
+
stacksForGroup.set(editor, { stack, disposable });
|
|
312
|
+
}
|
|
313
|
+
return stack;
|
|
314
|
+
}
|
|
315
|
+
case 1 : {
|
|
316
|
+
let stack = this.editorGroupScopedNavigationStacks.get(group.id)?.stack;
|
|
317
|
+
if (!stack) {
|
|
318
|
+
const disposable = ( new DisposableStore());
|
|
319
|
+
stack = disposable.add(this.instantiationService.createInstance(EditorNavigationStacks, 1 ));
|
|
320
|
+
disposable.add(stack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
|
|
321
|
+
this.editorGroupScopedNavigationStacks.set(group.id, { stack, disposable });
|
|
322
|
+
}
|
|
323
|
+
return stack;
|
|
324
|
+
}
|
|
325
|
+
case 0 : {
|
|
326
|
+
if (!this.defaultScopedEditorNavigationStack) {
|
|
327
|
+
this.defaultScopedEditorNavigationStack = this._register(this.instantiationService.createInstance(EditorNavigationStacks, 0 ));
|
|
328
|
+
this._register(this.defaultScopedEditorNavigationStack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
|
|
329
|
+
}
|
|
330
|
+
return this.defaultScopedEditorNavigationStack;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
goForward(filter) {
|
|
335
|
+
return this.getStack().goForward(filter);
|
|
336
|
+
}
|
|
337
|
+
goBack(filter) {
|
|
338
|
+
return this.getStack().goBack(filter);
|
|
339
|
+
}
|
|
340
|
+
goPrevious(filter) {
|
|
341
|
+
return this.getStack().goPrevious(filter);
|
|
342
|
+
}
|
|
343
|
+
goLast(filter) {
|
|
344
|
+
return this.getStack().goLast(filter);
|
|
345
|
+
}
|
|
346
|
+
handleActiveEditorChangeInNavigationStacks(group, editorPane) {
|
|
347
|
+
this.getStack(group, editorPane?.input).handleActiveEditorChange(editorPane);
|
|
348
|
+
}
|
|
349
|
+
handleActiveEditorSelectionChangeInNavigationStacks(group, editorPane, event) {
|
|
350
|
+
this.getStack(group, editorPane.input).handleActiveEditorSelectionChange(editorPane, event);
|
|
351
|
+
}
|
|
352
|
+
handleEditorCloseEventInHistory(e) {
|
|
353
|
+
const editors = this.editorScopedNavigationStacks.get(e.groupId);
|
|
354
|
+
if (editors) {
|
|
355
|
+
const editorStack = editors.get(e.editor);
|
|
356
|
+
if (editorStack) {
|
|
357
|
+
editorStack.disposable.dispose();
|
|
358
|
+
editors.delete(e.editor);
|
|
359
|
+
}
|
|
360
|
+
if (editors.size === 0) {
|
|
361
|
+
this.editorScopedNavigationStacks.delete(e.groupId);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
handleEditorGroupRemoveInNavigationStacks(group) {
|
|
366
|
+
this.defaultScopedEditorNavigationStack?.remove(group.id);
|
|
367
|
+
const editorGroupStack = this.editorGroupScopedNavigationStacks.get(group.id);
|
|
368
|
+
if (editorGroupStack) {
|
|
369
|
+
editorGroupStack.disposable.dispose();
|
|
370
|
+
this.editorGroupScopedNavigationStacks.delete(group.id);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
clearEditorNavigationStacks() {
|
|
374
|
+
this.withEachEditorNavigationStack(stack => stack.clear());
|
|
375
|
+
}
|
|
376
|
+
removeFromEditorNavigationStacks(arg1) {
|
|
377
|
+
this.withEachEditorNavigationStack(stack => stack.remove(arg1));
|
|
378
|
+
}
|
|
379
|
+
moveInEditorNavigationStacks(event) {
|
|
380
|
+
this.withEachEditorNavigationStack(stack => stack.move(event));
|
|
381
|
+
}
|
|
382
|
+
withEachEditorNavigationStack(fn) {
|
|
383
|
+
if (this.defaultScopedEditorNavigationStack) {
|
|
384
|
+
fn(this.defaultScopedEditorNavigationStack);
|
|
385
|
+
}
|
|
386
|
+
for (const [, entry] of this.editorGroupScopedNavigationStacks) {
|
|
387
|
+
fn(entry.stack);
|
|
388
|
+
}
|
|
389
|
+
for (const [, entries] of this.editorScopedNavigationStacks) {
|
|
390
|
+
for (const [, entry] of entries) {
|
|
391
|
+
fn(entry.stack);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
disposeEditorNavigationStacks() {
|
|
396
|
+
this.defaultScopedEditorNavigationStack?.dispose();
|
|
397
|
+
this.defaultScopedEditorNavigationStack = undefined;
|
|
398
|
+
for (const [, stack] of this.editorGroupScopedNavigationStacks) {
|
|
399
|
+
stack.disposable.dispose();
|
|
400
|
+
}
|
|
401
|
+
this.editorGroupScopedNavigationStacks.clear();
|
|
402
|
+
for (const [, stacks] of this.editorScopedNavigationStacks) {
|
|
403
|
+
for (const [, stack] of stacks) {
|
|
404
|
+
stack.disposable.dispose();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
this.editorScopedNavigationStacks.clear();
|
|
408
|
+
}
|
|
409
|
+
openNextRecentlyUsedEditor(groupId) {
|
|
410
|
+
const [stack, index] = this.ensureRecentlyUsedStack(index => index - 1, groupId);
|
|
411
|
+
return this.doNavigateInRecentlyUsedEditorsStack(stack[index], groupId);
|
|
412
|
+
}
|
|
413
|
+
openPreviouslyUsedEditor(groupId) {
|
|
414
|
+
const [stack, index] = this.ensureRecentlyUsedStack(index => index + 1, groupId);
|
|
415
|
+
return this.doNavigateInRecentlyUsedEditorsStack(stack[index], groupId);
|
|
416
|
+
}
|
|
417
|
+
async doNavigateInRecentlyUsedEditorsStack(editorIdentifier, groupId) {
|
|
418
|
+
if (editorIdentifier) {
|
|
419
|
+
const acrossGroups = typeof groupId !== 'number' || !this.editorGroupService.getGroup(groupId);
|
|
420
|
+
if (acrossGroups) {
|
|
421
|
+
this.navigatingInRecentlyUsedEditorsStack = true;
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this.navigatingInRecentlyUsedEditorsInGroupStack = true;
|
|
425
|
+
}
|
|
426
|
+
const group = this.editorGroupService.getGroup(editorIdentifier.groupId) ?? this.editorGroupService.activeGroup;
|
|
427
|
+
try {
|
|
428
|
+
await group.openEditor(editorIdentifier.editor);
|
|
429
|
+
}
|
|
430
|
+
finally {
|
|
431
|
+
if (acrossGroups) {
|
|
432
|
+
this.navigatingInRecentlyUsedEditorsStack = false;
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
this.navigatingInRecentlyUsedEditorsInGroupStack = false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
ensureRecentlyUsedStack(indexModifier, groupId) {
|
|
441
|
+
let editors;
|
|
442
|
+
let index;
|
|
443
|
+
const group = typeof groupId === 'number' ? this.editorGroupService.getGroup(groupId) : undefined;
|
|
444
|
+
if (!group) {
|
|
445
|
+
editors = this.recentlyUsedEditorsStack || this.editorService.getEditors(0 );
|
|
446
|
+
index = this.recentlyUsedEditorsStackIndex;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
editors = this.recentlyUsedEditorsInGroupStack || ( group.getEditors(0 ).map(editor => ({ groupId: group.id, editor })));
|
|
450
|
+
index = this.recentlyUsedEditorsInGroupStackIndex;
|
|
451
|
+
}
|
|
452
|
+
let newIndex = indexModifier(index);
|
|
453
|
+
if (newIndex < 0) {
|
|
454
|
+
newIndex = 0;
|
|
455
|
+
}
|
|
456
|
+
else if (newIndex > editors.length - 1) {
|
|
457
|
+
newIndex = editors.length - 1;
|
|
458
|
+
}
|
|
459
|
+
if (!group) {
|
|
460
|
+
this.recentlyUsedEditorsStack = editors;
|
|
461
|
+
this.recentlyUsedEditorsStackIndex = newIndex;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.recentlyUsedEditorsInGroupStack = editors;
|
|
465
|
+
this.recentlyUsedEditorsInGroupStackIndex = newIndex;
|
|
466
|
+
}
|
|
467
|
+
return [editors, newIndex];
|
|
468
|
+
}
|
|
469
|
+
handleEditorEventInRecentEditorsStack() {
|
|
470
|
+
if (!this.navigatingInRecentlyUsedEditorsStack) {
|
|
471
|
+
this.recentlyUsedEditorsStack = undefined;
|
|
472
|
+
this.recentlyUsedEditorsStackIndex = 0;
|
|
473
|
+
}
|
|
474
|
+
if (!this.navigatingInRecentlyUsedEditorsInGroupStack) {
|
|
475
|
+
this.recentlyUsedEditorsInGroupStack = undefined;
|
|
476
|
+
this.recentlyUsedEditorsInGroupStackIndex = 0;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
static { this.MAX_RECENTLY_CLOSED_EDITORS = 20; }
|
|
480
|
+
handleEditorCloseEventInReopen(event) {
|
|
481
|
+
if (this.ignoreEditorCloseEvent) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const { editor, context } = event;
|
|
485
|
+
if (context === EditorCloseContext.REPLACE || context === EditorCloseContext.MOVE) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const untypedEditor = editor.toUntyped();
|
|
489
|
+
if (!untypedEditor) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
const associatedResources = [];
|
|
493
|
+
const editorResource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH });
|
|
494
|
+
if (URI.isUri(editorResource)) {
|
|
495
|
+
associatedResources.push(editorResource);
|
|
496
|
+
}
|
|
497
|
+
else if (editorResource) {
|
|
498
|
+
associatedResources.push(...coalesce([editorResource.primary, editorResource.secondary]));
|
|
499
|
+
}
|
|
500
|
+
this.removeFromRecentlyClosedEditors(editor);
|
|
501
|
+
this.recentlyClosedEditors.push({
|
|
502
|
+
editorId: editor.editorId,
|
|
503
|
+
editor: untypedEditor,
|
|
504
|
+
resource: EditorResourceAccessor.getOriginalUri(editor),
|
|
505
|
+
associatedResources,
|
|
506
|
+
index: event.index,
|
|
507
|
+
sticky: event.sticky
|
|
508
|
+
});
|
|
509
|
+
if (this.recentlyClosedEditors.length > HistoryService_1.MAX_RECENTLY_CLOSED_EDITORS) {
|
|
510
|
+
this.recentlyClosedEditors.shift();
|
|
511
|
+
}
|
|
512
|
+
this.canReopenClosedEditorContextKey.set(true);
|
|
513
|
+
}
|
|
514
|
+
async reopenLastClosedEditor() {
|
|
515
|
+
const lastClosedEditor = this.recentlyClosedEditors.pop();
|
|
516
|
+
let reopenClosedEditorPromise = undefined;
|
|
517
|
+
if (lastClosedEditor) {
|
|
518
|
+
reopenClosedEditorPromise = this.doReopenLastClosedEditor(lastClosedEditor);
|
|
519
|
+
}
|
|
520
|
+
this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
|
|
521
|
+
return reopenClosedEditorPromise;
|
|
522
|
+
}
|
|
523
|
+
async doReopenLastClosedEditor(lastClosedEditor) {
|
|
524
|
+
const options = { pinned: true, sticky: lastClosedEditor.sticky, index: lastClosedEditor.index, ignoreError: true };
|
|
525
|
+
if ((lastClosedEditor.sticky && !this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index)) ||
|
|
526
|
+
(!lastClosedEditor.sticky && this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index))) {
|
|
527
|
+
options.index = undefined;
|
|
528
|
+
}
|
|
529
|
+
let editorPane = undefined;
|
|
530
|
+
if (!this.editorGroupService.activeGroup.contains(lastClosedEditor.editor)) {
|
|
531
|
+
this.ignoreEditorCloseEvent = true;
|
|
532
|
+
try {
|
|
533
|
+
editorPane = await this.editorService.openEditor({
|
|
534
|
+
...lastClosedEditor.editor,
|
|
535
|
+
options: {
|
|
536
|
+
...lastClosedEditor.editor.options,
|
|
537
|
+
...options
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
finally {
|
|
542
|
+
this.ignoreEditorCloseEvent = false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (!editorPane) {
|
|
546
|
+
remove(this.recentlyClosedEditors, lastClosedEditor);
|
|
547
|
+
this.reopenLastClosedEditor();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
removeFromRecentlyClosedEditors(arg1) {
|
|
551
|
+
this.recentlyClosedEditors = this.recentlyClosedEditors.filter(recentlyClosedEditor => {
|
|
552
|
+
if (isEditorInput(arg1) && recentlyClosedEditor.editorId !== arg1.editorId) {
|
|
553
|
+
return true;
|
|
554
|
+
}
|
|
555
|
+
if (recentlyClosedEditor.resource && this.editorHelper.matchesFile(recentlyClosedEditor.resource, arg1)) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
if (( recentlyClosedEditor.associatedResources.some(
|
|
559
|
+
associatedResource => this.editorHelper.matchesFile(associatedResource, arg1)
|
|
560
|
+
))) {
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
return true;
|
|
564
|
+
});
|
|
565
|
+
this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
|
|
566
|
+
}
|
|
567
|
+
static { this.MAX_HISTORY_ITEMS = 200; }
|
|
568
|
+
static { this.HISTORY_STORAGE_KEY = 'history.entries'; }
|
|
569
|
+
handleActiveEditorChangeInHistory(editorPane) {
|
|
570
|
+
const editor = editorPane?.input;
|
|
571
|
+
if (!editor || editor.isDisposed() || !this.includeInHistory(editor)) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
this.removeFromHistory(editor);
|
|
575
|
+
this.addToHistory(editor);
|
|
576
|
+
}
|
|
577
|
+
addToHistory(editor, insertFirst = true) {
|
|
578
|
+
this.ensureHistoryLoaded(this.history);
|
|
579
|
+
const historyInput = this.editorHelper.preferResourceEditorInput(editor);
|
|
580
|
+
if (!historyInput) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (insertFirst) {
|
|
584
|
+
this.history.unshift(historyInput);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
this.history.push(historyInput);
|
|
588
|
+
}
|
|
589
|
+
if (this.history.length > HistoryService_1.MAX_HISTORY_ITEMS) {
|
|
590
|
+
this.editorHelper.clearOnEditorDispose(this.history.pop(), this.editorHistoryListeners);
|
|
591
|
+
}
|
|
592
|
+
if (isEditorInput(editor)) {
|
|
593
|
+
this.editorHelper.onEditorDispose(editor, () => this.updateHistoryOnEditorDispose(historyInput), this.editorHistoryListeners);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
updateHistoryOnEditorDispose(editor) {
|
|
597
|
+
if (isEditorInput(editor)) {
|
|
598
|
+
if (!isSideBySideEditorInput(editor)) {
|
|
599
|
+
this.removeFromHistory(editor);
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
const resourceInputs = [];
|
|
603
|
+
const sideInputs = editor.primary.matches(editor.secondary) ? [editor.primary] : [editor.primary, editor.secondary];
|
|
604
|
+
for (const sideInput of sideInputs) {
|
|
605
|
+
const candidateResourceInput = this.editorHelper.preferResourceEditorInput(sideInput);
|
|
606
|
+
if (isResourceEditorInput(candidateResourceInput)) {
|
|
607
|
+
resourceInputs.push(candidateResourceInput);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
this.replaceInHistory(editor, ...resourceInputs);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
if (!this.includeInHistory(editor)) {
|
|
615
|
+
this.removeFromHistory(editor);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
includeInHistory(editor) {
|
|
620
|
+
if (isEditorInput(editor)) {
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
return !this.resourceExcludeMatcher.value.matches(editor.resource);
|
|
624
|
+
}
|
|
625
|
+
removeExcludedFromHistory() {
|
|
626
|
+
this.ensureHistoryLoaded(this.history);
|
|
627
|
+
this.history = this.history.filter(entry => {
|
|
628
|
+
const include = this.includeInHistory(entry);
|
|
629
|
+
if (!include) {
|
|
630
|
+
this.editorHelper.clearOnEditorDispose(entry, this.editorHistoryListeners);
|
|
631
|
+
}
|
|
632
|
+
return include;
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
moveInHistory(event) {
|
|
636
|
+
if (event.isOperation(2 )) {
|
|
637
|
+
const removed = this.removeFromHistory(event);
|
|
638
|
+
if (removed) {
|
|
639
|
+
this.addToHistory({ resource: event.target.resource });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
removeFromHistory(arg1) {
|
|
644
|
+
let removed = false;
|
|
645
|
+
this.ensureHistoryLoaded(this.history);
|
|
646
|
+
this.history = this.history.filter(entry => {
|
|
647
|
+
const matches = this.editorHelper.matchesEditor(arg1, entry);
|
|
648
|
+
if (matches) {
|
|
649
|
+
this.editorHelper.clearOnEditorDispose(arg1, this.editorHistoryListeners);
|
|
650
|
+
removed = true;
|
|
651
|
+
}
|
|
652
|
+
return !matches;
|
|
653
|
+
});
|
|
654
|
+
return removed;
|
|
655
|
+
}
|
|
656
|
+
replaceInHistory(editor, ...replacements) {
|
|
657
|
+
this.ensureHistoryLoaded(this.history);
|
|
658
|
+
let replaced = false;
|
|
659
|
+
const newHistory = [];
|
|
660
|
+
for (const entry of this.history) {
|
|
661
|
+
if (this.editorHelper.matchesEditor(editor, entry)) {
|
|
662
|
+
this.editorHelper.clearOnEditorDispose(editor, this.editorHistoryListeners);
|
|
663
|
+
if (!replaced) {
|
|
664
|
+
newHistory.push(...replacements);
|
|
665
|
+
replaced = true;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
else if (!( replacements.some(replacement => this.editorHelper.matchesEditor(replacement, entry)))) {
|
|
669
|
+
newHistory.push(entry);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (!replaced) {
|
|
673
|
+
newHistory.push(...replacements);
|
|
674
|
+
}
|
|
675
|
+
this.history = newHistory;
|
|
676
|
+
}
|
|
677
|
+
clearRecentlyOpened() {
|
|
678
|
+
this.history = [];
|
|
679
|
+
for (const [, disposable] of this.editorHistoryListeners) {
|
|
680
|
+
dispose(disposable);
|
|
681
|
+
}
|
|
682
|
+
this.editorHistoryListeners.clear();
|
|
683
|
+
}
|
|
684
|
+
getHistory() {
|
|
685
|
+
this.ensureHistoryLoaded(this.history);
|
|
686
|
+
return this.history;
|
|
687
|
+
}
|
|
688
|
+
ensureHistoryLoaded(history) {
|
|
689
|
+
if (!this.history) {
|
|
690
|
+
this.history = [];
|
|
691
|
+
if (this.editorGroupService.isReady) {
|
|
692
|
+
this.loadHistory();
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
(async () => {
|
|
696
|
+
await this.editorGroupService.whenReady;
|
|
697
|
+
this.loadHistory();
|
|
698
|
+
})();
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
loadHistory() {
|
|
703
|
+
this.history = [];
|
|
704
|
+
const storedEditorHistory = this.loadHistoryFromStorage();
|
|
705
|
+
const openedEditorsLru = [...this.editorService.getEditors(0 )].reverse();
|
|
706
|
+
const handledEditors = ( new Set());
|
|
707
|
+
for (const { editor } of openedEditorsLru) {
|
|
708
|
+
if (!this.includeInHistory(editor)) {
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
this.addToHistory(editor);
|
|
712
|
+
if (editor.resource) {
|
|
713
|
+
handledEditors.add(`${( editor.resource.toString())}/${editor.editorId}`);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
for (const editor of storedEditorHistory) {
|
|
717
|
+
if (!( handledEditors.has(`${( editor.resource.toString())}/${editor.options?.override}`)) &&
|
|
718
|
+
this.includeInHistory(editor)) {
|
|
719
|
+
this.addToHistory(editor, false );
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
loadHistoryFromStorage() {
|
|
724
|
+
const entries = [];
|
|
725
|
+
const entriesRaw = this.storageService.get(HistoryService_1.HISTORY_STORAGE_KEY, 1 );
|
|
726
|
+
if (entriesRaw) {
|
|
727
|
+
try {
|
|
728
|
+
const entriesParsed = JSON.parse(entriesRaw);
|
|
729
|
+
for (const entryParsed of entriesParsed) {
|
|
730
|
+
if (!entryParsed.editor || !entryParsed.editor.resource) {
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
try {
|
|
734
|
+
entries.push({
|
|
735
|
+
...entryParsed.editor,
|
|
736
|
+
resource: typeof entryParsed.editor.resource === 'string' ?
|
|
737
|
+
(
|
|
738
|
+
URI.parse(entryParsed.editor.resource)) :
|
|
739
|
+
( URI.from(entryParsed.editor.resource))
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
catch (error) {
|
|
743
|
+
onUnexpectedError(error);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
catch (error) {
|
|
748
|
+
onUnexpectedError(error);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return entries;
|
|
752
|
+
}
|
|
753
|
+
saveState() {
|
|
754
|
+
if (!this.history) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
const entries = [];
|
|
758
|
+
for (const editor of this.history) {
|
|
759
|
+
if (isEditorInput(editor) || !isResourceEditorInput(editor)) {
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
entries.push({
|
|
763
|
+
editor: {
|
|
764
|
+
...editor,
|
|
765
|
+
resource: ( editor.resource.toString())
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
this.storageService.store(HistoryService_1.HISTORY_STORAGE_KEY, JSON.stringify(entries), 1 , 1 );
|
|
770
|
+
}
|
|
771
|
+
getLastActiveWorkspaceRoot(schemeFilter, authorityFilter) {
|
|
772
|
+
const folders = this.contextService.getWorkspace().folders;
|
|
773
|
+
if (folders.length === 0) {
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
776
|
+
if (folders.length === 1) {
|
|
777
|
+
const resource = folders[0].uri;
|
|
778
|
+
if ((!schemeFilter || resource.scheme === schemeFilter) && (!authorityFilter || resource.authority === authorityFilter)) {
|
|
779
|
+
return resource;
|
|
780
|
+
}
|
|
781
|
+
return undefined;
|
|
782
|
+
}
|
|
783
|
+
for (const input of this.getHistory()) {
|
|
784
|
+
if (isEditorInput(input)) {
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
787
|
+
if (schemeFilter && input.resource.scheme !== schemeFilter) {
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
if (authorityFilter && input.resource.authority !== authorityFilter) {
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
const resourceWorkspace = this.contextService.getWorkspaceFolder(input.resource);
|
|
794
|
+
if (resourceWorkspace) {
|
|
795
|
+
return resourceWorkspace.uri;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
for (const folder of folders) {
|
|
799
|
+
const resource = folder.uri;
|
|
800
|
+
if ((!schemeFilter || resource.scheme === schemeFilter) && (!authorityFilter || resource.authority === authorityFilter)) {
|
|
801
|
+
return resource;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return undefined;
|
|
805
|
+
}
|
|
806
|
+
getLastActiveFile(filterByScheme, filterByAuthority) {
|
|
807
|
+
for (const input of this.getHistory()) {
|
|
808
|
+
let resource;
|
|
809
|
+
if (isEditorInput(input)) {
|
|
810
|
+
resource = EditorResourceAccessor.getOriginalUri(input, { filterByScheme });
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
resource = input.resource;
|
|
814
|
+
}
|
|
815
|
+
if (resource && resource.scheme === filterByScheme && (!filterByAuthority || resource.authority === filterByAuthority)) {
|
|
816
|
+
return resource;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return undefined;
|
|
820
|
+
}
|
|
821
|
+
dispose() {
|
|
822
|
+
super.dispose();
|
|
823
|
+
for (const [, stack] of this.editorGroupScopedNavigationStacks) {
|
|
824
|
+
stack.disposable.dispose();
|
|
825
|
+
}
|
|
826
|
+
for (const [, editors] of this.editorScopedNavigationStacks) {
|
|
827
|
+
for (const [, stack] of editors) {
|
|
828
|
+
stack.disposable.dispose();
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
for (const [, listener] of this.editorHistoryListeners) {
|
|
832
|
+
listener.dispose();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
HistoryService = HistoryService_1 = ( __decorate([
|
|
837
|
+
( __param(0, IEditorService)),
|
|
838
|
+
( __param(1, IEditorGroupsService)),
|
|
839
|
+
( __param(2, IWorkspaceContextService)),
|
|
840
|
+
( __param(3, IStorageService)),
|
|
841
|
+
( __param(4, IConfigurationService)),
|
|
842
|
+
( __param(5, IFileService)),
|
|
843
|
+
( __param(6, IWorkspacesService)),
|
|
844
|
+
( __param(7, IInstantiationService)),
|
|
845
|
+
( __param(8, IWorkbenchLayoutService)),
|
|
846
|
+
( __param(9, IContextKeyService)),
|
|
847
|
+
( __param(10, ILogService))
|
|
848
|
+
], HistoryService));
|
|
849
|
+
( registerSingleton(IHistoryService, HistoryService, 0 ));
|
|
850
|
+
class EditorSelectionState {
|
|
851
|
+
constructor(editorIdentifier, selection, reason) {
|
|
852
|
+
this.editorIdentifier = editorIdentifier;
|
|
853
|
+
this.selection = selection;
|
|
854
|
+
this.reason = reason;
|
|
855
|
+
}
|
|
856
|
+
justifiesNewNavigationEntry(other) {
|
|
857
|
+
if (this.editorIdentifier.groupId !== other.editorIdentifier.groupId) {
|
|
858
|
+
return true;
|
|
859
|
+
}
|
|
860
|
+
if (!this.editorIdentifier.editor.matches(other.editorIdentifier.editor)) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
if (!this.selection || !other.selection) {
|
|
864
|
+
return true;
|
|
865
|
+
}
|
|
866
|
+
const result = this.selection.compare(other.selection);
|
|
867
|
+
if (result === 2 && ((other.reason === 4 || other.reason === 5) )) {
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
return result === 3 ;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
let EditorNavigationStacks = class EditorNavigationStacks extends Disposable {
|
|
874
|
+
constructor(scope, instantiationService) {
|
|
875
|
+
super();
|
|
876
|
+
this.scope = scope;
|
|
877
|
+
this.instantiationService = instantiationService;
|
|
878
|
+
this.selectionsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 0 , this.scope));
|
|
879
|
+
this.editsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 1 , this.scope));
|
|
880
|
+
this.navigationsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 2 , this.scope));
|
|
881
|
+
this.stacks = [
|
|
882
|
+
this.selectionsStack,
|
|
883
|
+
this.editsStack,
|
|
884
|
+
this.navigationsStack
|
|
885
|
+
];
|
|
886
|
+
this.onDidChange = Event.any(this.selectionsStack.onDidChange, this.editsStack.onDidChange, this.navigationsStack.onDidChange);
|
|
887
|
+
}
|
|
888
|
+
canGoForward(filter) {
|
|
889
|
+
return this.getStack(filter).canGoForward();
|
|
890
|
+
}
|
|
891
|
+
goForward(filter) {
|
|
892
|
+
return this.getStack(filter).goForward();
|
|
893
|
+
}
|
|
894
|
+
canGoBack(filter) {
|
|
895
|
+
return this.getStack(filter).canGoBack();
|
|
896
|
+
}
|
|
897
|
+
goBack(filter) {
|
|
898
|
+
return this.getStack(filter).goBack();
|
|
899
|
+
}
|
|
900
|
+
goPrevious(filter) {
|
|
901
|
+
return this.getStack(filter).goPrevious();
|
|
902
|
+
}
|
|
903
|
+
canGoLast(filter) {
|
|
904
|
+
return this.getStack(filter).canGoLast();
|
|
905
|
+
}
|
|
906
|
+
goLast(filter) {
|
|
907
|
+
return this.getStack(filter).goLast();
|
|
908
|
+
}
|
|
909
|
+
getStack(filter = 0 ) {
|
|
910
|
+
switch (filter) {
|
|
911
|
+
case 0 : return this.selectionsStack;
|
|
912
|
+
case 1 : return this.editsStack;
|
|
913
|
+
case 2 : return this.navigationsStack;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
handleActiveEditorChange(editorPane) {
|
|
917
|
+
this.selectionsStack.notifyNavigation(editorPane);
|
|
918
|
+
}
|
|
919
|
+
handleActiveEditorSelectionChange(editorPane, event) {
|
|
920
|
+
const previous = this.selectionsStack.current;
|
|
921
|
+
this.selectionsStack.notifyNavigation(editorPane, event);
|
|
922
|
+
if (event.reason === 3 ) {
|
|
923
|
+
this.editsStack.notifyNavigation(editorPane, event);
|
|
924
|
+
}
|
|
925
|
+
else if (((event.reason === 4 || event.reason === 5) ) &&
|
|
926
|
+
!this.selectionsStack.isNavigating()) {
|
|
927
|
+
if (event.reason === 5 && !this.navigationsStack.isNavigating()) {
|
|
928
|
+
if (previous) {
|
|
929
|
+
this.navigationsStack.addOrReplace(previous.groupId, previous.editor, previous.selection);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
this.navigationsStack.notifyNavigation(editorPane, event);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
clear() {
|
|
936
|
+
for (const stack of this.stacks) {
|
|
937
|
+
stack.clear();
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
remove(arg1) {
|
|
941
|
+
for (const stack of this.stacks) {
|
|
942
|
+
stack.remove(arg1);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
move(event) {
|
|
946
|
+
for (const stack of this.stacks) {
|
|
947
|
+
stack.move(event);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
EditorNavigationStacks = ( __decorate([
|
|
952
|
+
( __param(1, IInstantiationService))
|
|
953
|
+
], EditorNavigationStacks));
|
|
954
|
+
class NoOpEditorNavigationStacks {
|
|
955
|
+
constructor() {
|
|
956
|
+
this.onDidChange = Event.None;
|
|
957
|
+
}
|
|
958
|
+
canGoForward() { return false; }
|
|
959
|
+
async goForward() { }
|
|
960
|
+
canGoBack() { return false; }
|
|
961
|
+
async goBack() { }
|
|
962
|
+
async goPrevious() { }
|
|
963
|
+
canGoLast() { return false; }
|
|
964
|
+
async goLast() { }
|
|
965
|
+
handleActiveEditorChange() { }
|
|
966
|
+
handleActiveEditorSelectionChange() { }
|
|
967
|
+
clear() { }
|
|
968
|
+
remove() { }
|
|
969
|
+
move() { }
|
|
970
|
+
dispose() { }
|
|
971
|
+
}
|
|
972
|
+
let EditorNavigationStack = class EditorNavigationStack extends Disposable {
|
|
973
|
+
static { EditorNavigationStack_1 = this; }
|
|
974
|
+
static { this.MAX_STACK_SIZE = 50; }
|
|
975
|
+
get current() {
|
|
976
|
+
return this.stack[this.index];
|
|
977
|
+
}
|
|
978
|
+
set current(entry) {
|
|
979
|
+
if (entry) {
|
|
980
|
+
this.stack[this.index] = entry;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
constructor(filter, scope, instantiationService, editorService, editorGroupService, logService) {
|
|
984
|
+
super();
|
|
985
|
+
this.filter = filter;
|
|
986
|
+
this.scope = scope;
|
|
987
|
+
this.instantiationService = instantiationService;
|
|
988
|
+
this.editorService = editorService;
|
|
989
|
+
this.editorGroupService = editorGroupService;
|
|
990
|
+
this.logService = logService;
|
|
991
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
992
|
+
this.onDidChange = this._onDidChange.event;
|
|
993
|
+
this.mapEditorToDisposable = ( new Map());
|
|
994
|
+
this.mapGroupToDisposable = ( new Map());
|
|
995
|
+
this.editorHelper = this.instantiationService.createInstance(EditorHelper);
|
|
996
|
+
this.stack = [];
|
|
997
|
+
this.index = -1;
|
|
998
|
+
this.previousIndex = -1;
|
|
999
|
+
this.navigating = false;
|
|
1000
|
+
this.currentSelectionState = undefined;
|
|
1001
|
+
this.registerListeners();
|
|
1002
|
+
}
|
|
1003
|
+
registerListeners() {
|
|
1004
|
+
this._register(this.onDidChange(() => this.traceStack()));
|
|
1005
|
+
this._register(this.logService.onDidChangeLogLevel(() => this.traceStack()));
|
|
1006
|
+
}
|
|
1007
|
+
traceStack() {
|
|
1008
|
+
if (this.logService.getLevel() !== LogLevel.Trace) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const entryLabels = [];
|
|
1012
|
+
for (const entry of this.stack) {
|
|
1013
|
+
if (typeof entry.selection?.log === 'function') {
|
|
1014
|
+
entryLabels.push(`- group: ${entry.groupId}, editor: ${entry.editor.resource?.toString()}, selection: ${entry.selection.log()}`);
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
entryLabels.push(`- group: ${entry.groupId}, editor: ${entry.editor.resource?.toString()}, selection: <none>`);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
if (entryLabels.length === 0) {
|
|
1021
|
+
this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`);
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
|
|
1025
|
+
${entryLabels.join('\n')}
|
|
1026
|
+
`);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
trace(msg, editor = null, event) {
|
|
1030
|
+
if (this.logService.getLevel() !== LogLevel.Trace) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
let filterLabel;
|
|
1034
|
+
switch (this.filter) {
|
|
1035
|
+
case 0 :
|
|
1036
|
+
filterLabel = 'global';
|
|
1037
|
+
break;
|
|
1038
|
+
case 1 :
|
|
1039
|
+
filterLabel = 'edits';
|
|
1040
|
+
break;
|
|
1041
|
+
case 2 :
|
|
1042
|
+
filterLabel = 'navigation';
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
let scopeLabel;
|
|
1046
|
+
switch (this.scope) {
|
|
1047
|
+
case 0 :
|
|
1048
|
+
scopeLabel = 'default';
|
|
1049
|
+
break;
|
|
1050
|
+
case 1 :
|
|
1051
|
+
scopeLabel = 'editorGroup';
|
|
1052
|
+
break;
|
|
1053
|
+
case 2 :
|
|
1054
|
+
scopeLabel = 'editor';
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
if (editor !== null) {
|
|
1058
|
+
this.logService.trace(`[History stack ${filterLabel}-${scopeLabel}]: ${msg} (editor: ${editor?.resource?.toString()}, event: ${this.traceEvent(event)})`);
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
this.logService.trace(`[History stack ${filterLabel}-${scopeLabel}]: ${msg}`);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
traceEvent(event) {
|
|
1065
|
+
if (!event) {
|
|
1066
|
+
return '<none>';
|
|
1067
|
+
}
|
|
1068
|
+
switch (event.reason) {
|
|
1069
|
+
case 3 : return 'edit';
|
|
1070
|
+
case 4 : return 'navigation';
|
|
1071
|
+
case 5 : return 'jump';
|
|
1072
|
+
case 1 : return 'programmatic';
|
|
1073
|
+
case 2 : return 'user';
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
registerGroupListeners(groupId) {
|
|
1077
|
+
if (!( this.mapGroupToDisposable.has(groupId))) {
|
|
1078
|
+
const group = this.editorGroupService.getGroup(groupId);
|
|
1079
|
+
if (group) {
|
|
1080
|
+
this.mapGroupToDisposable.set(groupId, group.onWillMoveEditor(e => this.onWillMoveEditor(e)));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
onWillMoveEditor(e) {
|
|
1085
|
+
this.trace('onWillMoveEditor()', e.editor);
|
|
1086
|
+
if (this.scope === 1 ) {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
for (const entry of this.stack) {
|
|
1090
|
+
if (entry.groupId !== e.groupId) {
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
if (!this.editorHelper.matchesEditor(e.editor, entry.editor)) {
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
entry.groupId = e.target;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
notifyNavigation(editorPane, event) {
|
|
1100
|
+
this.trace('notifyNavigation()', editorPane?.input, event);
|
|
1101
|
+
const isSelectionAwareEditorPane = isEditorPaneWithSelection(editorPane);
|
|
1102
|
+
const hasValidEditor = editorPane?.input && !editorPane.input.isDisposed();
|
|
1103
|
+
if (this.navigating) {
|
|
1104
|
+
this.trace(`notifyNavigation() ignoring (navigating)`, editorPane?.input, event);
|
|
1105
|
+
if (isSelectionAwareEditorPane && hasValidEditor) {
|
|
1106
|
+
this.trace('notifyNavigation() updating current selection state', editorPane?.input, event);
|
|
1107
|
+
this.currentSelectionState = ( new EditorSelectionState(
|
|
1108
|
+
{ groupId: editorPane.group.id, editor: editorPane.input },
|
|
1109
|
+
editorPane.getSelection(),
|
|
1110
|
+
event?.reason
|
|
1111
|
+
));
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
this.trace('notifyNavigation() dropping current selection state', editorPane?.input, event);
|
|
1115
|
+
this.currentSelectionState = undefined;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
else {
|
|
1119
|
+
this.trace(`notifyNavigation() not ignoring`, editorPane?.input, event);
|
|
1120
|
+
if (isSelectionAwareEditorPane && hasValidEditor) {
|
|
1121
|
+
this.onSelectionAwareEditorNavigation(editorPane.group.id, editorPane.input, editorPane.getSelection(), event);
|
|
1122
|
+
}
|
|
1123
|
+
else {
|
|
1124
|
+
this.currentSelectionState = undefined;
|
|
1125
|
+
if (hasValidEditor) {
|
|
1126
|
+
this.onNonSelectionAwareEditorNavigation(editorPane.group.id, editorPane.input);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
onSelectionAwareEditorNavigation(groupId, editor, selection, event) {
|
|
1132
|
+
if (this.current?.groupId === groupId && !selection && this.editorHelper.matchesEditor(this.current.editor, editor)) {
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
this.trace('onSelectionAwareEditorNavigation()', editor, event);
|
|
1136
|
+
const stateCandidate = ( new EditorSelectionState({ groupId, editor }, selection, event?.reason));
|
|
1137
|
+
if (!this.currentSelectionState || this.currentSelectionState.justifiesNewNavigationEntry(stateCandidate)) {
|
|
1138
|
+
this.doAdd(groupId, editor, stateCandidate.selection);
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1141
|
+
this.doReplace(groupId, editor, stateCandidate.selection);
|
|
1142
|
+
}
|
|
1143
|
+
this.currentSelectionState = stateCandidate;
|
|
1144
|
+
}
|
|
1145
|
+
onNonSelectionAwareEditorNavigation(groupId, editor) {
|
|
1146
|
+
if (this.current?.groupId === groupId && this.editorHelper.matchesEditor(this.current.editor, editor)) {
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
this.trace('onNonSelectionAwareEditorNavigation()', editor);
|
|
1150
|
+
this.doAdd(groupId, editor);
|
|
1151
|
+
}
|
|
1152
|
+
doAdd(groupId, editor, selection) {
|
|
1153
|
+
if (!this.navigating) {
|
|
1154
|
+
this.addOrReplace(groupId, editor, selection);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
doReplace(groupId, editor, selection) {
|
|
1158
|
+
if (!this.navigating) {
|
|
1159
|
+
this.addOrReplace(groupId, editor, selection, true );
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
addOrReplace(groupId, editorCandidate, selection, forceReplace) {
|
|
1163
|
+
this.registerGroupListeners(groupId);
|
|
1164
|
+
let replace = false;
|
|
1165
|
+
if (this.current) {
|
|
1166
|
+
if (forceReplace) {
|
|
1167
|
+
replace = true;
|
|
1168
|
+
}
|
|
1169
|
+
else if (this.shouldReplaceStackEntry(this.current, { groupId, editor: editorCandidate, selection })) {
|
|
1170
|
+
replace = true;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
const editor = this.editorHelper.preferResourceEditorInput(editorCandidate);
|
|
1174
|
+
if (!editor) {
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
if (replace) {
|
|
1178
|
+
this.trace('replace()', editor);
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
this.trace('add()', editor);
|
|
1182
|
+
}
|
|
1183
|
+
const newStackEntry = { groupId, editor, selection };
|
|
1184
|
+
const removedEntries = [];
|
|
1185
|
+
if (replace) {
|
|
1186
|
+
if (this.current) {
|
|
1187
|
+
removedEntries.push(this.current);
|
|
1188
|
+
}
|
|
1189
|
+
this.current = newStackEntry;
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
if (this.stack.length > this.index + 1) {
|
|
1193
|
+
for (let i = this.index + 1; i < this.stack.length; i++) {
|
|
1194
|
+
removedEntries.push(this.stack[i]);
|
|
1195
|
+
}
|
|
1196
|
+
this.stack = this.stack.slice(0, this.index + 1);
|
|
1197
|
+
}
|
|
1198
|
+
this.stack.splice(this.index + 1, 0, newStackEntry);
|
|
1199
|
+
if (this.stack.length > EditorNavigationStack_1.MAX_STACK_SIZE) {
|
|
1200
|
+
removedEntries.push(this.stack.shift());
|
|
1201
|
+
if (this.previousIndex >= 0) {
|
|
1202
|
+
this.previousIndex--;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
else {
|
|
1206
|
+
this.setIndex(this.index + 1, true );
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
for (const removedEntry of removedEntries) {
|
|
1210
|
+
this.editorHelper.clearOnEditorDispose(removedEntry.editor, this.mapEditorToDisposable);
|
|
1211
|
+
}
|
|
1212
|
+
if (isEditorInput(editor)) {
|
|
1213
|
+
this.editorHelper.onEditorDispose(editor, () => this.remove(editor), this.mapEditorToDisposable);
|
|
1214
|
+
}
|
|
1215
|
+
this._onDidChange.fire();
|
|
1216
|
+
}
|
|
1217
|
+
shouldReplaceStackEntry(entry, candidate) {
|
|
1218
|
+
if (entry.groupId !== candidate.groupId) {
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1221
|
+
if (!this.editorHelper.matchesEditor(entry.editor, candidate.editor)) {
|
|
1222
|
+
return false;
|
|
1223
|
+
}
|
|
1224
|
+
if (!entry.selection) {
|
|
1225
|
+
return true;
|
|
1226
|
+
}
|
|
1227
|
+
if (!candidate.selection) {
|
|
1228
|
+
return false;
|
|
1229
|
+
}
|
|
1230
|
+
return entry.selection.compare(candidate.selection) === 1 ;
|
|
1231
|
+
}
|
|
1232
|
+
move(event) {
|
|
1233
|
+
if (event.isOperation(2 )) {
|
|
1234
|
+
for (const entry of this.stack) {
|
|
1235
|
+
if (this.editorHelper.matchesEditor(event, entry.editor)) {
|
|
1236
|
+
entry.editor = { resource: event.target.resource };
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
remove(arg1) {
|
|
1242
|
+
const previousStackSize = this.stack.length;
|
|
1243
|
+
this.stack = this.stack.filter(entry => {
|
|
1244
|
+
const matches = typeof arg1 === 'number' ? entry.groupId === arg1 : this.editorHelper.matchesEditor(arg1, entry.editor);
|
|
1245
|
+
if (matches) {
|
|
1246
|
+
this.editorHelper.clearOnEditorDispose(entry.editor, this.mapEditorToDisposable);
|
|
1247
|
+
}
|
|
1248
|
+
return !matches;
|
|
1249
|
+
});
|
|
1250
|
+
if (previousStackSize === this.stack.length) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
this.flatten();
|
|
1254
|
+
this.index = this.stack.length - 1;
|
|
1255
|
+
this.previousIndex = -1;
|
|
1256
|
+
if (typeof arg1 === 'number') {
|
|
1257
|
+
this.mapGroupToDisposable.get(arg1)?.dispose();
|
|
1258
|
+
this.mapGroupToDisposable.delete(arg1);
|
|
1259
|
+
}
|
|
1260
|
+
this._onDidChange.fire();
|
|
1261
|
+
}
|
|
1262
|
+
flatten() {
|
|
1263
|
+
const flattenedStack = [];
|
|
1264
|
+
let previousEntry = undefined;
|
|
1265
|
+
for (const entry of this.stack) {
|
|
1266
|
+
if (previousEntry && this.shouldReplaceStackEntry(entry, previousEntry)) {
|
|
1267
|
+
continue;
|
|
1268
|
+
}
|
|
1269
|
+
previousEntry = entry;
|
|
1270
|
+
flattenedStack.push(entry);
|
|
1271
|
+
}
|
|
1272
|
+
this.stack = flattenedStack;
|
|
1273
|
+
}
|
|
1274
|
+
clear() {
|
|
1275
|
+
this.index = -1;
|
|
1276
|
+
this.previousIndex = -1;
|
|
1277
|
+
this.stack.splice(0);
|
|
1278
|
+
for (const [, disposable] of this.mapEditorToDisposable) {
|
|
1279
|
+
dispose(disposable);
|
|
1280
|
+
}
|
|
1281
|
+
this.mapEditorToDisposable.clear();
|
|
1282
|
+
for (const [, disposable] of this.mapGroupToDisposable) {
|
|
1283
|
+
dispose(disposable);
|
|
1284
|
+
}
|
|
1285
|
+
this.mapGroupToDisposable.clear();
|
|
1286
|
+
}
|
|
1287
|
+
dispose() {
|
|
1288
|
+
super.dispose();
|
|
1289
|
+
this.clear();
|
|
1290
|
+
}
|
|
1291
|
+
canGoForward() {
|
|
1292
|
+
return this.stack.length > this.index + 1;
|
|
1293
|
+
}
|
|
1294
|
+
async goForward() {
|
|
1295
|
+
const navigated = await this.maybeGoCurrent();
|
|
1296
|
+
if (navigated) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
if (!this.canGoForward()) {
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
this.setIndex(this.index + 1);
|
|
1303
|
+
return this.navigate();
|
|
1304
|
+
}
|
|
1305
|
+
canGoBack() {
|
|
1306
|
+
return this.index > 0;
|
|
1307
|
+
}
|
|
1308
|
+
async goBack() {
|
|
1309
|
+
const navigated = await this.maybeGoCurrent();
|
|
1310
|
+
if (navigated) {
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
if (!this.canGoBack()) {
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
this.setIndex(this.index - 1);
|
|
1317
|
+
return this.navigate();
|
|
1318
|
+
}
|
|
1319
|
+
async goPrevious() {
|
|
1320
|
+
const navigated = await this.maybeGoCurrent();
|
|
1321
|
+
if (navigated) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
if (this.previousIndex === -1) {
|
|
1325
|
+
return this.goBack();
|
|
1326
|
+
}
|
|
1327
|
+
this.setIndex(this.previousIndex);
|
|
1328
|
+
return this.navigate();
|
|
1329
|
+
}
|
|
1330
|
+
canGoLast() {
|
|
1331
|
+
return this.stack.length > 0;
|
|
1332
|
+
}
|
|
1333
|
+
async goLast() {
|
|
1334
|
+
if (!this.canGoLast()) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
this.setIndex(this.stack.length - 1);
|
|
1338
|
+
return this.navigate();
|
|
1339
|
+
}
|
|
1340
|
+
async maybeGoCurrent() {
|
|
1341
|
+
if (this.filter === 0 ) {
|
|
1342
|
+
return false;
|
|
1343
|
+
}
|
|
1344
|
+
if (this.isCurrentSelectionActive()) {
|
|
1345
|
+
return false;
|
|
1346
|
+
}
|
|
1347
|
+
await this.navigate();
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
isCurrentSelectionActive() {
|
|
1351
|
+
if (!this.current?.selection) {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
const pane = this.editorService.activeEditorPane;
|
|
1355
|
+
if (!isEditorPaneWithSelection(pane)) {
|
|
1356
|
+
return false;
|
|
1357
|
+
}
|
|
1358
|
+
if (pane.group.id !== this.current.groupId) {
|
|
1359
|
+
return false;
|
|
1360
|
+
}
|
|
1361
|
+
if (!pane.input || !this.editorHelper.matchesEditor(pane.input, this.current.editor)) {
|
|
1362
|
+
return false;
|
|
1363
|
+
}
|
|
1364
|
+
const paneSelection = pane.getSelection();
|
|
1365
|
+
if (!paneSelection) {
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1368
|
+
return paneSelection.compare(this.current.selection) === 1 ;
|
|
1369
|
+
}
|
|
1370
|
+
setIndex(newIndex, skipEvent) {
|
|
1371
|
+
this.previousIndex = this.index;
|
|
1372
|
+
this.index = newIndex;
|
|
1373
|
+
if (!skipEvent) {
|
|
1374
|
+
this._onDidChange.fire();
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
async navigate() {
|
|
1378
|
+
this.navigating = true;
|
|
1379
|
+
try {
|
|
1380
|
+
if (this.current) {
|
|
1381
|
+
await this.doNavigate(this.current);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
finally {
|
|
1385
|
+
this.navigating = false;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
doNavigate(location) {
|
|
1389
|
+
let options = Object.create(null);
|
|
1390
|
+
if (location.selection) {
|
|
1391
|
+
options = location.selection.restore(options);
|
|
1392
|
+
}
|
|
1393
|
+
if (isEditorInput(location.editor)) {
|
|
1394
|
+
return this.editorService.openEditor(location.editor, options, location.groupId);
|
|
1395
|
+
}
|
|
1396
|
+
return this.editorService.openEditor({
|
|
1397
|
+
...location.editor,
|
|
1398
|
+
options: {
|
|
1399
|
+
...location.editor.options,
|
|
1400
|
+
...options
|
|
1401
|
+
}
|
|
1402
|
+
}, location.groupId);
|
|
1403
|
+
}
|
|
1404
|
+
isNavigating() {
|
|
1405
|
+
return this.navigating;
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
EditorNavigationStack = EditorNavigationStack_1 = ( __decorate([
|
|
1409
|
+
( __param(2, IInstantiationService)),
|
|
1410
|
+
( __param(3, IEditorService)),
|
|
1411
|
+
( __param(4, IEditorGroupsService)),
|
|
1412
|
+
( __param(5, ILogService))
|
|
1413
|
+
], EditorNavigationStack));
|
|
1414
|
+
let EditorHelper = class EditorHelper {
|
|
1415
|
+
constructor(uriIdentityService, lifecycleService, fileService, pathService) {
|
|
1416
|
+
this.uriIdentityService = uriIdentityService;
|
|
1417
|
+
this.lifecycleService = lifecycleService;
|
|
1418
|
+
this.fileService = fileService;
|
|
1419
|
+
this.pathService = pathService;
|
|
1420
|
+
}
|
|
1421
|
+
preferResourceEditorInput(editor) {
|
|
1422
|
+
const resource = EditorResourceAccessor.getOriginalUri(editor);
|
|
1423
|
+
const hasValidResourceEditorInputScheme = resource?.scheme === Schemas.file ||
|
|
1424
|
+
resource?.scheme === Schemas.vscodeRemote ||
|
|
1425
|
+
resource?.scheme === Schemas.vscodeUserData ||
|
|
1426
|
+
resource?.scheme === this.pathService.defaultUriScheme;
|
|
1427
|
+
if (hasValidResourceEditorInputScheme) {
|
|
1428
|
+
if (isEditorInput(editor)) {
|
|
1429
|
+
const untypedInput = editor.toUntyped();
|
|
1430
|
+
if (isResourceEditorInput(untypedInput)) {
|
|
1431
|
+
return untypedInput;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return editor;
|
|
1435
|
+
}
|
|
1436
|
+
else {
|
|
1437
|
+
return isEditorInput(editor) ? editor : undefined;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
matchesEditor(arg1, inputB) {
|
|
1441
|
+
if (arg1 instanceof FileChangesEvent || arg1 instanceof FileOperationEvent) {
|
|
1442
|
+
if (isEditorInput(inputB)) {
|
|
1443
|
+
return false;
|
|
1444
|
+
}
|
|
1445
|
+
if (arg1 instanceof FileChangesEvent) {
|
|
1446
|
+
return arg1.contains(inputB.resource, 2 );
|
|
1447
|
+
}
|
|
1448
|
+
return this.matchesFile(inputB.resource, arg1);
|
|
1449
|
+
}
|
|
1450
|
+
if (isEditorInput(arg1)) {
|
|
1451
|
+
if (isEditorInput(inputB)) {
|
|
1452
|
+
return arg1.matches(inputB);
|
|
1453
|
+
}
|
|
1454
|
+
return this.matchesFile(inputB.resource, arg1);
|
|
1455
|
+
}
|
|
1456
|
+
if (isEditorInput(inputB)) {
|
|
1457
|
+
return this.matchesFile(arg1.resource, inputB);
|
|
1458
|
+
}
|
|
1459
|
+
return arg1 && inputB && this.uriIdentityService.extUri.isEqual(arg1.resource, inputB.resource);
|
|
1460
|
+
}
|
|
1461
|
+
matchesFile(resource, arg2) {
|
|
1462
|
+
if (arg2 instanceof FileChangesEvent) {
|
|
1463
|
+
return arg2.contains(resource, 2 );
|
|
1464
|
+
}
|
|
1465
|
+
if (arg2 instanceof FileOperationEvent) {
|
|
1466
|
+
return this.uriIdentityService.extUri.isEqualOrParent(resource, arg2.resource);
|
|
1467
|
+
}
|
|
1468
|
+
if (isEditorInput(arg2)) {
|
|
1469
|
+
const inputResource = arg2.resource;
|
|
1470
|
+
if (!inputResource) {
|
|
1471
|
+
return false;
|
|
1472
|
+
}
|
|
1473
|
+
if (this.lifecycleService.phase >= 3 && !this.fileService.hasProvider(inputResource)) {
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
return this.uriIdentityService.extUri.isEqual(inputResource, resource);
|
|
1477
|
+
}
|
|
1478
|
+
return this.uriIdentityService.extUri.isEqual(arg2?.resource, resource);
|
|
1479
|
+
}
|
|
1480
|
+
matchesEditorIdentifier(identifier, editorPane) {
|
|
1481
|
+
if (!editorPane?.group) {
|
|
1482
|
+
return false;
|
|
1483
|
+
}
|
|
1484
|
+
if (identifier.groupId !== editorPane.group.id) {
|
|
1485
|
+
return false;
|
|
1486
|
+
}
|
|
1487
|
+
return editorPane.input ? identifier.editor.matches(editorPane.input) : false;
|
|
1488
|
+
}
|
|
1489
|
+
onEditorDispose(editor, listener, mapEditorToDispose) {
|
|
1490
|
+
const toDispose = Event.once(editor.onWillDispose)(() => listener());
|
|
1491
|
+
let disposables = mapEditorToDispose.get(editor);
|
|
1492
|
+
if (!disposables) {
|
|
1493
|
+
disposables = ( new DisposableStore());
|
|
1494
|
+
mapEditorToDispose.set(editor, disposables);
|
|
1495
|
+
}
|
|
1496
|
+
disposables.add(toDispose);
|
|
1497
|
+
}
|
|
1498
|
+
clearOnEditorDispose(editor, mapEditorToDispose) {
|
|
1499
|
+
if (!isEditorInput(editor)) {
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
const disposables = mapEditorToDispose.get(editor);
|
|
1503
|
+
if (disposables) {
|
|
1504
|
+
dispose(disposables);
|
|
1505
|
+
mapEditorToDispose.delete(editor);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
EditorHelper = ( __decorate([
|
|
1510
|
+
( __param(0, IUriIdentityService)),
|
|
1511
|
+
( __param(1, ILifecycleService)),
|
|
1512
|
+
( __param(2, IFileService)),
|
|
1513
|
+
( __param(3, IPathService))
|
|
1514
|
+
], EditorHelper));
|
|
1515
|
+
|
|
1516
|
+
export { EditorNavigationStack, HistoryService };
|