VSCode扩展API - 滚动

时间:2017-12-06 21:04:25

标签: visual-studio-code vscode-extensions

在VSCode扩展API中滚动时是否有办法检测到。我看到的唯一可用功能是:

onDidChangeActiveTextEditor: Event<TextEditor>

onDidChangeTextEditorOptions: Event<TextEditorOptionsChangeEvent>

onDidChangeTextEditorSelection: Event<TextEditorSelectionChangeEvent>

onDidChangeTextEditorViewColumn: Event<TextEditorViewColumnChangeEvent>

onDidChangeVisibleTextEditors: Event<TextEditor[]>

onDidChangeWindowState: Event<WindowState>

onDidCloseTerminal: Event<Terminal>

我可以将其作为功能请求提交。但有没有办法规避这种行为?

1 个答案:

答案 0 :(得分:2)

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的降价预览使用此事件来同步滚动编辑器和降价预览。