Skip to content

Commit

Permalink
The move request should set the editor selection (microsoft#227204)
Browse files Browse the repository at this point in the history
fix microsoft/vscode-copilot#7848 because the newly created session picks up the editor selection as whole range which is later used to position the zone widget
  • Loading branch information
jrieken authored Aug 30, 2024
1 parent 97ef3ff commit 3dbbc0a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ export class InlineChatController implements IEditorContribution {

// if there's already a tab open for targetUri, show it and move inline chat to that tab
// otherwise, open the tab to the side
const editorPane = await this._editorService.openEditor({ resource: e.target }, SIDE_GROUP);
const initialSelection = Selection.fromRange(Range.lift(e.range), SelectionDirection.LTR);
const editorPane = await this._editorService.openEditor({ resource: e.target, options: { selection: initialSelection } }, SIDE_GROUP);

if (!editorPane) {
log('opening editor failed');
Expand All @@ -655,9 +656,8 @@ export class InlineChatController implements IEditorContribution {
},
CancellationToken.None); // TODO@ulugbekna: add proper cancellation?

const initialSelection = Selection.fromRange(Range.lift(e.range), SelectionDirection.LTR);

InlineChatController.get(newEditor)?.run({ initialSelection, existingSession: newSession });
InlineChatController.get(newEditor)?.run({ existingSession: newSession });

next = State.CANCEL;
responsePromise.complete();
Expand Down

0 comments on commit 3dbbc0a

Please sign in to comment.