vscode把html转成js,visual studio code - vscode html + javascript Goto Definition does not work - Stack ...

Setting up a test workspace in visual studio code to learn webgl, using this good book https://sites.google.com/site/webglbook/

Samples are structured like this:

examples

ch02

HelloCanvas.html

HelloCanvas.js

ch03

...

lib

webgl-utils.js

cuon-utils.js

...

Take for example HelloCanvas.html

Clear "canvas"

Please use a browser that supports "canvas"

It contains references to external scripts.

If I open the HelloCanvas.js file

// HelloCanvas.js (c) 2012 matsuda

function main() {

// Retrieve element

var canvas = document.getElementById('webgl');

// Get the rendering context for WebGL

var gl = getWebGLContext(canvas);

if (!gl) {

console.log('Failed to get the rendering context for WebGL');

return;

}

// Set clear color

gl.clearColor(0.0, 0.0, 0.0, 1.0);

// Clear

gl.clear(gl.COLOR_BUFFER_BIT);

}

vscode cannot find declarations in other js files contained in the lib folder.

For example I expect vscode to be able to "Go to the declaration" of getWebGLContext that is contained in cuon-utils.js

cuon-utils.js (excerpt)

/**

* Initialize and get the rendering for WebGL

* @param canvas element

* @param opt_debug flag to initialize the context for debugging

* @return the rendering context for WebGL

*/

function getWebGLContext(canvas, opt_debug) {

// Get the rendering context for WebGL

var gl = WebGLUtils.setupWebGL(canvas);

if (!gl) return null;

// if opt_debug is explicitly false, create the context for debugging

if (arguments.length < 2 || opt_debug) {

gl = WebGLDebugUtils.makeDebugContext(gl);

}

return gl;

}

So far I tried adding a jsconfig.json in the root folder or in the same folder of HelloCanvas.js

{

"include": [ "../lib/**/*"]

}

with no success

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值