Css Textmate语法突出显示,从另一种语言扩展突出显示
我试图在Textmate中扩展一些CSS高亮显示。我的方法是这样的Css Textmate语法突出显示,从另一种语言扩展突出显示,css,syntax-highlighting,textmate,highlighting,Css,Syntax Highlighting,Textmate,Highlighting,我试图在Textmate中扩展一些CSS高亮显示。我的方法是这样的 { .... patterns = ( { include = 'source.css'; }, { name = 'support.function'; match = '\..*\);'; }, ); } 问题是“include='source.css';”。如果我去掉那条线。我的自定义匹配器点击并应
{
....
patterns = (
{ include = 'source.css'; },
{
name = 'support.function';
match = '\..*\);';
},
);
}
问题是“include='source.css';”。如果我去掉那条线。我的自定义匹配器点击并应用预期的高亮显示。但是,我失去了所有预定义的css高亮显示,我想要的
我对如何覆盖我所包含的现有css突出显示感到困惑。想法?我也有类似的问题。我的头撞到了它上,然后TextMate IRC频道的某个人纠正了我:出于某种原因(我忘了),你需要重新包含你的语言语法 我的模式部分现在看起来像
patterns = (
{ include = 'source.ruby'; },
{ include = '$self'; },
);
为了给这个例子添加更多的信息,这里是我创建的包的语言语法(在我感兴趣的文件部分,所有内容都在meta.rails.model范围内。也许你的CSS包中没有
patterns = (
{ name = 'meta.rails.model';
comment = "Uses lookahead to match classes that (may) inherit from ActiveRecord::Base; includes 'source.ruby' to avoid infinite recursion";
begin = '(^\s*)(?=class\s+.+ActiveRecord::Base)';
end = '^\1(?=end)\b';
patterns = (
{ include = 'source.ruby'; },
{ include = '$self'; },
);
},
{ name = 'source.ruby.rails.aasm.event';
match = '(aasm_event\W*:\w+)';
captures = { 1 = { name = 'keyword.other.context.ruby.rails.aasm.event'; }; };
},
{ include = 'source.ruby.rails'; },
);
}
但是您可以看到,$self声明将其他模式拉入meta.rails.model模式(我认为这就是为什么这很重要)。完美,这正是我想要的。