<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kim Nguyen</title>
    <description>The latest articles on DEV Community by Kim Nguyen (@kimyvgy).</description>
    <link>https://dev.to/kimyvgy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F205462%2Ff03db237-d091-421a-b71e-43ee983d6cd8.png</url>
      <title>DEV Community: Kim Nguyen</title>
      <link>https://dev.to/kimyvgy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kimyvgy"/>
    <language>en</language>
    <item>
      <title>A Simple CLI for Managing VSCode Workspaces</title>
      <dc:creator>Kim Nguyen</dc:creator>
      <pubDate>Thu, 10 Oct 2024 13:27:15 +0000</pubDate>
      <link>https://dev.to/kimyvgy/a-simple-cli-for-managing-vscode-workspaces-5092</link>
      <guid>https://dev.to/kimyvgy/a-simple-cli-for-managing-vscode-workspaces-5092</guid>
      <description>&lt;p&gt;One common bad practice when using Visual Studio Code (VSCode) is installing all extensions globally, which can make VSCode run more slowly and become resource-intensive. The workspace feature helps mitigate this by allowing you to create workspace-specific settings, such as enabling extensions only for a particular workspace. This keeps your development environment lightweight and tailored to each project.&lt;/p&gt;

&lt;p&gt;To make managing workspaces even easier, I'd like to introduce &lt;code&gt;ws&lt;/code&gt;—a lightweight command-line interface (CLI) that allows you to quickly list and open VSCode workspaces with ease. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m31y1o0oevddyz3yfue.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m31y1o0oevddyz3yfue.gif" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Quick Listing of Workspaces:&lt;/strong&gt; The &lt;code&gt;ws&lt;/code&gt; command instantly lists all available workspace files in the current directory, making it easy to see all your options at a glance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple Workspace Opening:&lt;/strong&gt; By simply providing the name of a workspace file, &lt;code&gt;ws&lt;/code&gt; will launch it directly in VSCode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-platform Support&lt;/strong&gt;: The CLI can work across different operating systems, including macOS, Linux, and Windows.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option 1: Using Homebrew
&lt;/h3&gt;

&lt;p&gt;For users who prefer using &lt;a href="https://brew.sh" rel="noopener noreferrer"&gt;Homebrew&lt;/a&gt;, installing &lt;code&gt;ws&lt;/code&gt; is as simple as running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install phe-lab/tap/ws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 2: Installing via Go
&lt;/h3&gt;

&lt;p&gt;If you have a Go environment set up, you can install ws by using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go get &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; github.com/phe-lab/ws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both methods will install the ws CLI tool, making it readily accessible from your terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 3: Using pre-built binaries
&lt;/h3&gt;

&lt;p&gt;If you prefer not to use &lt;em&gt;Homebrew&lt;/em&gt; or &lt;em&gt;Go&lt;/em&gt;, you can download the appropriate binary for your operating system (e.g., Linux, macOS, or Windows) directly from &lt;a href="https://github.com/phe-lab/ws/releases/latest" rel="noopener noreferrer"&gt;the releases page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Once installed, using ws is straightforward. Here are some common use cases:&lt;/p&gt;

&lt;h3&gt;
  
  
  Listing Workspaces
&lt;/h3&gt;

&lt;p&gt;Simply run the ws command without any arguments to list all available VSCode workspace files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will display all &lt;code&gt;.code-workspace&lt;/code&gt; files found in &lt;code&gt;~/code-workspaces&lt;/code&gt; directory. To change the default directory, define an environment variable called &lt;code&gt;VSCODE_WS_PATH&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export VSCODE_WS_PATH=~/workspaces
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Opening a Workspace
&lt;/h3&gt;

&lt;p&gt;To open a specific workspace, pass the filename of the workspace as an argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ws simple-scrollspy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the workspace file &lt;code&gt;~/code-workspaces/simple-scrollspy.code-workspace&lt;/code&gt; will be launched in VSCode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Debug Mode
&lt;/h3&gt;

&lt;p&gt;For debugging or additional insights into what the CLI is doing, you can enable logging by setting the &lt;code&gt;--debug&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ws &lt;span class="nt"&gt;--debug&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This flag provides more detailed logs that can help troubleshoot any issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;ws&lt;/code&gt; CLI is a handy utility designed for developers who regularly work with multiple VSCode workspaces. It simplifies the process of managing and switching between projects, allowing you to focus on writing code rather than hunting for workspace files. Whether you prefer installing via &lt;em&gt;Homebrew&lt;/em&gt; or &lt;em&gt;Go&lt;/em&gt;, &lt;code&gt;ws&lt;/code&gt; offers a quick and easy solution for boosting your productivity in VSCode.&lt;/p&gt;

&lt;p&gt;Give &lt;code&gt;ws&lt;/code&gt; a try today and streamline your workspace management!&lt;/p&gt;

&lt;p&gt;If you find ws useful, don’t forget to give it a ⭐️ on &lt;a href="https://github.com/phe-lab/ws" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;! Your support helps improve the tool and motivates further development.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
