how to add file extension in adobe-brackets editor ?

一笑奈何 提交于 2019-12-03 02:11:46

Update: this is now much easier to do:

  1. Open the .html.eco file
  2. In the status bar (lower-right), click the dropdown that says "Text"
  3. Select the "HTML" option
  4. Open the dropdown again and select the "Set as Default" option at the top

Original answer:

There's a backlog item for making this easily configurable (please upvote!), but in the meantime you can do it by writing a very simple Brackets extension:

define(function (require, exports, module) {
    var LanguageManager = brackets.getModule("language/LanguageManager");
    var language = LanguageManager.getLanguage("html");
    language.addFileExtension("html.eco");
});
  1. Put this code in a file named main.js
  2. In Brackets, go to Help > Show Extensions Folder
  3. Create a new folder under user, and place the main.js file inside it
  4. Restart Brackets

Here's more info on writing Brackets extensions, if you're curious.

The approach referenced using the status bar menu does not persist across sessions. An option to persist settings across all projects and all sessions is easily accomplished by editing the preferences file (accessible through the Debug menu) and associating the file extension to the desired language.

Debug -> Open Preferences File

{
    "language.fileExtensions": {
        "html.eco": "html"
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!