If you are interested in working in a Linux environment on your Windows system, you will need to have a Linux distribution installed. If you haven’t done so already, please refer to our previous post for instructions on how to install a Linux distribution on Windows.
Once you have your Linux distribution installed, you can proceed with setting up the Windows Subsystem for Linux (WSL) to create a seamless Linux experience on your Windows machine. In this article, we will guide you through the process of installing WSL and the necessary Remote Development extensions on Visual Studio Code (VS Code).
To begin, make sure you have WSL installed on your system. If you don’t have Visual Studio Code installed, you can download it from the official website here. Once you have VS Code installed, follow these steps:
- Open Visual Studio Code.
- Click on the Extensions tab on the right side of the window.
- In the search box, type “wsl” to filter the available extensions.
- Install the “WSL” and “Remote Development” extensions.
- Optionally, you can also install the “Remote Explorer” extension, which allows for easier navigation in and out of your projects.
By installing the WSL and Remote Development extensions, you will be able to synchronize your projects between VS Code on Windows and your Linux distribution. This ensures a smooth development experience, allowing you to seamlessly work with Linux tools and libraries while using the familiar interface of Visual Studio Code.
In conclusion, by following these simple steps, you can set up the necessary components to work in a Linux environment on Windows using the Windows Subsystem for Linux (WSL) and Visual Studio Code. Enjoy the benefits of both worlds and enhance your development workflow.
For more detailed information on this topic, you can visit the original post on kgopinion.com.
Once you have successfully installed the Windows Subsystem for Linux (WSL) and the necessary extensions on Visual Studio Code (VS Code), you are ready to launch the terminal and start working in your preferred Linux distribution. Here’s how you can do it:
- Open your terminal application. In this case, we will be using the integrated terminal in VS Code.
- Click on the arrow-down button located in the top-right corner of the terminal panel. This button allows you to choose the desired terminal shell or Linux distribution.
- From the drop-down menu, select the Linux distribution you have installed. For example, if you have installed Ubuntu, choose the “Ubuntu” option. If you have multiple distributions installed, they will all be listed here.
Opening the ubuntu from the terminal app automatically activates the WSL. To start using it in vs code follow the steps
- check the folder you’re in with ls
- create a new folder or directory you will be keeping your assembly codes with mkdir <foldername>
- change directory to the new folder with cd <foldername>
- run ‘code .’ to open vs code in linux environment
This will activate the wsl and remote development extensions you installed, after all the extensions are activated, you will see something like this
Now that you have set up Visual Studio Code (VS Code) with the Windows Subsystem for Linux (WSL), you can start coding and running your assembly code. To begin, follow these steps:
- Open VS Code and create a new file by clicking on “File” in the top menu and selecting “New File.” Save the file with a
.asmextension, such as
sample.asm. If you already have an assembly file, you can skip this step and use your existing file.
- If you haven’t done so already, you can enhance your assembly programming experience in VS Code by installing the “ASM Code Lens” extension. This extension provides syntax highlighting for assembly code, making it easier to read and understand. You can install extensions by clicking on the Extensions icon in the sidebar (or by pressing
Ctrl+Shift+X), searching for “ASM Code Lens,” and clicking on “Install.”
- To obtain the sample assembly file mentioned in the post, you can download it from the GitHub repository provided. Visit the following link: GitHub Repository.
- Once you are on the GitHub page, navigate to the desired file, such as
hello.asm. Click on the file to view its contents.
- In the GitHub file view, click on the “Raw” button to access the raw content of the file. Copy the entire code.
- Go back to VS Code, paste the copied code into your new or existing assembly file.
Now you are ready to write and run assembly code in VS Code. You can start coding your assembly instructions, making use of the syntax highlighting provided by the “ASM Code Lens” extension. Save your file when you’re done.
After having the code all typed in, now is the time to compile and run. You can run using the terminal in the vs code or the terminal app you installed.
To run an assembly code, we need to
- First compile it into an object code.
- Link it or create an executable file out of the object code.
- Finally run the executable file.
Use ls to check if you’re in the folder you have your .asm file and follow the steps in the image below to get your assembly file running, change the sample.asm to how you saved your file
That’s it, your assembly code should run.
You can check out my github for an automation script to automate the assembling, compiling and running assembly files. A post will be made on how to automate you processes.