show inline chat content widget above selection (#208997)

This commit is contained in:
Johannes Rieken 2024-03-28 11:21:33 +01:00 committed by GitHub
parent 94f7c1d971
commit edfd5b8ba5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View file

@ -124,7 +124,7 @@ export class InlineChatContentWidget implements IContentWidget {
}
return {
position: this._position,
preference: [ContentWidgetPositionPreference.BELOW]
preference: [ContentWidgetPositionPreference.ABOVE]
};
}

View file

@ -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 {