I have a file Guardfile
in my rails project, but appears just in plain text, so each time is opened it must be assigned the ruby syntax to display it correctly.
I cannot use Open all with current extension as...
because it doesn't have an extension, but I suppose I could assign a specific syntax to a file without an extension because files like Gemfile
, Capfile
or Rakefile
are displaying correctly.
How can I achieve this?
问问题
2240 次
3 回答
11
菜单:首选项 -> 浏览器包
然后打开文件 Ruby\Ruby.tmLanguage
查找此块:
<array>
<string>rb</string>
<string>rbx</string>
<string>rjs</string>
<string>Rakefile</string>
<string>rake</string>
<string>cgi</string>
<string>fcgi</string>
<string>gemspec</string>
<string>irbrc</string>
<string>capfile</string>
<string>Gemfile</string>
</array>
添加新条目:
<string>Guardfile</string>
于 2013-04-30T16:48:10.960 回答
3
安装facelessuser / ApplySyntax。它有一个内置的 Guardfile 规则。它也适用于其他应设置为某种语法的随机文件。例如,这是我为一个应该具有 Bash 语法的随机文件设置的。
"syntaxes": [
{
"name": "ShellScript/Shell-Unix-Generic",
"rules": [
{"file_name": ".*random$"}
]
}
]
name 值是 Packages 中 tmLanguage 文件的路径。 ShellScript是 tmLanguage 文件所在的 Packages 文件夹的名称。Shell -Unix-Generic是 tmLanguage 文件名。
于 2013-04-30T20:43:54.100 回答
2
对于崇高 3:
Commmand + Shift + p
: 设置语法红宝石- 首选项 -> 设置 - 特定语法
添加如下语法:
{ "extensions": [ "Gemfile", "Gemfile.lock", "Podfile", "Podfile.lock", "Manifest.lock", "Fastfile_helper", "Fastfile", "Appfile" ] }
真正糟糕的是语法不支持模糊匹配,正则表达式。这意味着您必须列出所有文件。
于 2016-12-27T11:02:01.773 回答