在VSCode中,如何强制文件类型

huangapple go评论52阅读模式
英文:

In VSCode, how to force the file type

问题

在VSCode中,我想强制某些文件具有特定的类型,而不考虑它们的扩展名。

我在考虑在顶部添加一条注释,内容可能是:嘿,我是纯文本(示例)。

英文:

In VSCode, I would like to force some files to be of a specific type, regardless of their extensions.

I am thinking about a comment to put on top that would say: Hey, I am a plain text (example).

Any idea?

答案1

得分: 1

在VSCode设置中,您可以将您想要的文件与特定语言关联起来:

"settings": {
	"files.associations": {
		"toto.py": "markdown"
	}
}

就像在每个文件的顶部添加纯文本一样,这也是一种非自动操作,但它可以使您的文件更清晰。

[编辑] 根据@starball的评论,您可以在类似问题的更详细答案中找到更多信息,例如此处此处(如果您将复制的文件放在一个地方,第二个链接可能会有用!)。

英文:

In VSCode settings, you can associate the files you want with a specific language:

"settings": {
		"files.associations": {
			"toto.py": "markdown"
		}
}

It is just like adding the plain text on top of each file, you have also a non-automatic action, but it leaves your files cleaner.

[EDIT] Following the comment from @starball, you can find more detailed answers on similar questions here and here for example (the second one might be interesting if you put your copied files in a single place!).

huangapple
  • 本文由 发表于 2023年7月20日 15:15:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76727493.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定