vscode 扩展 onDidChangeCursorPosition

vscode extension onDidChangeCursorPosition

我正在开发一个 vscode 扩展,我想提供类似括号匹配装饰的东西。我的问题是我需要注册 onDidChangeCursorPosition 但我不知道该怎么做。

我的目的是创建一个只有当光标在上面时才会出现的装饰。

没有onDidChangeCursorPosition这样的事件。但是,您可以使用 onDidChangeTextEditorSelection. The onDidChangeTextEditorSelection is actually a field on the vscode's window object and you can assign your own function to it which gets called when this event is sent. Look at my extension(或许多其他这样做的人)来学习如何处理光标更改事件。