more keybindings w copilot tests (#2875)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -624,6 +624,16 @@ export const copilotPlugin = (options: LanguageServerOptions): Extension => {
|
||||
},
|
||||
})
|
||||
|
||||
const rejectSuggestionCommand = (view: EditorView): boolean => {
|
||||
if (view.plugin === null) return false
|
||||
|
||||
// Get the current plugin from the map.
|
||||
const p = view.plugin(completionPlugin)
|
||||
if (p === null) return false
|
||||
|
||||
return p.rejectSuggestionCommand()
|
||||
}
|
||||
|
||||
const copilotAutocompleteKeymap: readonly KeyBinding[] = [
|
||||
{
|
||||
key: 'Tab',
|
||||
@ -639,27 +649,30 @@ export const copilotPlugin = (options: LanguageServerOptions): Extension => {
|
||||
},
|
||||
{
|
||||
key: 'Backspace',
|
||||
run: (view: EditorView): boolean => {
|
||||
if (view.plugin === null) return false
|
||||
|
||||
// Get the current plugin from the map.
|
||||
const p = view.plugin(completionPlugin)
|
||||
if (p === null) return false
|
||||
|
||||
return p.rejectSuggestionCommand()
|
||||
},
|
||||
run: rejectSuggestionCommand,
|
||||
},
|
||||
{
|
||||
key: 'Delete',
|
||||
run: (view: EditorView): boolean => {
|
||||
if (view.plugin === null) return false
|
||||
|
||||
// Get the current plugin from the map.
|
||||
const p = view.plugin(completionPlugin)
|
||||
if (p === null) return false
|
||||
|
||||
return p.rejectSuggestionCommand()
|
||||
},
|
||||
run: rejectSuggestionCommand,
|
||||
},
|
||||
{ key: 'Mod-z', run: rejectSuggestionCommand, preventDefault: true },
|
||||
{
|
||||
key: 'Mod-y',
|
||||
mac: 'Mod-Shift-z',
|
||||
run: rejectSuggestionCommand,
|
||||
preventDefault: true,
|
||||
},
|
||||
{
|
||||
linux: 'Ctrl-Shift-z',
|
||||
run: rejectSuggestionCommand,
|
||||
preventDefault: true,
|
||||
},
|
||||
{ key: 'Mod-u', run: rejectSuggestionCommand, preventDefault: true },
|
||||
{
|
||||
key: 'Alt-u',
|
||||
mac: 'Mod-Shift-u',
|
||||
run: rejectSuggestionCommand,
|
||||
preventDefault: true,
|
||||
},
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user