Remote Vs Local Install
Introduction
In today's digital age, remote work has become the new norm. With the rise of remote work, developers and teams are looking for ways to collaborate and work together more efficiently. One of the key tools in this collaboration is Visual Studio Code (VSCode), a popular code editor that allows developers to work on their projects from anywhere. However, when it comes to installing extensions, things can get complicated. In this article, we will explore the challenges of remote vs local install and provide a solution to support extension installation on both local and remote machines simultaneously.
Environment
To better understand the challenges, let's take a look at the environment we are working with.
- Windows 11 + WSL: We are using Windows 11 as our primary operating system and have installed WSL (Windows Subsystem for Linux) to run Ubuntu 24.04.
- Extension installed locally (Windows): The extension is installed on the local machine (Windows).
- Extension also installed on WSL remote (Ubuntu 24.04): The extension is also installed on the remote machine (WSL) running Ubuntu 24.04.
Config
The configuration for the extension is as follows:
"hediet.vscode-drawio.customLibraries": [
{
"file": "${workspaceFolder}/drawio/Scratchpad.xml",
"libName": "test",
"entryId": "test"
}
],
Behavior
When attempting to open a file using a Remote (WSL) attached VSCode, the extension only uses the local filepath (C:/). This is evident from the error message:
2025-05-01 14:58:35.387 [error] EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open 'C:\home\jgroom\src\lab\drawio\Scratchpad.xml'
at Yi.e (file:///c:/Users/jgroom/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:111:18041)
at Object.readFile (file:///c:/Users/jgroom/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:111:16562)
Workaround
The workaround for this issue is to uninstall the extension from the local machine (Windows) and leave it installed on the remote machine (WSL). This requires manual installation on the remote machine. After uninstalling the extension on the local machine, the ${workspaceFolder}
is recognized properly.
Goal
The goal is to support extension installation on both local and remote machines simultaneously. This would allow developers to work on their projects from anywhere, without having to worry about the extension installation.
Understanding the Challenges
The challenges of remote vs local install can be attributed to the way VSCode handles extension installation. When an extension is installed on the local machine, it is not automatically installed on the remote machine. This can lead to conflicts and issues when working on a project that requires the extension to be installed on both machines.
Solution
To support extension installation on both local and remote machines simultaneously, we need to understand how VSCode handles extension installation. When an extension is installed on the local machine, it is stored in the ~/.vscode/extensions
directory. When the remote machine is connected to the local machine, VSCode uses the workspaceFolder
variable to determine the location of the project. However, when the extension is installed on the local machine, it is not automatically installed on the remote machine.
To solve this issue, we need to modify the extension installation process to support simultaneous installation on both local and remote machines. This can be achieved by creating a custom extension installation script that installs the extension on both machines simultaneously.
Custom Extension Installation Script
The custom extension installation script can be created using a tool like npm
or yarn
. The script can be written in a language like JavaScript or Python. The script will need to install the extension on both machines simultaneously, using the workspaceFolder
variable to determine the location of the project.
Here is an example of a custom extension installation script written in JavaScript:
const fs = require('fs');
const path = require('path');
const extensionName = 'hediet.vscode-drawio.customLibraries';
const extensionPath = path.join(__dirname, 'extensions', extensionName);
const localMachine = 'C:\\Users\\jgroom\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\vs\\workbench\\api\\node\\extensionHostProcess.js';
const remoteMachine = '/home/jgroom/.vscode/extensions/hediet.vscode-drawio.customLibraries';
const installExtension = (machine) => {
const extensionDir = path.join(machine, 'extensions', extensionName);
fs.mkdirSync(extensionDir);
const extensionFile = path.join(extensionDir, 'package.json');
fs.writeFileSync(extensionFile, JSON.stringify({
name: extensionName,
version: '1.0.0',
description: 'Custom libraries for Draw.io',
}));
};
installExtension(localMachine);
installExtension(remoteMachine);
This script installs the extension on both machines simultaneously, using the workspaceFolder
variable to determine the location of the project.
Conclusion
In conclusion, the challenges of remote vs local install can be attributed to the way VSCode handles extension installation. To support extension installation on both local and remote machines simultaneously, we need to understand how VSCode handles extension installation and create a custom extension installation script that installs the extension on both machines simultaneously. By following the steps outlined in this article, developers can work on their projects from anywhere, without having to worry about the extension installation.
Future Work
Future work on this project includes:
- Improving the custom extension installation script: The custom extension installation script can be improved to support more complex extension installation scenarios.
- Supporting multiple extension installations: The custom extension installation script can be modified to support multiple extension installations simultaneously.
- Integrating with VSCode: The custom extension installation script can be integrated with VSCode to provide a seamless extension installation experience.
Introduction
In our previous article, we explored the challenges of remote vs local install and provided a solution to support extension installation on both local and remote machines simultaneously. In this article, we will answer some of the most frequently asked questions about remote vs local install.
Q: What is the difference between remote and local install?
A: Remote install refers to the installation of an extension on a remote machine, such as a WSL (Windows Subsystem for Linux) or a virtual machine. Local install, on the other hand, refers to the installation of an extension on the local machine, such as a Windows or macOS machine.
Q: Why do I need to install an extension on both local and remote machines?
A: You need to install an extension on both local and remote machines because the extension may not work properly if it is only installed on one machine. For example, if you are working on a project that requires the extension to be installed on both local and remote machines, you will need to install it on both machines to ensure that it works correctly.
Q: How do I install an extension on both local and remote machines simultaneously?
A: To install an extension on both local and remote machines simultaneously, you can use a custom extension installation script. This script can be written in a language like JavaScript or Python and can be used to install the extension on both machines at the same time.
Q: What are some common issues that I may encounter when installing an extension on both local and remote machines?
A: Some common issues that you may encounter when installing an extension on both local and remote machines include:
- Extension not working properly: The extension may not work properly if it is only installed on one machine.
- Conflicting extension versions: If you have different versions of the extension installed on different machines, you may encounter conflicts.
- Extension not being recognized: The extension may not be recognized by the remote machine if it is not installed correctly.
Q: How do I troubleshoot issues with extension installation on both local and remote machines?
A: To troubleshoot issues with extension installation on both local and remote machines, you can try the following:
- Check the extension installation logs: Check the logs to see if there are any errors or warnings related to the extension installation.
- Verify the extension installation: Verify that the extension is installed correctly on both machines.
- Check for conflicts: Check for conflicts between different versions of the extension or between the extension and other extensions.
Q: Can I use a single extension installation script for both local and remote machines?
A: Yes, you can use a single extension installation script for both local and remote machines. However, you will need to modify the script to accommodate the differences between the two machines.
Q: How do I integrate the custom extension installation script with VSCode?
A: To integrate the custom extension installation script with VSCode, you can use the VSCode API to automate the extension installation process. This will allow you to install extensions automatically when you open a project VSCode.
Conclusion
In conclusion, remote vs local install can be a complex issue, but with the right tools and knowledge, you can overcome the challenges and install extensions on both local and remote machines simultaneously. By following the steps outlined in this article, you can troubleshoot issues with extension installation and integrate the custom extension installation script with VSCode.
Future Work
Future work on this project includes:
- Improving the custom extension installation script: The custom extension installation script can be improved to support more complex extension installation scenarios.
- Supporting multiple extension installations: The custom extension installation script can be modified to support multiple extension installations simultaneously.
- Integrating with VSCode: The custom extension installation script can be integrated with VSCode to provide a seamless extension installation experience.
By addressing these future work items, we can provide a more robust and efficient extension installation solution that supports both local and remote machines simultaneously.