mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
This commit is contained in:
parent
50701eee93
commit
29f0d108bf
|
@ -48,7 +48,7 @@ declare namespace monaco.editor {
|
|||
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
||||
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
||||
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||
export interface ICommandHandler {
|
||||
(...args: any[]): void;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as platform from 'vs/base/common/platform';
|
|||
import { CharWidthRequest, CharWidthRequestType, readCharWidths } from 'vs/editor/browser/config/charWidthReader';
|
||||
import { ElementSizeObserver } from 'vs/editor/browser/config/elementSizeObserver';
|
||||
import { CommonEditorConfiguration, IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
|
||||
import { IEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { EditorOption, IEditorConstructionOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { IDimension } from 'vs/editor/common/editorCommon';
|
||||
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
|
||||
|
@ -310,13 +310,13 @@ export class Configuration extends CommonEditorConfiguration {
|
|||
|
||||
constructor(
|
||||
isSimpleWidget: boolean,
|
||||
options: IEditorOptions,
|
||||
options: IEditorConstructionOptions,
|
||||
referenceDomElement: HTMLElement | null = null,
|
||||
private readonly accessibilityService: IAccessibilityService
|
||||
) {
|
||||
super(isSimpleWidget, options);
|
||||
|
||||
this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged()));
|
||||
this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, options.dimension, () => this._onReferenceDomElementSizeChanged()));
|
||||
|
||||
this._register(CSSBasedConfiguration.INSTANCE.onDidChange(() => this._onCSSBasedConfigurationChanged()));
|
||||
|
||||
|
|
|
@ -14,14 +14,14 @@ export class ElementSizeObserver extends Disposable {
|
|||
private width: number;
|
||||
private height: number;
|
||||
|
||||
constructor(referenceDomElement: HTMLElement | null, changeCallback: () => void) {
|
||||
constructor(referenceDomElement: HTMLElement | null, dimension: IDimension | undefined, changeCallback: () => void) {
|
||||
super();
|
||||
this.referenceDomElement = referenceDomElement;
|
||||
this.changeCallback = changeCallback;
|
||||
this.measureReferenceDomElementToken = -1;
|
||||
this.width = -1;
|
||||
this.height = -1;
|
||||
this.measureReferenceDomElement(false);
|
||||
this.measureReferenceDomElement(false, dimension);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
|
@ -75,4 +75,4 @@ export class ElementSizeObserver extends Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
|
|||
import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
|
||||
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
|
||||
import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, IEditorConstructionOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { Cursor, CursorStateChangedEvent } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorColumns, ICursors } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
|
@ -236,7 +236,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: IEditorOptions,
|
||||
options: IEditorConstructionOptions,
|
||||
codeEditorWidgetOptions: ICodeEditorWidgetOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
|
@ -329,7 +329,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
this._codeEditorService.addCodeEditor(this);
|
||||
}
|
||||
|
||||
protected _createConfiguration(options: IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
protected _createConfiguration(options: IEditorConstructionOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
return new Configuration(this.isSimpleWidget, options, this._domElement, accessibilityService);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
|
|||
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IDimension } from 'vs/editor/common/editorCommon';
|
||||
|
||||
//#region typed options
|
||||
|
||||
|
@ -516,6 +517,13 @@ export interface IEditorOptions {
|
|||
showUnused?: boolean;
|
||||
}
|
||||
|
||||
export interface IEditorConstructionOptions extends IEditorOptions {
|
||||
/**
|
||||
* The initial editor dimension (to avoid measuring the container).
|
||||
*/
|
||||
dimension?: IDimension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for the diff editor.
|
||||
*/
|
||||
|
|
|
@ -280,6 +280,8 @@ export interface IEditor {
|
|||
/**
|
||||
* Instructs the editor to remeasure its container. This method should
|
||||
* be called when the container of the editor gets resized.
|
||||
*
|
||||
* If a dimension is passed in, the passed in value will be used.
|
||||
*/
|
||||
layout(dimension?: IDimension): void;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { Selection } from 'vs/editor/common/core/selection';
|
|||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode';
|
||||
import { IEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { IStandaloneEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
@ -164,7 +164,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget {
|
|||
if (e.equals(KeyMod.CtrlCmd | KeyCode.KEY_H)) {
|
||||
alert(AccessibilityHelpNLS.openingDocs);
|
||||
|
||||
let url = (<IEditorConstructionOptions>this._editor.getRawOptions()).accessibilityHelpUrl;
|
||||
let url = (<IStandaloneEditorConstructionOptions>this._editor.getRawOptions()).accessibilityHelpUrl;
|
||||
if (typeof url === 'undefined') {
|
||||
url = 'https://go.microsoft.com/fwlink/?linkid=852450';
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
|
|||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
|
||||
import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IDiffEditorOptions, IEditorOptions, IEditorConstructionOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { InternalEditorAction } from 'vs/editor/common/editorAction';
|
||||
import { IModelChangedEvent } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
|
@ -79,7 +79,7 @@ export interface IActionDescriptor {
|
|||
/**
|
||||
* The options to create an editor.
|
||||
*/
|
||||
export interface IEditorConstructionOptions extends IEditorOptions {
|
||||
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions {
|
||||
/**
|
||||
* The initial model associated with this code editor.
|
||||
*/
|
||||
|
@ -158,7 +158,7 @@ export class StandaloneCodeEditor extends CodeEditorWidget implements IStandalon
|
|||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: IEditorConstructionOptions,
|
||||
options: IStandaloneEditorConstructionOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
@ICommandService commandService: ICommandService,
|
||||
|
@ -287,7 +287,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
|
|||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: IEditorConstructionOptions | undefined,
|
||||
options: IStandaloneEditorConstructionOptions | undefined,
|
||||
toDispose: IDisposable,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
|
|
|
@ -24,7 +24,7 @@ import { IWebWorkerOptions, MonacoWebWorker, createWebWorker as actualCreateWebW
|
|||
import * as standaloneEnums from 'vs/editor/common/standalone/standaloneEnums';
|
||||
import { Colorizer, IColorizerElementOptions, IColorizerOptions } from 'vs/editor/standalone/browser/colorizer';
|
||||
import { SimpleEditorModelResolverService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { IDiffEditorConstructionOptions, IEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor, StandaloneDiffEditor, StandaloneEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { IDiffEditorConstructionOptions, IStandaloneEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor, StandaloneDiffEditor, StandaloneEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { DynamicStandaloneServices, IEditorOverrideServices, StaticServices } from 'vs/editor/standalone/browser/standaloneServices';
|
||||
import { IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
|
@ -68,7 +68,7 @@ function withAllStandaloneServices<T extends editorCommon.IEditor>(domElement: H
|
|||
* `domElement` should be empty (not contain other dom nodes).
|
||||
* The editor will read the size of `domElement`.
|
||||
*/
|
||||
export function create(domElement: HTMLElement, options?: IEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor {
|
||||
export function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor {
|
||||
return withAllStandaloneServices(domElement, override || {}, (services) => {
|
||||
return new StandaloneEditor(
|
||||
domElement,
|
||||
|
|
|
@ -29,7 +29,7 @@ import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService
|
|||
export class TestCodeEditor extends CodeEditorWidget implements editorBrowser.ICodeEditor {
|
||||
|
||||
//#region testing overrides
|
||||
protected _createConfiguration(options: editorOptions.IEditorOptions): editorCommon.IConfiguration {
|
||||
protected _createConfiguration(options: editorOptions.IEditorConstructionOptions): editorCommon.IConfiguration {
|
||||
return new TestConfiguration(options);
|
||||
}
|
||||
protected _createView(viewModel: ViewModel, cursor: Cursor): [View, boolean] {
|
||||
|
|
13
src/vs/monaco.d.ts
vendored
13
src/vs/monaco.d.ts
vendored
|
@ -813,7 +813,7 @@ declare namespace monaco.editor {
|
|||
* `domElement` should be empty (not contain other dom nodes).
|
||||
* The editor will read the size of `domElement`.
|
||||
*/
|
||||
export function create(domElement: HTMLElement, options?: IEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
|
||||
export function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
|
||||
|
||||
/**
|
||||
* Emitted when an editor is created.
|
||||
|
@ -1051,7 +1051,7 @@ declare namespace monaco.editor {
|
|||
/**
|
||||
* The options to create an editor.
|
||||
*/
|
||||
export interface IEditorConstructionOptions extends IEditorOptions {
|
||||
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions {
|
||||
/**
|
||||
* The initial model associated with this code editor.
|
||||
*/
|
||||
|
@ -2061,6 +2061,8 @@ declare namespace monaco.editor {
|
|||
/**
|
||||
* Instructs the editor to remeasure its container. This method should
|
||||
* be called when the container of the editor gets resized.
|
||||
*
|
||||
* If a dimension is passed in, the passed in value will be used.
|
||||
*/
|
||||
layout(dimension?: IDimension): void;
|
||||
/**
|
||||
|
@ -2918,6 +2920,13 @@ declare namespace monaco.editor {
|
|||
showUnused?: boolean;
|
||||
}
|
||||
|
||||
export interface IEditorConstructionOptions extends IEditorOptions {
|
||||
/**
|
||||
* The initial editor dimension (to avoid measuring the container).
|
||||
*/
|
||||
dimension?: IDimension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for the diff editor.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue