简体   繁体   中英

How to add an api to Visual Studio Code

I am new at using Visual Studio Code and I am looking to add an api library that I have to VS code so that the Javascript IDE can provide intellisense code completion.

In the past I used Eclipse IDE and added the file to my libs folder in my workspace. This doesn't seem to be the case for VS Code.

The file is a just a .js file that contains a javascript "skeleton" for the API that is intended to be used in a Javascript IDE.

Here is a link to the file. https://www.dropbox.com/s/5ywltqbi7ar0pfa/concept_api.js?dl=0

You can add a comment to the top of your file pointing to the "skeleton":

/// <reference path="./api.js">

VS Code should even give you code completion in the path string.

Create a jsconfig.json file in the root of your Visual Studio Code project and add all files you want parsing for code completion.

{
    "include": [
        "www/js/*.js",
        "www/lib/*.js"
    ]
}

JavaScript Programming with Visual Studio Code

As of the above page VS Code's intellisense is provided using TypeScript. It is recommended that you create Typings for your library if you are planning to ship the library.

But adding a comment like

/// <reference path="you_file.js">

will give you some help with code completion but the accuracy of the completion is a question.

If you are planning to ship the library

Visit This page for more help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM