From b9cf83f70bb6b4697b544a97c7056dfd28fccc5f Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 29 Nov 2021 17:46:12 -0800 Subject: [PATCH] Show raw cell language ID when an extension is not installed for that language Fix #136051 --- .../browser/contrib/cellStatusBar/statusBarProviders.ts | 2 +- .../contrib/notebook/common/model/notebookCellTextModel.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.ts b/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.ts index a59607ea955..8d7db31e8e8 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.ts @@ -36,7 +36,7 @@ class CellStatusBarLanguagePickerProvider implements INotebookCellStatusBarItemP const languageId = cell.cellKind === CellKind.Markup ? 'markdown' : (this._modeService.getModeIdForLanguageName(cell.language) || cell.language); - const text = this._modeService.getLanguageName(languageId) || this._modeService.getLanguageName('plaintext'); + const text = this._modeService.getLanguageName(languageId) || languageId; const item = { text, command: CHANGE_CELL_LANGUAGE, diff --git a/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts b/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts index 2bbd738aab6..dff3b9cb2f3 100644 --- a/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts +++ b/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts @@ -166,9 +166,9 @@ export class NotebookCellTextModel extends Disposable implements ICell { this._textModel = m; if (this._textModel) { // Init language from text model - // The language defined in the cell might not be supported in the editor so the text model might be using the default fallback (plaintext) + // The language defined in the cell might not be supported in the editor so the text model might be using the default fallback // If so let's not modify the language - if (!(this._modeService.getModeId(this.language) === null && this._textModel.getLanguageId() === 'plaintext')) { + if (!(this._modeService.getModeId(this.language) === null && (this._textModel.getLanguageId() === 'plaintext' || this._textModel.getLanguageId() === 'jupyter'))) { this.language = this._textModel.getLanguageId(); }