@@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom';
7
7
import { Orientation , Sash } from 'vs/base/browser/ui/sash/sash' ;
8
8
import { disposableTimeout } from 'vs/base/common/async' ;
9
9
import { CancellationToken } from 'vs/base/common/cancellation' ;
10
- import { Emitter } from 'vs/base/common/event' ;
10
+ import { Emitter , Event } from 'vs/base/common/event' ;
11
11
import { Disposable , DisposableStore , IDisposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
12
12
import { Selection } from 'vs/editor/common/core/selection' ;
13
13
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
@@ -61,6 +61,14 @@ export class QuickChatService extends Disposable implements IQuickChatService {
61
61
this . close ( ) ;
62
62
} else {
63
63
this . open ( providerId , options ) ;
64
+ // If this is a partial query, the value should be cleared when closed as otherwise it
65
+ // would remain for the next time the quick chat is opened in any context.
66
+ if ( options ?. isPartialQuery ) {
67
+ const disposable = this . _store . add ( Event . once ( this . onDidClose ) ( ( ) => {
68
+ this . _currentChat ?. clearValue ( ) ;
69
+ this . _store . delete ( disposable ) ;
70
+ } ) ) ;
71
+ }
64
72
}
65
73
}
66
74
@@ -300,6 +308,10 @@ class QuickChat extends Disposable {
300
308
this . focus ( selection ) ;
301
309
}
302
310
311
+ clearValue ( ) : void {
312
+ this . widget . inputEditor . setValue ( '' ) ;
313
+ }
314
+
303
315
private updateModel ( ) : void {
304
316
this . model ??= this . chatService . startSession ( this . _options . providerId , CancellationToken . None ) ;
305
317
if ( ! this . model ) {
0 commit comments