Douglas Ferreira
Douglas Ferreira

Reputation: 514

How to setup WebGL autocomplete on Visual Studio Code?

I need to develop a game HTML5 and WebGL on JS, but the editor does not suggest methods, fields, enums related to WebGL to become easier. Any ideas?

Upvotes: 4

Views: 3592

Answers (2)

8Observer8
8Observer8

Reputation: 1172

You can add a JSDOC style comment above the canvas like this:

/** @type {HTMLCanvasElement} */
const canvas = document.getElementById("renderCanvas");

enter image description here

More details in this answer: https://stackoverflow.com/a/61388350/4159530

Upvotes: 0

Roman Kolesnikov
Roman Kolesnikov

Reputation: 12147

You should download WebGl.d.ts, for example from here

And reference this file in first string of your JS file:

/// <reference path="webgl.d.ts" />

Upvotes: 4

Related Questions