pixelkind / p5canvas

An interactive preview for writing p5js code in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=garrit.p5canvas
Other
39 stars 4 forks source link

have VS Code offer code completion tailored to p5js #44

Open ccoenen opened 3 years ago

ccoenen commented 3 years ago

currently, VS Code helpfully offers a ton of JS APIs that have nothing to do with p5canvas. That would be neat if it didn't auto-override stuff one actually typed all the time. I would love if we could tailor intellisense to p5 a little more.

Currently, in an empty document, these replacements happen for me:

rotate() -> DeviceRotationRate scale() -> SVGFEFuncAElement

and a few more.

ccoenen commented 2 years ago

I have not yet managed to put this into p5canvas, but I have a test repository, where the @types/p5 get offered: https://github.com/ccoenen/test-p5js-jsdom-action

Key is this changeset, where global.d.ts and jsconfig.json are added: https://github.com/ccoenen/test-p5js-jsdom-action/commit/770ffafd8bcabd0d3f98ab11f2b46eb3b06fba7b

Currently, those must live in the project. If they could be taken out to p5canvas, that would make initial setup much easier for students.

ccoenen commented 2 years ago

it should be noted that my workaround only works for anyone having nodejs installed on their systems.