src/vs/workbench/common/editor/textEditorModel.ts/BaseTextEditorModel/doAutoDetectLanguage
class BaseTextEditorModel:	private async doAutoDetectLanguage(): Promise<void> {
		if (
			this.hasLanguageSetExplicitly || 																	// skip detection when the user has made an explicit choice on the language
			!this.textEditorModelHandle ||																		// require a URI to run the detection for
			!this.languageDetectionService.isEnabledForLanguage(this.getLanguageId() ?? PLAINTEXT_LANGUAGE_ID)	// require a valid language that is enlisted for detection
		) {
			return;
		}

		const lang = await this.languageDetectionService.detectLanguage(this.textEditorModelHandle);
		if (lang && !this.isDisposed()) {
			this.setLanguageIdInternal(lang);

			const languageName = this.languageService.getLanguageName(lang);
			if (languageName) {
				this.accessibilityService.alert(localize('languageAutoDetected', "Language {0} was automatically detected and set as the language mode.", languageName));
			}
		}
	}