在VSCode扩展API中滚动时,是否有方法可以检测到。我看到的唯一可用功能是:
onDidChangeActiveTextEditor: Event<TextEditor>
onDidChangeTextEditorOptions: Event<TextEditorOptionsChangeEvent>
onDidChangeTextEditorSelection: Event<TextEditorSelectionChangeEvent>
onDidChangeTextEditorViewColumn: Event<TextEditorViewColumnChangeEvent>
onDidChangeVisibleTextEditors: Event<TextEditor[]>
onDidChangeWindowState: Event<WindowState>
onDidCloseTerminal: Event<Terminal>
我可以将此作为功能请求。但是,有什么办法可以避免这种行为?
VS Code现在为此提供了一个api: window.onDidChangeTextEditorVisibleRanges
该事件由一个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的markdown预览使用此事件将编辑器的滚动与markdown预览同步。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句