<?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: Marton Kodok</title>
    <description>The latest articles on DEV Community by Marton Kodok (@martonkodok).</description>
    <link>https://dev.to/martonkodok</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F832576%2F4995de0e-7935-48b7-b113-f1562bf3e936.jpg</url>
      <title>DEV Community: Marton Kodok</title>
      <link>https://dev.to/martonkodok</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/martonkodok"/>
    <language>en</language>
    <item>
      <title>Introducing “GCP Project Switcher” Extension for VS Code — My Weekend Project</title>
      <dc:creator>Marton Kodok</dc:creator>
      <pubDate>Fri, 18 Mar 2022 15:21:21 +0000</pubDate>
      <link>https://dev.to/martonkodok/introducing-gcp-project-switcher-extension-for-vs-code-my-weekend-project-41mo</link>
      <guid>https://dev.to/martonkodok/introducing-gcp-project-switcher-extension-for-vs-code-my-weekend-project-41mo</guid>
      <description>&lt;p&gt;Writing, debugging and deploying from &lt;strong&gt;Visual Studio Code&lt;/strong&gt; for &lt;strong&gt;Google Cloud Platform&lt;/strong&gt; is working out great as you have multiple options to interact with &lt;strong&gt;Google Cloud&lt;/strong&gt; products:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the Terminal pane, to use the &lt;a href="https://cloud.google.com/sdk/docs/quickstart"&gt;gcloud&lt;/a&gt; command-line tool&lt;/li&gt;
&lt;li&gt;by using &lt;a href="https://code.visualstudio.com/docs/editor/tasks"&gt;VSCode Tasks&lt;/a&gt; to automate commands [&lt;a href="https://gist.github.com/pentium10/b5c260f060dcdbe8a9882189bf59f9e7"&gt;my setup&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cloud.google.com/code"&gt;Cloud Code&lt;/a&gt; toolbox&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these work based on the **project **that your environment is setup.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;However, the VS Code screen was missing key info: &lt;strong&gt;displaying the current project&lt;/strong&gt;. There was no easy way to switch projects from the IDE. Until now!&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Introducing the “&lt;a href="https://marketplace.visualstudio.com/items?itemName=pentium10.vscode-gcp-project-switcher"&gt;GCP Project Switcher&lt;/a&gt;” extension for VS Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OUCypVr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lt8ey2xin47a9yu606xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OUCypVr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lt8ey2xin47a9yu606xw.png" alt="“GCP Project Switcher” extension for VS Code" width="880" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A weekend project with Typescript
&lt;/h2&gt;

&lt;p&gt;So, this weekend, I had some free time as it was without any conference speaking opportunity which I usually do. The weekend turned out to be productive as I was able to release the extension after two days of small work. Also, I share a secret, this is my first project written in Typescript that got into “production”. It was a nice way to learn how Typescript works, compiles and runs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Developers love to see on which Git &lt;strong&gt;branch&lt;/strong&gt; are. I always was fascinated by how these are smartly applied to &lt;strong&gt;shell’s&lt;/strong&gt;, &lt;strong&gt;screen&lt;/strong&gt; and &lt;strong&gt;tmux&lt;/strong&gt; instances on Linux systems.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Turns out on VS Code you are able to create your own extension that would add functionality to almost any section of the IDE, but  my interest was for the status bar.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://marketplace.visualstudio.com/items?itemName=pentium10.vscode-gcp-project-switcher"&gt;GCP Project Switcher&lt;/a&gt; extension creates a status bar item. It uses the &lt;code&gt;gcloud&lt;/code&gt; tool to obtain the current project, and it’s refreshed in the background so external changes are handled.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AsZfCOQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfiif0gewomq7oklhjvx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AsZfCOQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfiif0gewomq7oklhjvx.png" alt="VSCode status bar with GCP Project Switcher Extension installed." width="708" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When clicking the status bar item a &lt;em&gt;quick pick pane&lt;/em&gt; opens, and you are able to &lt;em&gt;search&lt;/em&gt; either by project name or by ID. In order for the pane to be fast — as pulling projects list has a latency — all the polling is done in the background and it’s cached.&lt;/p&gt;

&lt;p&gt;Suppose there is a new project that is not on the list, there is a &lt;strong&gt;refresh&lt;/strong&gt; icon to force polling the projects lists. This helps to get started quickly on newly created projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yl2OzXYg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99iefj1oe9zv1meaa1y9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yl2OzXYg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99iefj1oe9zv1meaa1y9.png" alt="Google Cloud Platform Project Switcher pane" width="880" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Limitations&lt;/strong&gt;: the &lt;code&gt;gcloud&lt;/code&gt; utility must be available in your &lt;strong&gt;PATH&lt;/strong&gt;, as the extension is using that to poll and switch the project on your environment. I plan to add a configuration option to customize the path of the gcloud tool for those who don’t have it globally available in the PATH.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Future work is already planned, I want to maintain a list of “recent” used projects, and populate the list with the recent projects at the top.&lt;/p&gt;

&lt;p&gt;Grab the extension either from VS Code Extensions pane, or from &lt;a href="https://marketplace.visualstudio.com/items?itemName=pentium10.vscode-gcp-project-switcher"&gt;Marketplace&lt;/a&gt;. Also you can post a Review and Rating in the Marketplace.&lt;/p&gt;

&lt;p&gt;The extension is open-source, you can contribute via &lt;a href="https://github.com/pentium10/vscode-gcp-project-switcher"&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;: A sample &lt;a href="https://gist.github.com/pentium10/b5c260f060dcdbe8a9882189bf59f9e7"&gt;.vscode/tasks.json&lt;/a&gt; definition to deploy a Cloud Workflow, the Quick Run pane extensions is &lt;a href="https://marketplace.visualstudio.com/items?itemName=davehart.quick-run-panel"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--irRq7uOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev0n4q5qo7qg5v5h6egf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--irRq7uOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev0n4q5qo7qg5v5h6egf.png" alt="Image description" width="880" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>googlecloud</category>
      <category>gcp</category>
      <category>gcloud</category>
    </item>
  </channel>
</rss>
