如何为 vscode 中的无扩展名文件关闭自动检测

How to turn auto detect off for extensionless files in vscode

如何为没有扩展名的文件开启自动检测,当确定性较低时,默认情况下应该是明文。

确定性高的文件是那些在开始时有#!的文件,所以我们可以检测到它是哪种语言,但对于其他文件我不想那样。

您可以尝试 workbench.editor.languageDetection 设置,该设置可以全局切换或按语言切换。

1.60 release of Visual Studio Code对语言检测做了一些改动,包括:

This release we are enabling automatic language detection by default and also expanding detection to include files that don't have a file extension.

...power users who use untitled text editors as a scratch pad, no longer need to explicitly set the the language mode, which we hope will streamline their workflow.