Skip to content

Commit 0736d1b

Browse files
committed
Fix markdown cell editor using wrong context key service
1 parent 9ed4680 commit 0736d1b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { CancelCellAction, ChangeCellLanguageAction, ExecuteCellAction, INoteboo
4141
import { BaseCellRenderTemplate, CellEditState, CodeCellRenderTemplate, ICellViewModel, INotebookCellList, INotebookEditor, MarkdownCellRenderTemplate, isCodeCellRenderTemplate } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
4242
import { CellMenus } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellMenus';
4343
import { CodeCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/codeCell';
44-
import { StatefullMarkdownCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/markdownCell';
44+
import { StatefulMarkdownCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/markdownCell';
4545
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
4646
import { MarkdownCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel';
4747
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
@@ -439,7 +439,8 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
439439

440440
this.setBetweenCellToolbarContext(templateData, element, toolbarContext);
441441

442-
const markdownCell = this.instantiationService.createInstance(StatefullMarkdownCell, this.notebookEditor, element, templateData, this.editorOptions.value, this.renderedEditors);
442+
const scopedInstaService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, templateData.contextKeyService]));
443+
const markdownCell = scopedInstaService.createInstance(StatefulMarkdownCell, this.notebookEditor, element, templateData, this.editorOptions.value, this.renderedEditors);
443444
elementDisposables.add(this.editorOptions.onDidChange(newValue => markdownCell.updateEditorOptions(newValue)));
444445
elementDisposables.add(markdownCell);
445446

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
2121
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
2222
import { getResizesObserver } from 'vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver';
2323

24-
export class StatefullMarkdownCell extends Disposable {
24+
export class StatefulMarkdownCell extends Disposable {
2525

2626
private editor: CodeEditorWidget | null = null;
2727
private markdownContainer: HTMLElement;

0 commit comments

Comments
 (0)