-
Notifications
You must be signed in to change notification settings - Fork 27.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #48838: Add font zooming actions
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters