vs code识别ejs模版为html语法
发布于 9 天前 作者 jaylinWang 274 次浏览 来自 分享

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

3 回复

有swig。。。?

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

回到顶部