Skip to content

Commit b85927d

Browse files
committed
cleaning the code
1 parent ad3b07c commit b85927d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class InteractiveEditorController implements IEditorContribution {
197197
assertType(this._activeSession);
198198
const selectionRange = this._activeSession.wholeRange.value;
199199
const widgetPosition = this._strategy?.getWidgetPosition(initialRender, selectionRange, hasEditResponse);
200-
this._zone.value.showWidget(selectionRange, widgetPosition);
200+
this._zone.value.showWidget(widgetPosition ?? selectionRange.getStartPosition());
201201
}
202202

203203
protected async _nextState(state: State, options: InteractiveEditorRunOptions | undefined): Promise<void> {

src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -787,22 +787,22 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
787787
super._relayout(this._computeHeightInLines());
788788
}
789789

790-
showWidget(selectionRange: Range, position: Position | undefined): void {
791-
const widgetPosition = position ?? selectionRange.getEndPosition();
790+
showWidget(position: Position): void {
791+
const widgetPosition = position;
792+
console.log('widgetPosition : ', widgetPosition);
792793
super.show(widgetPosition, this._computeHeightInLines());
793794
this.widget.focus();
794795
this._ctxVisible.set(true);
795-
this._setMargins(selectionRange, widgetPosition);
796+
this._setMargins(widgetPosition);
796797
}
797798

798-
private _setMargins(selectionRange: Range, position: Position): void {
799-
const positionLineNumber = position.lineNumber;
800-
const info = this.editor.getLayoutInfo();
801-
const startLineNumber = selectionRange.getStartPosition().lineNumber;
799+
private _setMargins(position: Position): void {
802800
const viewModel = this.editor._getViewModel();
803801
if (!viewModel) {
804802
return;
805803
}
804+
const positionLineNumber = position.lineNumber;
805+
const startLineNumber = viewModel.getCompletelyVisibleViewRange().startLineNumber;
806806
let indentationLineNumber;
807807
let indentationLevel;
808808
for (let lineNumber = positionLineNumber; lineNumber >= startLineNumber; lineNumber--) {
@@ -814,6 +814,7 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
814814
}
815815
}
816816
this._indentationWidth = this.editor.getOffsetForColumn(indentationLineNumber ?? positionLineNumber, indentationLevel ?? viewModel.getLineFirstNonWhitespaceColumn(positionLineNumber));
817+
const info = this.editor.getLayoutInfo();
817818
const marginWithoutIndentation = info.glyphMarginWidth + info.decorationsWidth + info.lineNumbersWidth;
818819
const marginWithIndentation = marginWithoutIndentation + this._indentationWidth;
819820
const isEnoughAvailableSpaceWithIndentation = this._availableSpaceGivenIndentation() > 400;

0 commit comments

Comments
 (0)