Skip to content

Commit 96b426e

Browse files
committed
Remove dupe context key service registration in cell
Fix #111280
1 parent 873f23d commit 96b426e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/vs/platform/contextkey/browser/contextKeyService.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,12 @@ class ScopedContextKeyService extends AbstractContextKeyService {
417417
if (domNode) {
418418
this._domNode = domNode;
419419
if (this._domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
420-
console.error('Element already has context attribute');
420+
let extraInfo = '';
421+
if ((this._domNode as HTMLElement).classList) {
422+
extraInfo = Array.from((this._domNode as HTMLElement).classList.values()).join(', ');
423+
}
424+
425+
console.error(`Element already has context attribute${extraInfo ? ': ' + extraInfo : ''}`);
421426
}
422427
this._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(this._myContextId));
423428
}

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,14 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
712712

713713
const executionOrderLabel = DOM.append(cellContainer, $('div.execution-count-label'));
714714

715+
const editorPart = DOM.append(cellContainer, $('.cell-editor-part'));
716+
const editorContainer = DOM.append(editorPart, $('.cell-editor-container'));
717+
715718
// create a special context key service that set the inCompositeEditor-contextkey
716-
const editorContextKeyService = disposables.add(this.contextKeyServiceProvider(container));
719+
const editorContextKeyService = disposables.add(this.contextKeyServiceProvider(editorPart));
717720
const editorInstaService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, editorContextKeyService]));
718721
EditorContextKeys.inCompositeEditor.bindTo(editorContextKeyService).set(true);
719722

720-
const editorPart = DOM.append(cellContainer, $('.cell-editor-part'));
721-
const editorContainer = DOM.append(editorPart, $('.cell-editor-container'));
722723
const editor = editorInstaService.createInstance(CodeEditorWidget, editorContainer, {
723724
...this.editorOptions.value,
724725
dimension: {

0 commit comments

Comments
 (0)