vscode 当输入括号时光标向左移动 ```markdown 当输入括号时光标向左移动 ```

mum43rcc  于 5个月前  发布在  Vscode
关注(0)|答案(6)|浏览(113)

这个问题在所有扩展都被禁用时是否发生?:是

  • VS Code 版本:1.83.0
  • OS 版本:Linux x64 3.10.0-1160.71.1.el7.x86_64

重现步骤:

  1. 打开新/现有文件,例如 python 脚本、makefile 等
  2. 在一行末尾(在一些代码之后),输入一个开方括号/花括号
  3. 在光标向左移动一个字符后插入括号
  4. 例如,当尝试输入 "field[]" 时,结果是 "fiel[d"
jdzmm42g

jdzmm42g1#

你好,alekob!
感谢你提出这个问题!
请尝试以下步骤:

  1. 运行命令 "Developer: 切换键盘快捷键故障排除"(例如,你可以从命令面板运行它)。
    这将激活已分派的键盘快捷键的日志记录,并将打开一个带有相应日志文件的输出面板。
  2. 按下你想要的快捷键
  3. 检查VS Code检测到的内容
    如果你对输出内容有困难理解,请随时粘贴在这里,我们会很乐意帮助你☺️
wnavrhmk

wnavrhmk2#

你好!
感谢关注此问题!以下是VS Code(1.842)在插入"["时输出的日志:

2023-12-05 13:10:45.064 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-12-05 13:10:45.065 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2023-12-05 13:10:45.066 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: ControlLeft, keyCode: 17, key: Control
2023-12-05 13:10:45.066 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: ControlLeft, keyCode: 5 ('Ctrl')
2023-12-05 13:10:45.067 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2023-12-05 13:10:46.056 [info] [KeybindingService]: + Ignoring single modifier alt due to it being pressed together with other keys.
2023-12-05 13:11:00.181 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-12-05 13:11:00.214 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2023-12-05 13:11:00.236 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: ControlLeft, keyCode: 17, key: Control
2023-12-05 13:11:00.236 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: ControlLeft, keyCode: 5 ('Ctrl')
2023-12-05 13:11:00.236 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2023-12-05 13:11:00.242 [info] [KeybindingService]: + Storing single modifier for possible chord ctrl.
2023-12-05 13:11:00.542 [info] [KeybindingService]: + Clearing single modifier due to 300ms elapsed.

2023-12-05 13:13:07.912 [info] [KeybindingService]: 键盘事件无法分派
2023-12-05 13:13:07.914 [info] [KeybindingService]: / 接收到按键事件 - 修饰符:[ctrl],代码:ControlLeft,键码:17,键:Control
2023-12-05 13:13:07.914 [info] [KeybindingService]: | 将按键事件转换为修饰符:[ctrl],代码:ControlLeft,键码:5 ('Ctrl')
2023-12-05 13:13:07.915 [info] [KeybindingService]: 键盘事件在按键阶段无法分派。
2023-12-05 13:13:07.925 [info] [KeybindingService]: + 存储单个修饰符以进行可能的和弦Shift。
2023-12-05 13:13:08.038 [info] [KeybindingService]: + 由于300ms经过,清除单个修饰符。
2023-12-05 13:13:08.153 [info] [KeybindingService]: + 存储单个修饰符以进行可能的和弦ctrl。
2023-12-05 13:13:08.454 [info] [KeybindingService]: + 由于300ms经过,清除单个修饰符。
2023-12-05 13:13:11.231 [info] [KeybindingService]: + 软分派键盘事件
2023-12-05 13:13:11.232 [info] [KeybindingService]: + 键盘事件无法分派
2023-12-05 13:13:11.232 [info] [KeybindingService]: + 接收到按键事件 - 修饰符:[ctrl],代码:ControlLeft,键码:17,键:Control
2023-12-05 13:13:11.232 [info] [KeybindingService]: | 将按键事件转换为修饰符:[ctrl],代码:ControlLeft,键码:5 ('Ctrl')
2023-12-05 13:13:11.233 [info] [KeybindingService]: + 由于按键阶段无法分派,忽略单个修饰符ctrl,因为它与其他键一起按下。
2023-12-05 13:13:26.577 [info] [KeybindingService]: + 软分派键盘事件
2023-12-05 13:13:26.578 [info] [KeybindingService]: + 键盘事件无法分派
2023-12-05 13:13:26.578 [info] [KeybindingService]: + 接收到按键事件 - 修饰符:[ctrl],代码:ControlLeft,键码:17,键:Control
2023-12-05 13:13:26.578 [info] [KeybindingService]: | 将按键事件转换为修饰符:[ctrl],代码:ControlLeft,键码:5 ('Ctrl')
2023-12-05 13:13:26.579 [info] [KeybindingService]: + 由于按键阶段无法分派,忽略单个修饰符ctrl,因为它与其他键一起按下。
2023-12-05 13:13:46.749 [info] [KeybindingService]: + 将命令editor.action.selectAll添加到快捷键列表中。
2023-12-05 13:13:46.749 [info] [KeybindingService]: + 由于没有when条件,忽略单个修饰符ctrl,因为它与另一个键一起按下。

wgxvkvu9

wgxvkvu93#

听起来像是来自https://stackoverflow.com/questions/67804948/vscode-cursor-moves-left-on-altgr-how-to-fix-it的问题。解决方法是将keyboard.dispatch设置为keyCode

h22fl7wq

h22fl7wq4#

你好,@scaidermern,感谢你的提示,这个设置确实解决了我的问题!😊

p8h8hvxi

p8h8hvxi5#

嘿,@ulugbekna,这个问题可能需要进一步关注。
@alekob,如果你发现问题已经不存在了,可以帮我们关闭这个问题,或者提供更多信息。

byqmnocz

byqmnocz6#

你好,在VS Code v1.89.0中,仍然需要将keyboard.dispatch设置为keyCode作为解决方法。默认值"code"仍然会导致问题。

相关问题