mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-06-16 17:05:07 -04:00
Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)
* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 * fix config changes * fix strictnull checks
This commit is contained in:
@@ -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 * as editorOptions from 'vs/editor/common/config/editorOptions';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById } 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';
|
||||
@@ -125,8 +125,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
private readonly _onDidChangeModelDecorations: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());
|
||||
public readonly onDidChangeModelDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeModelDecorations.event;
|
||||
|
||||
private readonly _onDidChangeConfiguration: Emitter<editorOptions.IConfigurationChangedEvent> = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
|
||||
private readonly _onDidChangeConfiguration: Emitter<ConfigurationChangedEvent> = this._register(new Emitter<ConfigurationChangedEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<ConfigurationChangedEvent> = this._onDidChangeConfiguration.event;
|
||||
|
||||
protected readonly _onDidChangeModel: Emitter<editorCommon.IModelChangedEvent> = this._register(new Emitter<editorCommon.IModelChangedEvent>());
|
||||
public readonly onDidChangeModel: Event<editorCommon.IModelChangedEvent> = this._onDidChangeModel.event;
|
||||
@@ -140,8 +140,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
private readonly _onDidAttemptReadOnlyEdit: Emitter<void> = this._register(new Emitter<void>());
|
||||
public readonly onDidAttemptReadOnlyEdit: Event<void> = this._onDidAttemptReadOnlyEdit.event;
|
||||
|
||||
private readonly _onDidLayoutChange: Emitter<editorOptions.EditorLayoutInfo> = this._register(new Emitter<editorOptions.EditorLayoutInfo>());
|
||||
public readonly onDidLayoutChange: Event<editorOptions.EditorLayoutInfo> = this._onDidLayoutChange.event;
|
||||
private readonly _onDidLayoutChange: Emitter<EditorLayoutInfo> = this._register(new Emitter<EditorLayoutInfo>());
|
||||
public readonly onDidLayoutChange: Event<EditorLayoutInfo> = this._onDidLayoutChange.event;
|
||||
|
||||
private readonly _editorTextFocus: BooleanEventEmitter = this._register(new BooleanEventEmitter());
|
||||
public readonly onDidFocusEditorText: Event<void> = this._editorTextFocus.onDidChangeToTrue;
|
||||
@@ -236,7 +236,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
|
||||
constructor(
|
||||
domElement: HTMLElement,
|
||||
options: editorOptions.IEditorOptions,
|
||||
options: IEditorOptions,
|
||||
codeEditorWidgetOptions: ICodeEditorWidgetOptions,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
@@ -259,10 +259,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._register(this._configuration.onDidChange((e) => {
|
||||
this._onDidChangeConfiguration.fire(e);
|
||||
|
||||
if (e.layoutInfo) {
|
||||
this._onDidLayoutChange.fire(this._configuration.editor.layoutInfo);
|
||||
const options = this._configuration.options;
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
this._onDidLayoutChange.fire(layoutInfo);
|
||||
}
|
||||
if (this._configuration.editor.showUnused) {
|
||||
if (options.get(EditorOption.showUnused)) {
|
||||
this._domElement.classList.add(SHOW_UNUSED_ENABLED_CLASS);
|
||||
} else {
|
||||
this._domElement.classList.remove(SHOW_UNUSED_ENABLED_CLASS);
|
||||
@@ -327,7 +329,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._codeEditorService.addCodeEditor(this);
|
||||
}
|
||||
|
||||
protected _createConfiguration(options: editorOptions.IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
protected _createConfiguration(options: IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
return new Configuration(this.isSimpleWidget, options, this._domElement, accessibilityService);
|
||||
}
|
||||
|
||||
@@ -362,15 +364,19 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return this._instantiationService.invokeFunction(fn);
|
||||
}
|
||||
|
||||
public updateOptions(newOptions: editorOptions.IEditorOptions): void {
|
||||
public updateOptions(newOptions: IEditorOptions): void {
|
||||
this._configuration.updateOptions(newOptions);
|
||||
}
|
||||
|
||||
public getConfiguration(): editorOptions.InternalEditorOptions {
|
||||
return this._configuration.editor;
|
||||
public getOptions(): IComputedEditorOptions {
|
||||
return this._configuration.options;
|
||||
}
|
||||
|
||||
public getRawConfiguration(): editorOptions.IEditorOptions {
|
||||
public getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T> {
|
||||
return this._configuration.options.get(id);
|
||||
}
|
||||
|
||||
public getRawOptions(): IEditorOptions {
|
||||
return this._configuration.getRawOptions();
|
||||
}
|
||||
|
||||
@@ -526,7 +532,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
const validatedModelRange = this._modelData.model.validateRange(modelRange);
|
||||
const viewRange = this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(validatedModelRange);
|
||||
|
||||
this._modelData.cursor.emitCursorRevealRange(viewRange, verticalType, revealHorizontal, scrollType);
|
||||
this._modelData.cursor.emitCursorRevealRange('api', viewRange, verticalType, revealHorizontal, scrollType);
|
||||
}
|
||||
|
||||
public revealLine(lineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
|
||||
@@ -972,7 +978,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return false;
|
||||
}
|
||||
if (this._configuration.editor.readOnly) {
|
||||
if (this._configuration.options.get(EditorOption.readOnly)) {
|
||||
// read only editor => sorry!
|
||||
return false;
|
||||
}
|
||||
@@ -984,7 +990,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return false;
|
||||
}
|
||||
if (this._configuration.editor.readOnly) {
|
||||
if (this._configuration.options.get(EditorOption.readOnly)) {
|
||||
// read only editor => sorry!
|
||||
return false;
|
||||
}
|
||||
@@ -1028,7 +1034,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
if (!this._modelData) {
|
||||
return null;
|
||||
}
|
||||
return this._modelData.model.getLineDecorations(lineNumber, this._id, this._configuration.editor.readOnly);
|
||||
return this._modelData.model.getLineDecorations(lineNumber, this._id, this._configuration.options.get(EditorOption.readOnly));
|
||||
}
|
||||
|
||||
public deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[] {
|
||||
@@ -1119,8 +1125,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
}
|
||||
|
||||
public getLayoutInfo(): editorOptions.EditorLayoutInfo {
|
||||
return this._configuration.editor.layoutInfo;
|
||||
public getLayoutInfo(): EditorLayoutInfo {
|
||||
const options = this._configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
return layoutInfo;
|
||||
}
|
||||
|
||||
public createOverviewRuler(cssClassName: string): editorBrowser.IOverviewRuler | null {
|
||||
@@ -1164,7 +1172,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
|
||||
public hasWidgetFocus(): boolean {
|
||||
return this._focusTracker && this._focusTracker.hasFocus();
|
||||
return (this._editorWidgetFocus.getValue() === BooleanEventValue.True);
|
||||
}
|
||||
|
||||
public addContentWidget(widget: editorBrowser.IContentWidget): void {
|
||||
@@ -1268,7 +1276,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
|
||||
const position = this._modelData.model.validatePosition(rawPosition);
|
||||
const layoutInfo = this._configuration.editor.layoutInfo;
|
||||
const options = this._configuration.options;
|
||||
const layoutInfo = options.get(EditorOption.layoutInfo);
|
||||
|
||||
const top = CodeEditorWidget._getVerticalOffsetForPosition(this._modelData, position.lineNumber, position.column) - this.getScrollTop();
|
||||
const left = this._modelData.view.getOffsetForColumn(position.lineNumber, position.column) + layoutInfo.glyphMarginWidth + layoutInfo.lineNumbersWidth + layoutInfo.decorationsWidth - this.getScrollLeft();
|
||||
@@ -1276,7 +1285,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return {
|
||||
top: top,
|
||||
left: left,
|
||||
height: this._configuration.editor.lineHeight
|
||||
height: options.get(EditorOption.lineHeight)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1295,7 +1304,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
|
||||
public applyFontInfo(target: HTMLElement): void {
|
||||
Configuration.applyFontInfoSlow(target, this._configuration.editor.fontInfo);
|
||||
Configuration.applyFontInfoSlow(target, this._configuration.options.get(EditorOption.fontInfo));
|
||||
}
|
||||
|
||||
protected _attachModel(model: ITextModel | null): void {
|
||||
@@ -1539,6 +1548,10 @@ export class BooleanEventEmitter extends Disposable {
|
||||
this._value = BooleanEventValue.NotSet;
|
||||
}
|
||||
|
||||
public getValue(): BooleanEventValue {
|
||||
return this._value;
|
||||
}
|
||||
|
||||
public setValue(_value: boolean) {
|
||||
const value = (_value ? BooleanEventValue.True : BooleanEventValue.False);
|
||||
if (this._value === value) {
|
||||
@@ -1601,10 +1614,10 @@ class EditorContextKeysManager extends Disposable {
|
||||
}
|
||||
|
||||
private _updateFromConfig(): void {
|
||||
const config = this._editor.getConfiguration();
|
||||
const options = this._editor.getOptions();
|
||||
|
||||
this._editorTabMovesFocus.set(config.tabFocusMode);
|
||||
this._editorReadonly.set(config.readOnly);
|
||||
this._editorTabMovesFocus.set(options.get(EditorOption.tabFocusMode));
|
||||
this._editorReadonly.set(options.get(EditorOption.readOnly));
|
||||
}
|
||||
|
||||
private _updateFromSelection(): void {
|
||||
|
||||
Reference in New Issue
Block a user