Path: blob/main/src/vs/editor/contrib/fontZoom/browser/fontZoom.ts
4779 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ICodeEditor } from '../../../browser/editorBrowser.js';6import { EditorAction, registerEditorAction, ServicesAccessor } from '../../../browser/editorExtensions.js';7import { EditorZoom } from '../../../common/config/editorZoom.js';8import * as nls from '../../../../nls.js';910class EditorFontZoomIn extends EditorAction {1112constructor() {13super({14id: 'editor.action.fontZoomIn',15label: nls.localize2('EditorFontZoomIn.label', "Increase Editor Font Size"),16precondition: undefined17});18}1920public run(accessor: ServicesAccessor, editor: ICodeEditor): void {21EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() + 1);22}23}2425class EditorFontZoomOut extends EditorAction {2627constructor() {28super({29id: 'editor.action.fontZoomOut',30label: nls.localize2('EditorFontZoomOut.label', "Decrease Editor Font Size"),31precondition: undefined32});33}3435public run(accessor: ServicesAccessor, editor: ICodeEditor): void {36EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() - 1);37}38}3940class EditorFontZoomReset extends EditorAction {4142constructor() {43super({44id: 'editor.action.fontZoomReset',45label: nls.localize2('EditorFontZoomReset.label', "Reset Editor Font Size"),46precondition: undefined47});48}4950public run(accessor: ServicesAccessor, editor: ICodeEditor): void {51EditorZoom.setZoomLevel(0);52}53}5455registerEditorAction(EditorFontZoomIn);56registerEditorAction(EditorFontZoomOut);57registerEditorAction(EditorFontZoomReset);585960