Skip to content

Commit

Permalink
Notebook chat editing enhancements. (#205799)
Browse files Browse the repository at this point in the history
* Notebook chat editing enhancements.

* hide cell chat actions from f1.
  • Loading branch information
rebornix authored Feb 21, 2024
1 parent a7002f6 commit ee69e28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ registerAction2(class extends NotebookAction {
}
]
},
f1: false,
menu: [
{
id: MenuId.NotebookCellBetween,
Expand Down Expand Up @@ -454,6 +455,7 @@ registerAction2(class extends NotebookAction {
original: '$(sparkle) Generate',
},
tooltip: localize('notebookActions.menu.insertCodeCellWithChat.tooltip', "Generate Code Cell with Chat"),
f1: false,
menu: [
{
id: MenuId.NotebookCellListTop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export class NotebookChatController extends Disposable implements INotebookEdito
const cellTop = this._notebookEditor.getAbsoluteTopOfElement(previousCell);
const cellHeight = this._notebookEditor.getHeightOfElement(previousCell);

this._notebookEditor.revealOffsetInCenterIfOutsideViewport(cellTop + cellHeight);
this._notebookEditor.revealOffsetInCenterIfOutsideViewport(cellTop + cellHeight + 48 /** center of the dialog */);
}
}
}
Expand Down Expand Up @@ -412,6 +412,12 @@ export class NotebookChatController extends Disposable implements INotebookEdito
return;
}

if (this._widget.editingCell && this._widget.editingCell.textBuffer.getLength() > 0) {
// it already contains some text, clear it
const ref = await this._widget.editingCell.resolveTextModel();
ref.setValue('');
}

const editingCellIndex = this._widget.editingCell ? this._notebookEditor.getCellIndex(this._widget.editingCell) : undefined;
if (editingCellIndex !== undefined) {
this._notebookEditor.setSelections([{
Expand Down

0 comments on commit ee69e28

Please sign in to comment.