Vscode intellisense AMD requirejs durandal

88 Views Asked by At

i am running an app in aspnetcore which uses plain js files for the view part, in this case is a legacy app using :

  • jquery
  • Requirejs with AMD modules
  • Durandal (now aurelia) which enforces the use of those modules
  • Knockoutjs (mvvm lib)

here an example of durandal/amd module code (if anyone has seen it already)

define(['durandal/app', 
    'plugins/dialog', 
    'global', 
    'knockout', 
    'services/datacontext', 
    'services/appsecurity'],
    function (app, dialog, global, ko, datacontext, appsecurity) {
   
    /// ... function body using modules but no intellisense...
    }

this is the structure of my app


--src
----aspnectoreapp
-------wwwroot
---------App (contains app code using durandall structure)
-----------Config.js (requirejs config file)
-----------Main.js (entry point)
---------Scripts (contains js libs like all the aboves)

how can i make this to work with vscode intellisense?

i tried adding packages with npm init, and npm install -D adding both packages and types..

i also tried adding this in my wwwroot/jsconfig.json

{
    "compilerOptions": {
        "module": "amd",
        "target": "es6"
    }
}

but got no luck.

I also tried installing the requirejs vscode extension specifying a settings.json workspace solution file (at top level), with this values

{
    "requireModuleSupport.modulePath": "./src/aspnectoreapp/Scripts",
    "requireModuleSupport.configFile": "./src/aspnectoreapp/App/Config.js"
}

but got no luck .

Anyone which tried any of those settings or knows a way this could work?

0

There are 0 best solutions below