简体   繁体   English

VSCode扩展API - 滚动

[英]VSCode Extension API - on scroll

Is there a way to detected when scrolling in the VSCode extension API. 在VSCode扩展API中滚动时是否有一种方法可以检测到。 The only available functions I see are: 我看到的唯一可用功能是:

onDidChangeActiveTextEditor: Event<TextEditor>

onDidChangeTextEditorOptions: Event<TextEditorOptionsChangeEvent>

onDidChangeTextEditorSelection: Event<TextEditorSelectionChangeEvent>

onDidChangeTextEditorViewColumn: Event<TextEditorViewColumnChangeEvent>

onDidChangeVisibleTextEditors: Event<TextEditor[]>

onDidChangeWindowState: Event<WindowState>

onDidCloseTerminal: Event<Terminal>

I can file this as a feature request. 我可以将其作为功能请求提交。 But is there any way to circumvent this behavior? 但有没有办法规避这种行为?

VS Code now has an api for this: window.onDidChangeTextEditorVisibleRanges VS Code现在有一个api: window.onDidChangeTextEditorVisibleRanges

This event is fired with an TextEditorVisibleRangesChangeEvent object: 使用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's markdown preview uses this event to synchronize the scrolling of the editor with the markdown preview. VS Code的降价预览使用此事件将编辑器的滚动与降价预览同步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM