Skip to content

Commit c9b730c

Browse files
committed
styling update
1 parent 17f0e23 commit c9b730c

10 files changed

Lines changed: 29 additions & 11 deletions

File tree

src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
6+
.monaco-workbench .notebookOverlay .cell-chat-part {
7+
display: none;
8+
color: inherit;
9+
padding: 6px;
10+
border-radius: 6px;
11+
border: 1px solid var(--vscode-inlineChat-border);
12+
background: var(--vscode-inlineChat-background);
13+
}
514
.monaco-workbench .notebookOverlay .cell-chat-part .cell-chat-container {
615
padding: 8px 12px 0px 8px;
716
}

src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export interface ICellViewModel extends IGenericCellViewModel {
235235
readonly model: NotebookCellTextModel;
236236
readonly id: string;
237237
readonly textBuffer: IReadonlyTextBuffer;
238-
readonly layoutInfo: { totalHeight: number; bottomToolbarOffset: number; editorWidth: number; editorHeight: number; statusBarHeight: number };
238+
readonly layoutInfo: { totalHeight: number; bottomToolbarOffset: number; editorWidth: number; editorHeight: number; statusBarHeight: number; chatHeight: number };
239239
readonly onDidChangeLayout: Event<ICommonCellViewModelLayoutChangeInfo>;
240240
readonly onDidChangeCellStatusBarItems: Event<void>;
241241
readonly onCellDecorationsChanged: Event<{ added: INotebookCellDecorationOptions[]; removed: INotebookCellDecorationOptions[] }>;

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,13 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
860860
}
861861
`);
862862

863+
// chat
864+
styleSheets.push(`
865+
.monaco-workbench .notebookOverlay .cell-chat-part {
866+
margin: 0 ${cellRightMargin}px 8px 6px;
867+
}
868+
`);
869+
863870
this._styleElement.textContent = styleSheets.join('\n');
864871
}
865872

src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class CellExecutionPart extends CellContentPart {
7878
DOM.hide(this._executionOrderLabel);
7979
} else {
8080
DOM.show(this._executionOrderLabel);
81-
const top = element.layoutInfo.editorHeight - 22 + element.layoutInfo.statusBarHeight;
81+
const top = element.layoutInfo.editorHeight - 22 + element.layoutInfo.statusBarHeight + element.layoutInfo.chatHeight;
8282
this._executionOrderLabel.style.top = `${top}px`;
8383
}
8484
}

src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,16 @@ export class CellFocusIndicator extends CellContentPart {
8080
this.bottom.domNode.style.transform = `translateY(${indicatorPostion.bottomIndicatorTop}px)`;
8181
this.left.setHeight(indicatorPostion.verticalIndicatorHeight);
8282
this.right.setHeight(indicatorPostion.verticalIndicatorHeight);
83-
this.codeFocusIndicator.setHeight(indicatorPostion.verticalIndicatorHeight - this.getIndicatorTopMargin() * 2);
83+
this.codeFocusIndicator.setTop(element.layoutInfo.chatHeight);
84+
this.codeFocusIndicator.setHeight(indicatorPostion.verticalIndicatorHeight - this.getIndicatorTopMargin() * 2 - element.layoutInfo.chatHeight);
8485
} else {
8586
const cell = element as CodeCellViewModel;
8687
const layoutInfo = this.notebookEditor.notebookOptions.getLayoutConfiguration();
8788
const bottomToolbarDimensions = this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType);
8889
const indicatorHeight = cell.layoutInfo.codeIndicatorHeight + cell.layoutInfo.outputIndicatorHeight + cell.layoutInfo.commentHeight;
8990
this.left.setHeight(indicatorHeight);
9091
this.right.setHeight(indicatorHeight);
92+
this.codeFocusIndicator.setTop(cell.layoutInfo.chatHeight);
9193
this.codeFocusIndicator.setHeight(cell.layoutInfo.codeIndicatorHeight);
9294
this.outputFocusIndicator.setHeight(Math.max(cell.layoutInfo.outputIndicatorHeight - cell.viewContext.notebookOptions.getLayoutConfiguration().focusIndicatorGap, 0));
9395
this.bottom.domNode.style.transform = `translateY(${cell.layoutInfo.totalHeight - bottomToolbarDimensions.bottomToolbarGap - layoutInfo.cellBottomMargin}px)`;

src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ registerAction2(class extends NotebookCellAction {
444444
if (!newCell) {
445445
return;
446446
}
447-
await context.notebookEditor.focusNotebookCell(newCell, 'editor');
447+
await context.notebookEditor.focusNotebookCell(newCell, 'container');
448448
const ctrl = NotebookCellChatController.get(newCell);
449449
if (!ctrl) {
450450
return;

src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatWidget.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class CellChatWidget extends Disposable {
6363

6464
constructor(
6565
private readonly _notebookEditor: INotebookEditorDelegate,
66-
_partContainer: HTMLElement,
66+
private readonly _partContainer: HTMLElement,
6767
@IModelService private readonly _modelService: IModelService,
6868
@IInstantiationService private readonly _instantiationService: IInstantiationService,
6969
@IContextKeyService private readonly _contextKeyService: IContextKeyService
@@ -130,7 +130,7 @@ export class CellChatWidget extends Disposable {
130130
}
131131

132132
show(element: ICellViewModel) {
133-
this._elements.root.style.display = 'block';
133+
this._partContainer.style.display = 'block';
134134

135135
this._activeCell = element;
136136

@@ -143,11 +143,11 @@ export class CellChatWidget extends Disposable {
143143

144144
this.layout();
145145
this._inputEditor.focus();
146-
this._activeCell.chatHeight = 62;
146+
this._activeCell.chatHeight = 82 + 8 /* bottom margin*/;
147147
}
148148

149149
hide() {
150-
this._elements.root.style.display = 'none';
150+
this._partContainer.style.display = 'none';
151151
if (this._activeCell) {
152152
this._activeCell.chatHeight = 0;
153153
}

src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export class CodeCell extends Disposable {
346346
this.templateData.editor?.focus();
347347
}
348348

349-
this.templateData.container.classList.toggle('cell-editor-focus', this.viewCell.focusMode === CellFocusMode.Editor || this.viewCell.focusMode === CellFocusMode.ChatInput);
349+
this.templateData.container.classList.toggle('cell-editor-focus', this.viewCell.focusMode === CellFocusMode.Editor);
350350
this.templateData.container.classList.toggle('cell-output-focus', this.viewCell.focusMode === CellFocusMode.Output);
351351
}
352352

src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,14 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
260260

261261
// This is also the drag handle
262262
const focusIndicatorLeft = new FastDomNode(DOM.append(container, DOM.$('.cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left')));
263+
const cellChatPart = DOM.append(container, $('.cell-chat-part'));
263264
const cellContainer = DOM.append(container, $('.cell.code'));
264265
const runButtonContainer = DOM.append(cellContainer, $('.run-button-container'));
265266
const cellInputCollapsedContainer = DOM.append(cellContainer, $('.input-collapse-container'));
266267
cellInputCollapsedContainer.style.display = 'none';
267268
const executionOrderLabel = DOM.append(focusIndicatorLeft.domNode, $('div.execution-count-label'));
268269
executionOrderLabel.title = localize('cellExecutionOrderCountLabel', 'Execution Order');
269270
const editorPart = DOM.append(cellContainer, $('.cell-editor-part'));
270-
const cellChatPart = DOM.append(editorPart, $('.cell-chat-part'));
271271
const editorContainer = DOM.append(editorPart, $('.cell-editor-container'));
272272
const cellCommentPartContainer = DOM.append(container, $('.cell-comment-container'));
273273

src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
253253
}
254254

255255
const statusBarHeight = this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata, this.uri);
256-
const codeIndicatorHeight = chatHeight + editorHeight + statusBarHeight;
256+
const codeIndicatorHeight = editorHeight + statusBarHeight;
257257
const outputIndicatorHeight = outputTotalHeight + outputShowMoreContainerHeight;
258258
const outputContainerOffset = notebookLayoutConfiguration.editorToolbarHeight
259259
+ notebookLayoutConfiguration.cellTopMargin // CELL_TOP_MARGIN

0 commit comments

Comments
 (0)