模板文字中的Atom HTML语法高亮(对于angular2)

模板文字中的Atom HTML语法高亮(对于angular2),第1张

概述如何在模板文字中获取 HTML语法高亮? 以前我写过的这样的东西: 这里是崇高的版本https://github.com/Microsoft/TypeScript-Sublime-Plugin/pull/189/files 如何为Atom写同一件事? 我能够实现这一点,这是ts.cson文件的要点. 在我的系统上形成atom typescript插件: /Users/amin/.atom/pack 如何在模板文字中获取 HTML语法高亮?

以前我写过的这样的东西:
这里是崇高的版本https://github.com/Microsoft/TypeScript-Sublime-Plugin/pull/189/files
如何为Atom写同一件事?

解决方法 我能够实现这一点,这是ts.cson文件的要点.
在我的系统上形成atom typescript插件:
/Users/amin/.atom/packages/atom-typescript/grammars/ts.cson

https://gist.github.com/aminroosta/509476f48f05f4b56db2c0748fedc8fd

这对于角度2开发非常有用,
这里是一个截图为atom与HTML和CSS的亮点:

我找不到更好的正则表达式来匹配模板:和样式:[如果有人可以想出一个更好的正则表达式,我会接受他们的答案.

ts.cson文件中的重要变化是:

"template-HTML":  name: "Meta.template.HTML.ts"  begin: "`<!---->"  beginCaptures:    "0":      name: "string.quoted.template.ts"  end:"`"  endCaptures:    "0":      name: "string.quoted.template.ts"  patterns: [    {      include: "text.HTML.basic"    }  ]"template-CSS":  name: "Meta.template.CSS.ts"  begin: "`/\*\*/"  beginCaptures:    "0":      name: "string.quoted.template.ts"  end:"`"  endCaptures:    "0":      name: "string.quoted.template.ts"  patterns: [    {      include: "source.CSS"    }  ]

更新:

找到一个解决方案:

"template-HTML":    name: "Meta.template.HTML.ts"    begin: "(?<=template\:)\s*`"    beginCaptures:    "0":      name: "string.quoted.template.ts"  end:"`"  endCaptures:    "0":      name: "string.quoted.template.ts"  patterns: [    {      include: "text.HTML.basic"    }  ]"template-CSS":  name: "Meta.template.CSS.ts"  begin: "(?<=styles\:)\s*(\[)\s*(`)"  beginCaptures:    "2":      name: "string.quoted.template.ts"  end:"`"  endCaptures:    "0":      name: "string.quoted.template.ts"  patterns: [    {      include: "source.CSS"    }  ]

这是更新的截图:

总结

以上是内存溢出为你收集整理的模板文字中的Atom HTML语法高亮(对于angular2)全部内容,希望文章能够帮你解决模板文字中的Atom HTML语法高亮(对于angular2)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1141494.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存