Merge pull request #208432 from microsoft/tyriar/199734

Don't select all when opening quick chat with a query
This commit is contained in:
Daniel Imms 2024-03-22 12:59:45 -07:00 committed by GitHub
commit dc88e0164b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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();
}