Skip to content

Commit 6266d3b

Browse files
committed
do not reset language to plaintext
1 parent d788479 commit 6266d3b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vs/workbench/contrib/interactive/browser/interactiveEditor.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,6 @@ export class InteractiveEditor extends EditorPane {
570570
}
571571
}
572572

573-
574573
#syncWithKernel() {
575574
const notebook = this.#notebookWidget.value?.textModel;
576575
const textModel = this.#codeEditorWidget.getModel();
@@ -583,8 +582,11 @@ export class InteractiveEditor extends EditorPane {
583582

584583
if (selectedOrSuggested) {
585584
const language = selectedOrSuggested.supportedLanguages[0];
586-
const newMode = language ? this.#languageService.createById(language).languageId : PLAINTEXT_LANGUAGE_ID;
587-
textModel.setLanguage(newMode);
585+
// All kernels will initially list plaintext as the supported language before they properly initialized.
586+
if (language && language !== 'plaintext') {
587+
const newMode = this.#languageService.createById(language).languageId;
588+
textModel.setLanguage(newMode);
589+
}
588590

589591
NOTEBOOK_KERNEL.bindTo(this.#contextKeyService).set(selectedOrSuggested.id);
590592
}

0 commit comments

Comments
 (0)