mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Add Markdown Preview to Editor Scroll Syncronization
Adds an initial implementation of scroll synrconization from the markdown preview to the editor. When the preview is scrolled, automatically scrolls the editor to reveal the same location. This required adding a new supported reveal type `AtTop` in our API. This is already supported and used internally, but not really exposed in the public apis (except for the `revealLine` command).
This commit is contained in:
@@ -56,7 +56,8 @@ export interface IFocusTracker {
|
||||
export enum TextEditorRevealType {
|
||||
Default = 0,
|
||||
InCenter = 1,
|
||||
InCenterIfOutsideViewport = 2
|
||||
InCenterIfOutsideViewport = 2,
|
||||
AtTop = 3
|
||||
}
|
||||
|
||||
export interface IUndoStopOptions {
|
||||
@@ -288,14 +289,22 @@ export class MainThreadTextEditor {
|
||||
console.warn('revealRange on invisible editor');
|
||||
return;
|
||||
}
|
||||
if (revealType === TextEditorRevealType.Default) {
|
||||
this._codeEditor.revealRange(range);
|
||||
} else if (revealType === TextEditorRevealType.InCenter) {
|
||||
this._codeEditor.revealRangeInCenter(range);
|
||||
} else if (revealType === TextEditorRevealType.InCenterIfOutsideViewport) {
|
||||
this._codeEditor.revealRangeInCenterIfOutsideViewport(range);
|
||||
} else {
|
||||
console.warn('Unknown revealType');
|
||||
switch (revealType) {
|
||||
case TextEditorRevealType.Default:
|
||||
this._codeEditor.revealRange(range);
|
||||
break;
|
||||
case TextEditorRevealType.InCenter:
|
||||
this._codeEditor.revealRangeInCenter(range);
|
||||
break;;
|
||||
case TextEditorRevealType.InCenterIfOutsideViewport:
|
||||
this._codeEditor.revealRangeInCenterIfOutsideViewport(range);
|
||||
break;
|
||||
case TextEditorRevealType.AtTop:
|
||||
this._codeEditor.revealRangeAtTop(range);
|
||||
break;
|
||||
default:
|
||||
console.warn('Unknown revealType');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user