javascriptvisual-studio-codeautocompleteintellisense

How to get full Intellisense/autocomplete for JS libraries in VSCode web editor


I'm programming a basic chatroom using the PeerJS library, and I would like to have autocomplete functional for that library. However, I am using the web version of VSCode because I am using a shared computer that I can't install anything on, so I can't use TypeScript or Automatic Type Acquisition as I can't use NPM. Is there any way for me to get autocomplete working?


Solution

  • I do not think this is possible. Because auto-completion needs two things if I am not wrong. 1. an LSP server and 2. The source code for the library (or typescript definitions). On a shared computer, if you are not able to install that library, I do not think you can use auto-completion to get working even if VS Code Web Editor has a built-in web-compliant LSP server running.

    So, the solutions available to you are simple if you share computer have an internet access:

    1. Use a remote desktop service.
    2. Use an online code editor that lets you use a VM for some time. Like Replit or Gitpod. Or maybe try out GitHub CodeSpaces.
    3. Set up your VM with a web version of VS Code.

    You can also try to make a node_modules/your-libary folder and copy paste the typescript definitions for that library and see if it works. But that might take more time to get working. And you need to link it properly so that the IDE can recognize it.