jQuery intellisense in VS Code

前端 未结 5 1524
半阙折子戏
半阙折子戏 2021-01-31 18:05

I have tried this:

JQuery intellisense in Visual Studio Code

and this:

http://shrekshao.github.io/2016/06/20/vscode-01/

But it does nothing, VS C

5条回答
  •  一个人的身影
    2021-01-31 18:35

    I had the same problem and google brought me here. I added the type jsconfig.json and "typeAcquisition" and still nothing.

    Turns out you have to have node and npm installed. Even if you are not using them for package management and are importing jquery from a CDN.

    From the Docs

    Many popular libraries ship with typings files so you get IntelliSense for them automatically. For libraries that do not include typings, VS Code's Automatic Type Acquisition will automatically install community maintained typings file for

    Automatic type acquisition requires npmjs, the Node.js package manager, which is included with the Node.js runtime. In this image you can see IntelliSense, including the method signature, parameter info, and the method's documentation for the popular lodash library.

    https://code.visualstudio.com/docs/nodejs/working-with-javascript

    So vs code uses npm for auto type acquisition.

    May be super basic, but it solved my problem so I hope it helps someone else too.

    I also used the configuration in jsconfig.json as described by kwood. Not sure I needed to specify it manually after installin npm but it is working so i'm not asking questions

提交回复
热议问题