Difference between "acceptSelectedSuggestion" and "acceptAlternativeSelectedSuggestion" in VSCode keybinding config

huangapple go评论60阅读模式
英文:

Difference between "acceptSelectedSuggestion" and "acceptAlternativeSelectedSuggestion" in VSCode keybinding config

问题

我正在配置Visual Studio Code的键绑定。对于接受建议,有两个默认的键绑定,但我不知道为什么有acceptAlternativeSelectedSuggestionacceptSelectedSuggestion,因为它们似乎导致相同的效果。它们有什么区别?

{ 
  "key": "shift+tab",
  "command": "acceptAlternativeSelectedSuggestion",
  "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus" 
},
{ 
  "key": "tab",
  "command": "acceptSelectedSuggestion",
  "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
},
英文:

I'm configuring keybindings of Visual Studio Code. For accepting suggestions, two keybindings are set by default, but I have no idea why there are acceptAlternativeSelectedSuggestion and acceptSelectedSuggestion as they seem to cause the same effect. What is the difference?

{ 
  "key": "shift+tab",
  "command": "acceptAlternativeSelectedSuggestion",
  "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus" 
},
{ 
  "key": "tab",
  "command": "acceptSelectedSuggestion",
  "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
},

答案1

得分: 4

  • acceptSelectedSuggestion 在接受建议后会保留光标右侧的文本。

  • acceptAlternativeSelectedSuggestion 在接受建议后会移除光标右侧的文本。

如果需要进一步查看源代码,可以在以下文件中找到:

英文:

Experimentally, it affects what happens to the text to the right of the caret if the caret is in the middle of a word during completion.

  • acceptSelectedSuggestion causes the text to the right of the caret to be kept after the suggestion is accepted.

  • acceptAlternativeSelectedSuggestion causes the text to the right of the caret to be removed after the suggestion is accepted.

If you feel like further digging, the source code can be found in the following files:

huangapple
  • 本文由 发表于 2023年2月10日 02:47:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75403131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定