Skip to content

Commit

Permalink
Fixes #48838: Add font zooming actions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Apr 27, 2018
1 parent 427334e commit 2c2e2a4
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/vs/editor/contrib/fontZoom/fontZoom.ts
@@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import * as nls from 'vs/nls';
import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorZoom } from 'vs/editor/common/config/editorZoom';

class EditorFontZoomIn extends EditorAction {

constructor() {
super({
id: 'editor.action.fontZoomIn',
label: nls.localize('EditorFontZoomIn.label', "Editor Font Zoom In"),
alias: 'Editor Font Zoom In',
precondition: null
});
}

public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() + 1);
}
}

class EditorFontZoomOut extends EditorAction {

constructor() {
super({
id: 'editor.action.fontZoomOut',
label: nls.localize('EditorFontZoomOut.label', "Editor Font Zoom Out"),
alias: 'Editor Font Zoom Out',
precondition: null
});
}

public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
EditorZoom.setZoomLevel(EditorZoom.getZoomLevel() - 1);
}
}

class EditorFontZoomReset extends EditorAction {

constructor() {
super({
id: 'editor.action.fontZoomReset',
label: nls.localize('EditorFontZoomReset.label', "Editor Font Zoom Reset"),
alias: 'Editor Font Zoom Reset',
precondition: null
});
}

public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
EditorZoom.setZoomLevel(0);
}
}

registerEditorAction(EditorFontZoomIn);
registerEditorAction(EditorFontZoomOut);
registerEditorAction(EditorFontZoomReset);
1 change: 1 addition & 0 deletions src/vs/editor/editor.all.ts
Expand Up @@ -22,6 +22,7 @@ import 'vs/editor/contrib/cursorUndo/cursorUndo';
import 'vs/editor/contrib/dnd/dnd';
import 'vs/editor/contrib/find/findController';
import 'vs/editor/contrib/folding/folding';
import 'vs/editor/contrib/fontZoom/fontZoom';
import 'vs/editor/contrib/format/formatActions';
import 'vs/editor/contrib/goToDeclaration/goToDeclarationCommands';
import 'vs/editor/contrib/goToDeclaration/goToDeclarationMouse';
Expand Down

0 comments on commit 2c2e2a4

Please sign in to comment.