Cursor 配置在同时有普通补全和 AI 补全时,优先触发普通补全:
{
"key": "tab",
"command": "-editor.action.acceptCursorTabSuggestion",
"when": "cpp.shouldAcceptTab"
},
{
"key": "tab",
"command": "editor.action.acceptCursorTabSuggestion",
"when": "cpp.shouldAcceptTab && !(suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus)"
},
原理就是,找到普通补全的 when 条件
{
"key": "tab",
"command": "acceptSelectedSuggestion",
"when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
}
取 not 加在 AI 补全的 when 条件后面
{
"key": "tab",
"command": "-editor.action.acceptCursorTabSuggestion",
"when": "cpp.shouldAcceptTab"
},
{
"key": "tab",
"command": "editor.action.acceptCursorTabSuggestion",
"when": "cpp.shouldAcceptTab && !(suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus)"
},
原理就是,找到普通补全的 when 条件
{
"key": "tab",
"command": "acceptSelectedSuggestion",
"when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
}
取 not 加在 AI 补全的 when 条件后面