@@ -23,7 +23,7 @@ export class SlashCommandContentWidget extends Disposable implements IContentWid
23
23
this . _domNode . classList . add ( 'chat-slash-command-content-widget' ) ;
24
24
25
25
// If backspace at a slash command boundary, remove the slash command
26
- this . _register ( this . _editor . onKeyUp ( ( e ) => this . _handleKeyUp ( e ) ) ) ;
26
+ this . _register ( this . _editor . onKeyDown ( ( e ) => this . _handleKeyDown ( e ) ) ) ;
27
27
}
28
28
29
29
override dispose ( ) {
@@ -50,20 +50,20 @@ export class SlashCommandContentWidget extends Disposable implements IContentWid
50
50
getDomNode ( ) { return this . _domNode ; }
51
51
getPosition ( ) { return { position : { lineNumber : 1 , column : 1 } , preference : [ ContentWidgetPositionPreference . EXACT ] } ; }
52
52
53
- private _handleKeyUp ( e : IKeyboardEvent ) {
53
+ private _handleKeyDown ( e : IKeyboardEvent ) {
54
54
if ( e . keyCode !== KeyCode . Backspace ) {
55
55
return ;
56
56
}
57
57
58
58
const firstLine = this . _editor . getModel ( ) ?. getLineContent ( 1 ) ;
59
59
const selection = this . _editor . getSelection ( ) ;
60
- const withSlash = `/${ this . _lastSlashCommandText } ` ;
60
+ const withSlash = `/${ this . _lastSlashCommandText } ` ;
61
61
if ( ! firstLine ?. startsWith ( withSlash ) || ! selection ?. isEmpty ( ) || selection ?. startLineNumber !== 1 || selection ?. startColumn !== withSlash . length + 1 ) {
62
62
return ;
63
63
}
64
64
65
65
// Allow to undo the backspace
66
- this . _editor . executeEdits ( 'inline- chat-slash-command' , [ {
66
+ this . _editor . executeEdits ( 'chat-slash-command' , [ {
67
67
range : new Range ( 1 , 1 , 1 , selection . startColumn ) ,
68
68
text : null
69
69
} ] ) ;
0 commit comments