Don't select all when opening quick chat with a query

Fixes #199734
This commit is contained in:
Daniel Imms 2024-03-22 09:05:54 -07:00
parent d848ebe222
commit 9d19dc1c2b
No known key found for this signature in database
GPG key ID: E5CF412B63651C69
2 changed files with 6 additions and 1 deletions

View file

@ -178,7 +178,10 @@ export function getQuickChatActionForProvider(id: string, label: string) {
override run(accessor: ServicesAccessor, query?: string): void {
const quickChatService = accessor.get(IQuickChatService);
quickChatService.toggle(id, query ? { query } : undefined);
quickChatService.toggle(id, query ? {
query,
selection: new Selection(1, query.length + 1, 1, query.length + 1)
} : undefined);
}
};
}

View file

@ -77,10 +77,12 @@ export class QuickChatService extends Disposable implements IQuickChatService {
open(providerId?: string, options?: IQuickChatOpenOptions): void {
if (this._input) {
if (this._currentChat && options?.query) {
this._currentChat.focus();
this._currentChat.setValue(options.query, options.selection);
if (!options.isPartialQuery) {
this._currentChat.acceptInput();
}
return;
}
return this.focus();
}