Back

Technologies:

javascriptjavascript
visual-studio-codevisual-studio-code
avatar
Tolerim
17 hours ago

Launch the web version of VS Code and open a folder that has already been defined.

As a developer, I'm working with chromium embedded in an application that requires me to launch the web version of Visual Studio Code (https://vscode.dev/) and automatically open a specific directory without manual input from the user. While I'm confident that JavaScript can accomplish this, finding the necessary code to open the folder has proved challenging. I've attempted to identify the code responsible for triggering the "Open Folder..." command within VS Code, but haven't been able to locate an appropriate listener. Is there a simpler method for accomplishing this task, or will I need to perform a full source code analysis?

Answers(1)
avatar
Tolerim
17 hours ago
Verified Answer
Unfortunately, I'm not aware of a simple way to achieve this without taking a deep dive into the source code. The functionality you want to achieve would require modifying the source code of Visual Studio Code, or at least finding a publicly available API that exposes the necessary functionality, but this may not be possible. However, if you're willing to modify the source code, you could try using the vscode.workspace.updateWorkspaceFolders API method to programmatically add the desired folder to Visual Studio Code's workspace. You can find more information on this method in the official Visual Studio Code extension API documentation. Alternatively, you could look into using a headless browser such as Puppeteer to programmatically interact with the Visual Studio Code web app, but this approach may be more complex and less reliable than modifying the source code directly.
;