2

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"
},
starball
  • 20,030
  • 7
  • 43
  • 238
ywat
  • 2,757
  • 5
  • 24
  • 32

1 Answers1

4

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:

starball
  • 20,030
  • 7
  • 43
  • 238