VS Code现在有一个api: window.onDidChangeTextEditorVisibleRanges
window.onDidChangeTextEditorVisibleRanges
这个事件是用一个 TextEditorVisibleRangesChangeEvent 宾语:
TextEditorVisibleRangesChangeEvent
export interface TextEditorVisibleRangesChangeEvent { /** * The text editor for which the visible ranges have changed. */ textEditor: TextEditor; /** * The new value for the text editor's visible ranges. */ visibleRanges: Range[]; }
VS Code的降价预览使用此事件将编辑器的滚动与降价预览同步。