Show raw cell language ID when an extension is not installed for that language

Fix #136051
This commit is contained in:
Rob Lourens 2021-11-29 17:46:12 -08:00
parent 5300aa4054
commit b9cf83f70b
2 changed files with 3 additions and 3 deletions

View file

@ -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 = <INotebookCellStatusBarItem>{
text,
command: CHANGE_CELL_LANGUAGE,

View file

@ -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();
}