ai和自动补全, 他两的按键是冲突的. 所以我想拆开.

目标: 自动补全继续用tab, ai建议采纳改为enter.

  • 话不多说, 直接上代码, 这是核心代码:

  {
  "key": "tab",
  "command": "acceptSelectedSuggestion",
  "when": "(suggestWidgetVisible && textInputFocus) || (notebookEditorFocused && suggestWidgetVisible)"
  },
  {
    "key": "tab",
    "command": "-editor.action.inlineSuggest.commit",
    "when": "textInputFocus && inlineSuggestionVisible"
  },
  {
    "key": "tab",
    "command": "-github.copilot.acceptInlineSuggestion",
    "when": "editorTextFocus && inlineSuggestionVisible"
  },
  {
    "key": "enter",
    "command": "editor.action.inlineSuggest.commit",
    "when": "(inlineSuggestionVisible && textInputFocus && !suggestWidgetVisible) || (notebookEditorFocused && inlineSuggestionVisible && !suggestWidgetVisible)"
  },

  • 不核心的地方也很关键, 要避免冲突
 {
  "key": "tab",
  "command": "tab",
  "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus && !suggestWidgetVisible && !inlineSuggestionVisible"
 },
 {
  "key": "tab",
  "command": "editor.action.indentLines",
  "when": "editorTextFocus && !editorReadonly && !suggestWidgetVisible && !inlineSuggestionVisible && editorHasSelection"
 },

ai时代blog还有用吗?

  • 必须有用, 可以记录我们被ai忽悠的瞬间.

  • 比如这么个简单问题, grok陷入幻觉, 死活不行, 当然, 也和我们之间是网页对话有关, 他拿不到vscode本地的各种信息.