Change:
Currently if we don't find language provider for cells, we would fall back to , this will make the document dirty immediately. We should actually respect the language metadata, show a warning on the cell status bar language picker and ask users to install language extensions for it.

Discussion:
return; } <del> const languageId = cell.cellKind === CellKind.Markup ? 'markdown' : (this._languageService.getLanguageIdByLanguageName(cell.language) || cell.language); const text = this._languageService.getLanguageName(languageId) || languageId; const item = <INotebookCellStatusBarItem>{ text, </del> <ins> const statusBarItems: INotebookCellStatusBarItem[] = []; let displayLanguage = cell.language; if (cell.cellKind === CellKind.Markup) { displayLanguage = 'markdown'; } else { const registeredId = this._languageService.getLanguageIdByLanguageName(cell.language); if (registeredId) { displayLanguage = this._languageService.getLanguageName(displayLanguage) ?? displayLanguage; } else { // add unregistered lanugage warning item const searchTooltip = localize('notebook.cell.status.searchLanguageExtensions', "Unknown cell language - Search for '{0}' extensions", cell.language); statusBarItems.push({ text: `$(dialog-warning)`, command: { id: 'workbench.extensions.search', arguments: [`@tag:${cell.language}`], title: 'Search Extensions' }, tooltip: searchTooltip, alignment: CellStatusbarAlignment.Right, priority: -Number.MAX_SAFE_INTEGER + 1 }); } } statusBarItems.push({ text: displayLanguage, </ins> command: CHANGE_CELL_LANGUAGE, tooltip: localize('notebook.cell.status.language', "Select Cell Language Mode"), alignment: CellStatusbarAlignment.Right, priority: -Number.MAX_SAFE_INTEGER <del> }; </del> <ins> }); </ins> return { <del> items: [item] </del> <ins> items: statusBarItems </ins> }; } }

this._textModelDisposables.clear(); this._textModel = m; if (this._textModel) { <del> // 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 // If so let's not modify the language if (!(this._languageService.isRegisteredLanguageId(this.language) === false && (this._textModel.getLanguageId() === PLAINTEXT_LANGUAGE_ID || this._textModel.getLanguageId() === 'jupyter'))) { this.language = this._textModel.getLanguageId(); } </del> <ins> this.setRegisteredLanguage(this._languageService, this._textModel.getLanguageId(), this.language); </ins> // Listen to language changes on the model <del> this._textModelDisposables.add(this._textModel.onDidChangeLanguage(e => { this.language = e.newLanguage; })); </del> <ins> this._textModelDisposables.add(this._textModel.onDidChangeLanguage((e) => this.setRegisteredLanguage(this._languageService, e.newLanguage, this.language))); </ins> this._textModelDisposables.add(this._textModel.onWillDispose(() => this.textModel = undefined)); this._textModelDisposables.add(this._textModel.onDidChangeContent(() => { if (this._textModel) {

} } <ins> private setRegisteredLanguage(languageService: ILanguageService, newLanguage: string, currentLanguage: string) { // 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 const isFallBackLanguage = (newLanguage === PLAINTEXT_LANGUAGE_ID || newLanguage === 'jupyter'); if (!languageService.isRegisteredLanguageId(currentLanguage) && isFallBackLanguage) { // notify to display warning, but don't change the language this._onDidChangeLanguage.fire(currentLanguage); } else { this.language = newLanguage; } } </ins> constructor( readonly uri: URI, public readonly handle: number,