简体   繁体   English

使用另一个扩展名保存在Sublime文本中

[英]Save in Sublime Text with Another Extension

In Sublime Text 2 & 3, whenever I save a file with one extension, or without an extension, then save it with another extension later, the syntax colors seem to stay with the first extension. 在Sublime Text 2&3中,每当我保存带有一个扩展名的文件或没有扩展名的文件时,稍后用另一个扩展名保存它,语法颜色似乎与第一个扩展名保持一致。 For example, when I save what I mean to be a JavaScript or PHP file without an extension by accident, then Save As with the correct extension, the text stays all black. 例如,当我意外地保存我的意思是没有扩展名的JavaScript或PHP文件时,然后使用正确的扩展名Save As ,文本保持全黑。

Is this supposed to happen? 这应该发生吗? Is it because the file isn't actually saved as the 2nd extension the next time? 是因为文件下次实际上没有保存为第二个扩展名吗? Most importantly, is there a way to save the file with the correct extension without creating a new file & copying all the text over? 最重要的是,有没有一种方法可以使用正确的扩展名保存文件,而无需创建新文件并复制所有文本?

you can set the syntax manually as follows. 您可以手动设置语法,如下所示。 设置语法

click HTML and you will see all the syntaxes, you may choose whatever you want, or you can do it in the command palette by type ctrl+shify+P and type syntax and you can do the same thing. 单击HTML ,您将看到所有语法,您可以选择任何您想要的,或者您可以在command palette通过键入ctrl+shify+P和类型syntax来执行此操作,您可以执行相同的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM