|
6 | 6 | import { localize } from 'vs/nls'; |
7 | 7 | import { URI } from 'vs/base/common/uri'; |
8 | 8 | import { distinct, deepClone, assign } from 'vs/base/common/objects'; |
9 | | -import { isObject, assertIsDefined, withNullAsUndefined } from 'vs/base/common/types'; |
| 9 | +import { isObject, assertIsDefined, withNullAsUndefined, isFunction } from 'vs/base/common/types'; |
10 | 10 | import { Dimension } from 'vs/base/browser/dom'; |
11 | 11 | import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; |
12 | | -import { EditorInput, EditorOptions, IEditorMemento, ITextEditor, SaveReason } from 'vs/workbench/common/editor'; |
| 12 | +import { EditorInput, EditorOptions, IEditorMemento, ITextEditor, SaveReason, TextEditorOptions } from 'vs/workbench/common/editor'; |
13 | 13 | import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; |
14 | | -import { IEditorViewState, IEditor } from 'vs/editor/common/editorCommon'; |
| 14 | +import { IEditorViewState, IEditor, ScrollType } from 'vs/editor/common/editorCommon'; |
15 | 15 | import { IStorageService } from 'vs/platform/storage/common/storage'; |
16 | 16 | import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; |
17 | 17 | import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; |
@@ -202,6 +202,14 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor { |
202 | 202 | editorContainer.setAttribute('aria-label', this.computeAriaLabel()); |
203 | 203 | } |
204 | 204 |
|
| 205 | + setOptions(options: EditorOptions | undefined): void { |
| 206 | + const textOptions = options as TextEditorOptions; |
| 207 | + if (textOptions && isFunction(textOptions.apply)) { |
| 208 | + const textEditor = assertIsDefined(this.getControl()); |
| 209 | + textOptions.apply(textEditor, ScrollType.Smooth); |
| 210 | + } |
| 211 | + } |
| 212 | + |
205 | 213 | protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void { |
206 | 214 |
|
207 | 215 | // Pass on to Editor |
|
0 commit comments