Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/contrib/fontZoom/browser/fontZoom.ts
4779 views
1
/*---------------------------------------------------------------------------------------------
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 { ICodeEditor } from '../../../browser/editorBrowser.js';
7
import { EditorAction, registerEditorAction, ServicesAccessor } from '../../../browser/editorExtensions.js';
8
import { EditorZoom } from '../../../common/config/editorZoom.js';
9
import * as nls from '../../../../nls.js';
10
11
class EditorFontZoomIn extends EditorAction {
12
13
constructor() {
14
super({
15
id: 'editor.action.fontZoomIn',
16
label: nls.localize2('EditorFontZoomIn.label', "Increase Editor Font Size"),
17
precondition: undefined
18
});
19
}
20
21
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
22
EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() + 1);
23
}
24
}
25
26
class EditorFontZoomOut extends EditorAction {
27
28
constructor() {
29
super({
30
id: 'editor.action.fontZoomOut',
31
label: nls.localize2('EditorFontZoomOut.label', "Decrease Editor Font Size"),
32
precondition: undefined
33
});
34
}
35
36
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
37
EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() - 1);
38
}
39
}
40
41
class EditorFontZoomReset extends EditorAction {
42
43
constructor() {
44
super({
45
id: 'editor.action.fontZoomReset',
46
label: nls.localize2('EditorFontZoomReset.label', "Reset Editor Font Size"),
47
precondition: undefined
48
});
49
}
50
51
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
52
EditorZoom.setZoomLevel(0);
53
}
54
}
55
56
registerEditorAction(EditorFontZoomIn);
57
registerEditorAction(EditorFontZoomOut);
58
registerEditorAction(EditorFontZoomReset);
59
60