首页 > 解决方案 > 让 vscode 理解 p5js

问题描述

我最近开始使用 P5JS,我使用 VSCode 作为编辑器。

VSCode 不知道 P5JS,因为我猜它是一个库,并且会自动完成所有错误的操作。

有没有办法将 P5JS 语言文件导入 VSCode,因为这真的很痛苦。

预先感谢您的帮助。

标签: javascriptvisual-studio-code

解决方案


As far as Intellisense for P5.js in Visual Studio Code is concerned, there is currently no official build of p5.js typescript definition files, hence it cannot be done with npm install. I have attached a link to a zip file (as stack overflow doesn't support file attachment):

https://www.filehosting.org/file/details/795689/p5.d.zip

After download, put them in your project directory somewhere and add a reference to them in your sketch.js file.

E.g:

< reference path="./p5.global-mode.d.ts" / >

After that you will be able to get autocomplete & docs:

enter image description here


推荐阅读