vscode-web icon indicating copy to clipboard operation
vscode-web copied to clipboard

how can I use it as a service to open each sub folder from root

Open seven1986 opened this issue 2 years ago • 1 comments

I have created a directory D:/h5apps , how can I use vscode-web to open each sub directories, just like:

http://host:8080/edit/app01 ==> D:/h5apps/app01

http://host:8080/edit/app02 ==> D:/h5apps/app02

http://host:8080/edit/app03 ==> D:/h5apps/app03

thank you

seven1986 avatar Jun 09 '22 09:06 seven1986

Hi I think you will have to code an extension for that You'll have to code a filesystemprovider in an extension, and then, in the index.html file, you'll have to provide a window.product variable with dynamic folderUri

const currentUrl = new URL(window.location.href);
const path = currentUrl.pathname.substring(1);

window.product = {
  productConfiguration: {
    nameShort: "My Code Browser",
    ...
  },
  folderUri: {
    scheme: "myCustomScheme",
    path,
  }
}

And then in your extension you'll be able to use vscode.workspace.workspaceFolders[0].uri to know the current uri. With the uri you'll be able to match the correct forlder to query on server.

Felx-B avatar Jul 08 '22 19:07 Felx-B