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