我正在使用 TypeScript 和 Sublime 3。如何在模板属性中添加 HTML 高亮显示:[注意:我已经在使用 Microsoft TypeScript 包]
看看现在它没有突出显示:
这是一个快速修复,仍然可以使用您已安装的TypeScript
包及其现有语法高亮定义:
打开 TypeScript 文件(带有已安装的 TypeScript 语法突出显示)
Select 工具 > 开发人员 > Typescript.tmLanguage 的新语法创建新的语法定义文件基于现有的
-
Find the template
context (ctrl+f for string.template.ts
) and add an include for 'scope:text.html.basic'
to the push
as indicated in the commented line below:
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: TypeScript + HTML # <-- renaming is optional
# ...
template:
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
captures:
1: entity.name.function.tagged-template.ts
2: punctuation.definition.string.template.begin.ts
push:
- meta_scope: string.template.ts
- match: "`"
captures:
0: punctuation.definition.string.template.end.ts
pop: true
- include: template-substitution-element
- include: string-character-escape
- include: 'scope:text.html.basic' # <-- !! only add this line !!
template-substitution-element:
# ...
可选步骤:
改变name
文件开头的属性类似于TypeScript + HTML
轻松找到并选择它Syntax稍后列出
保存文件.sublime-syntax
文件结尾
-
重新启动 Sublime Text 并将新语法突出显示应用于打字稿文件:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)