From 46b756b8434730593b3c911fd1ca43366b29eb03 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 28 Mar 2024 11:01:40 +0100 Subject: [PATCH] show inline chat content widget above selection (#208992) --- .../inlineChat/browser/inlineChatContentWidget.ts | 2 +- .../inlineChat/browser/inlineChatController.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget.ts index b56b83cb2f28c..ac06027fce328 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget.ts @@ -124,7 +124,7 @@ export class InlineChatContentWidget implements IContentWidget { } return { position: this._position, - preference: [ContentWidgetPositionPreference.BELOW] + preference: [ContentWidgetPositionPreference.ABOVE] }; } diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts index 76dec4be363e6..ecbce151de7a9 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts @@ -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 {