Using with AI code suggestions - 71/dance GitHub Wiki
AI code suggestions typically require pressing Tab or Escape to accept or dismiss them, which can lead to conflicts with Dance's own keybindings.
This can be improved with the following keybindings, which make Dance only accept Escape when no suggestion is being shown:
{
"key": "escape",
"command": "dance.modes.set.normal",
"when": "editorTextFocus && dance.mode == 'insert' && !nextEditSessionAvailable"
},
{
"key": "escape",
"command": "-dance.modes.set.normal",
"when": "editorTextFocus && dance.mode == 'insert'"
},
{
"key": "escape",
"command": "dance.modes.set.normal",
"when": "editorTextFocus && dance.mode == 'select' && !nextEditSessionAvailable"
},
{
"key": "escape",
"command": "-dance.modes.set.normal",
"when": "editorTextFocus && dance.mode == 'select'"
},
[!NOTE] This was tested with Gemini Code completions; the context key
nextEditSessionAvailablemay be different with other assistants. In my case, I found the needed key by using the "Developer: Inspect Context Keys" command with and without suggestions, and diffing the context keys with:for (const k of new Set([...Object.keys(temp1), ...Object.keys(temp2)])) { const v1 = temp1[k]; const v2 = temp2[k]; if (JSON.stringify(v1) !== JSON.stringify(v2)) { console.log(k, v1, v2) } }