1
>
/*---------------------------------------------------------------------------------------------
history.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
7
>
import { IResourceEditorInput } from '../../../../platform/editor/common/editor.js';
8
>
import { GroupIdentifier } from '../../../common/editor.js';
9
>
import { EditorInput } from '../../../common/editor/editorInput.js';
10
>
import { URI } from '../../../../base/common/uri.js';
11
>
12
>
export const IHistoryService = createDecorator<IHistoryService>('historyService');
13
>
14
>
export const MOUSE_BACK_FORWARD_NAVIGATION_SETTING = 'workbench.editor.mouseBackForwardToNavigate';
15
>
16
>
/**
17
>
* Limit editor navigation to certain kinds.
18
>
*/
19
>
export const enum GoFilter {
20
>
21
>
/**
22
>
* Navigate between editor navigation history
23
>
* entries from any kind of navigation source.
24
>
*/
25
>
NONE,
26
>
27
>
/**
28
>
* Only navigate between editor navigation history
29
>
* entries that were resulting from edits.
30
>
*/
31
>
EDITS,
32
>
33
>
/**
34
>
* Only navigate between editor navigation history
35
>
* entries that were resulting from navigations, such
36
>
* as "Go to definition".
37
>
*/
38
>
NAVIGATION
39
>
}
40
>
41
>
/**
42
>
* Limit editor navigation to certain scopes.
43
>
*/
44
>
export const enum GoScope {
45
>
46
>
/**
47
>
* Navigate across all editors and editor groups.
48
>
*/
49
>
DEFAULT,
50
>
51
>
/**
52
>
* Navigate only in editors of the active editor group.
53
>
*/
54
>
EDITOR_GROUP,
55
>
56
>
/**
57
>
* Navigate only in the active editor.
58
>
*/
59
>
EDITOR
60
>
}
61
>
62
>
export interface IHistoryService {
63
>
64
>
readonly _serviceBrand: undefined;
65
>
66
>
/**
67
>
* Navigate forwards in editor navigation history.
68
>
*/
69
>
goForward(filter?: GoFilter): Promise<void>;
70
>
71
>
/**
72
>
* Navigate backwards in editor navigation history.
73
>
*/
74
>
goBack(filter?: GoFilter): Promise<void>;
75
>
76
>
/**
77
>
* Navigate between the current editor navigtion history entry
78
>
* and the previous one that was navigated to. This commands is
79
>
* like a toggle for `forward` and `back` to jump between 2 points
80
>
* in editor navigation history.
81
>
*/
82
>
goPrevious(filter?: GoFilter): Promise<void>;
83
>
84
>
/**
85
>
* Navigate to the last entry in editor navigation history.
86
>
*/
87
>
goLast(filter?: GoFilter): Promise<void>;
88
>
89
>
/**
90
>
* Re-opens the last closed editor if any.
91
>
*/
92
>
reopenLastClosedEditor(): Promise<void>;
93
>
94
>
/**
95
>
* Get the entire history of editors that were opened.
96
>
*/
97
>
getHistory(): readonly (EditorInput | IResourceEditorInput)[];
98
>
99
>
/**
100
>
* Removes an entry from history.
101
>
*/
102
>
removeFromHistory(input: EditorInput | IResourceEditorInput): void;
103
>
104
>
/**
105
>
* Looking at the editor history, returns the workspace root of the last file that was
106
>
* inside the workspace and part of the editor history.
107
>
*
108
>
* @param schemeFilter filter to restrict roots by scheme.
109
>
*/
110
>
getLastActiveWorkspaceRoot(schemeFilter?: string, authorityFilter?: string): URI | undefined;
111
>
112
>
/**
113
>
* Looking at the editor history, returns the resource of the last file that was opened.
114
>
*
115
>
* @param schemeFilter filter to restrict roots by scheme.
116
>
*/
117
>
getLastActiveFile(schemeFilter: string, authorityFilter?: string): URI | undefined;
118
>
119
>
/**
120
>
* Opens the next used editor if any.
121
>
*
122
>
* @param group optional indicator to scope to a specific group.
123
>
*/
124
>
openNextRecentlyUsedEditor(group?: GroupIdentifier): Promise<void>;
125
>
126
>
/**
127
>
* Opens the previously used editor if any.
128
>
*
129
>
* @param group optional indicator to scope to a specific group.
130
>
*/
131
>
openPreviouslyUsedEditor(group?: GroupIdentifier): Promise<void>;
132
>
133
>
/**
134
>
* Clears all history.
135
>
*/
136
>
clear(): void;
137
>
138
>
/**
139
>
* Clear list of recently opened editors.
140
>
*/
141
>
clearRecentlyOpened(): void;
142
>
}