jrburke / requirejs-intellisense

Enables Visual Studio Intellisense for RequireJS and AMD modules
47 stars 22 forks source link

My version of require.intellisense.js #8

Open areve opened 10 years ago

areve commented 10 years ago

I spent ages researching this and finally came up with this file; achieving intellisense throughout my project. I'm not sure what the setTimeout was achieving nor calling onScriptLoad, what doesn't happen now I've not called it?

In the latest version my test examples (below) did not work at all. Perhaps partly because my requirejs.config is complicated and needed loading at the right time, but also the code did not support the requirejs global. I guess this project needs some a test project creating. I tried very hard to get Visual Studio to let me know the path of a javascript path it has loaded so that defines can be anonymous but I don't believe it can be done. In my test code res and $ have intellisense the second time I use they continue to work forever.

define('foobar', ['res', 'jquery'], function (res, $) {
    // res and $ have intellisense here
}

requirejs(['res', 'jquery'], function (res, $) {
    // res and $ have intellisense here
}