Skip to content

Commit

Permalink
show inline chat content widget above selection (#208992)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken authored Mar 28, 2024
1 parent 7caf8b6 commit 46b756b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class InlineChatContentWidget implements IContentWidget {
}
return {
position: this._position,
preference: [ContentWidgetPositionPreference.BELOW]
preference: [ContentWidgetPositionPreference.ABOVE]
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,14 @@ export class InlineChatController implements IEditorContribution {

} else if (initialRender) {
const selection = this._editor.getSelection();
widgetPosition = selection.getEndPosition();
if (Range.spansMultipleLines(selection) && widgetPosition.column === 1) {
// selection ends on "nothing" -> move up to match the
// rendered/visible part of the selection
widgetPosition = this._editor.getModel().validatePosition(widgetPosition.delta(-1, Number.MAX_SAFE_INTEGER));
}
widgetPosition = selection.getStartPosition();
// TODO@jrieken we are not ready for this
// widgetPosition = selection.getEndPosition();
// if (Range.spansMultipleLines(selection) && widgetPosition.column === 1) {
// // selection ends on "nothing" -> move up to match the
// // rendered/visible part of the selection
// widgetPosition = this._editor.getModel().validatePosition(widgetPosition.delta(-1, Number.MAX_SAFE_INTEGER));
// }
this._input.value.show(widgetPosition);

} else {
Expand Down

0 comments on commit 46b756b

Please sign in to comment.