本文介绍了Visual Studio 代码:Paperscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(对不起,我的英语水平)你知道任何 ext 或什么东西可以为 paperscript 代码着色吗?
(sorry for my english skills) Did you know any ext or something to color paperscript code?
推荐答案
因为您的编辑器无法识别 text/paperscript
MIME 类型,所以它不知道要应用什么语法高亮显示.
Because your editor doesn't recognise the text/paperscript
MIMEtype, it doesn't know what syntax highlighting to apply to it.
为了避免这种情况,最好的办法是将您的 paperscript 代码存储在一个带有 .js
扩展名的单独文件中.然后你的编辑器会自动应用正确的 JS 语法高亮显示它.
To circumvent this, your best bet is to store your paperscript code in a separate file with the .js
extension. Then your editor will automatically apply the correct JS syntax highlighting to it.
index.html
<script type="text/paperscript" canvas="myCanvas" src="index.js"></script>
index.js
// exactly the same code you had inline before
for (var x = 0; x < 1000; x += 100) {
for (var y = 0; y < 1000; y += 100) {
var myCircle = new Path.Circle(new Point(x, y), 10);
myCircle.fillColor = 'purple';
}
}
这篇关于Visual Studio 代码:Paperscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!