Does VS Code's Live Server extension support remote development extensions?

259 views Asked by At

I would like to work on a website that is hosted on Github in VS Code. The issue is when I use the remote repositories extension on VSC, I can't use live server (like it won't let me and it grays out). I was wondering if there was a way to get around this or something else I can use to display my website.

I tried to use Live Server with Remote Repositories, which I thought would work, but it didn't let me use Live Server. I also tried other repository extensions which also didn't work.

1

There are 1 answers

1
starball On

I don't think this is possible right now, and I don't think it would become possible without either making significant changes to how the Live Server extension for VS Code works, or making significant changes to your workflow.

Quoting myself from my answer to Why is VS Code Live Server opening a directory instead of running the code in the browser? (emphasis added),

The VS Code Live Serve extension's server-side uses an npm package called send to attempt to serve files from the local filesystem, and another package called serve-index to serve a file-explorer interface when you request a path that maps to a directory but the send package can't find an index.html file in it to serve. You can see the dependencies in its package.json file, and the code for the server-side of the Live Server extension in its lib/live-server/index.js file.

But from my attempt to understand the (minified) code of the extension (it's not open source) the Remote Repositories extension doesn't work by downloading the repository contents to your machine's filesystem (pretty sensible). It appears to use a combination of the GitHub GraphQL API and VS Code's FileSystemProvider API.

So either

I wrote this answer using the Remote/GitHub Repositories extension as an example, since the question focuses on that remote development extension, but the same info should be generalizable to any remote development extension that provides a "virtual filesystem" to a VS Code workspace via the FileSystemProvider API.