【发布时间】:2021-12-30 15:48:50
【问题描述】:
我通读了 API 文档并了解如何获取值,但不知道如何设置值。
例如,我想改变活动行(光标线)所以尝试更新editor.selection.active的值如下。
// get the current value
editor.selection.active
V {_line: 12, _character: 0}
// I tried to update the value
editor.selection.active.line = 3
3
// I was expecting this an updated value but unchanged
editor.selection.active
V {_line: 12, _character: 0}
但是和上面的 cmets 一样,它不会更新值,也不会改变活动行的位置。那么我该怎么做呢?谢谢。
【问题讨论】:
-
用于选择更新:使用您想要的选择创建一个新数组并将此数组分配给
editor.selections
标签: visual-studio-code vscode-extensions