Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5

This commit is contained in:
ADS Merger
2020-02-08 04:50:58 +00:00
parent 8c61538a27
commit 2af13c18d2
752 changed files with 16458 additions and 10063 deletions

View File

@@ -557,6 +557,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._revealLine(lineNumber, VerticalRevealType.CenterIfOutsideViewport, scrollType);
}
public revealLineNearTop(lineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
this._revealLine(lineNumber, VerticalRevealType.NearTop, scrollType);
}
private _revealLine(lineNumber: number, revealType: VerticalRevealType, scrollType: editorCommon.ScrollType): void {
if (typeof lineNumber !== 'number') {
throw new Error('Invalid arguments');
@@ -597,6 +601,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
);
}
public revealPositionNearTop(position: IPosition, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
this._revealPosition(
position,
VerticalRevealType.NearTop,
true,
scrollType
);
}
private _revealPosition(position: IPosition, verticalType: VerticalRevealType, revealHorizontal: boolean, scrollType: editorCommon.ScrollType): void {
if (!Position.isIPosition(position)) {
throw new Error('Invalid arguments');
@@ -685,6 +698,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
);
}
public revealLinesNearTop(startLineNumber: number, endLineNumber: number, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
this._revealLines(
startLineNumber,
endLineNumber,
VerticalRevealType.NearTop,
scrollType
);
}
private _revealLines(startLineNumber: number, endLineNumber: number, verticalType: VerticalRevealType, scrollType: editorCommon.ScrollType): void {
if (typeof startLineNumber !== 'number' || typeof endLineNumber !== 'number') {
throw new Error('Invalid arguments');
@@ -725,6 +747,15 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
);
}
public revealRangeNearTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
this._revealRange(
range,
VerticalRevealType.NearTop,
true,
scrollType
);
}
public revealRangeAtTop(range: IRange, scrollType: editorCommon.ScrollType = editorCommon.ScrollType.Smooth): void {
this._revealRange(
range,
@@ -1613,6 +1644,7 @@ export class BooleanEventEmitter extends Disposable {
class EditorContextKeysManager extends Disposable {
private readonly _editor: CodeEditorWidget;
private readonly _editorSimpleInput: IContextKey<boolean>;
private readonly _editorFocus: IContextKey<boolean>;
private readonly _textInputFocus: IContextKey<boolean>;
private readonly _editorTextFocus: IContextKey<boolean>;
@@ -1632,6 +1664,8 @@ class EditorContextKeysManager extends Disposable {
this._editor = editor;
contextKeyService.createKey('editorId', editor.getId());
this._editorSimpleInput = EditorContextKeys.editorSimpleInput.bindTo(contextKeyService);
this._editorFocus = EditorContextKeys.focus.bindTo(contextKeyService);
this._textInputFocus = EditorContextKeys.textInputFocus.bindTo(contextKeyService);
this._editorTextFocus = EditorContextKeys.editorTextFocus.bindTo(contextKeyService);
@@ -1655,6 +1689,8 @@ class EditorContextKeysManager extends Disposable {
this._updateFromSelection();
this._updateFromFocus();
this._updateFromModel();
this._editorSimpleInput.set(this._editor.isSimpleWidget);
}
private _updateFromConfig(): void {