vs code识别ejs模版为html语法
发布于 9 年前 作者 jaylinWang 17540 次浏览 最后一次编辑是 8 年前 来自 分享

1、 编辑Visual Studio Code.app/Contents/Resources/app/extensions/html/package.json为如下:

{
	"name": "html",
	"version": "0.1.0",
	"publisher": "vscode",
	"engines": { "vscode": "*" },
	"contributes": {
		"languages": [{
			"id": "html",
			"extensions": [ ".html", ".htm", ".shtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm",".ejs"],
			"aliases": [ "HTML", "htm", "html", "xhtml","ejs"],
			"mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template"]
		}],
		"grammars": [{
			/* "language": "html", not yet enabled*/
			"scopeName": "text.html.basic",
			"path": "./syntaxes/HTML.plist"
		}]
	}
}

2、重启vscode

4 回复

有swig。。。?

@yuanzhhh 原理应该是一样的,这个方案只是让vs code识别ejs中html语法,ejs<%%>标签语法是无法识别的。

1.添加ejs语言支持拓展 2.用户设置添加以下内容 "emmet.includeLanguages": { “ejs”: “html” }

回到顶部