<?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: Kaushal Patel</title>
    <description>The latest articles on DEV Community by Kaushal Patel (@kaushal197).</description>
    <link>https://dev.to/kaushal197</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%2F244167%2F2440cdd5-3b57-4209-8395-fd3daca7ad21.jpeg</url>
      <title>DEV Community: Kaushal Patel</title>
      <link>https://dev.to/kaushal197</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kaushal197"/>
    <language>en</language>
    <item>
      <title>
VSCode 101 – Learn 20% for 80% efficiency</title>
      <dc:creator>Kaushal Patel</dc:creator>
      <pubDate>Tue, 23 Feb 2021 16:57:40 +0000</pubDate>
      <link>https://dev.to/kaushal197/vscode-101-learn-20-for-80-efficiency-1256</link>
      <guid>https://dev.to/kaushal197/vscode-101-learn-20-for-80-efficiency-1256</guid>
      <description>&lt;p&gt;VSCode has become the hot tool in development. We don't all have to like it, but you can't deny it is the most used development tool with over &lt;a href="https://insights.stackoverflow.com/survey/2019#development-environments-and-tools"&gt;50% of developers using it for their daily work.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The flexibility of VSCode is what makes it such a solid tool for various forms of development. Out of the box, it's a super simple text editor. There is never a reason to use any of its fancy tooling or community created extensions, however, if you really want to make the most of VSCode here are the 5 key areas you need to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;*Disclaimer!!*&lt;/strong&gt;&lt;em&gt;: Most of the shortcuts will state **Cmd&lt;/em&gt;&lt;em&gt;, kindly translate this to **Ctrl&lt;/em&gt;* if you use a non-MacOS related device.* &lt;/p&gt;

&lt;h2&gt;
  
  
  Navigation
&lt;/h2&gt;

&lt;p&gt;This editor is FULL of keyboard shortcuts, a lot of them come in handy for traversing the crazy number of tabs we mindlessly open up. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Cmd + P&lt;/code&gt;&lt;/strong&gt;: Quickly Jump to File&lt;/p&gt;

&lt;p&gt;If you don't know of this one already it's a superpower! You don't even have to be great at spelling, VSCode is really good at shortlisting the possible file(s) you may be looking for.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DiwYNYXj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/jump_to_file.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DiwYNYXj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/jump_to_file.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another great way to traverse around without having the file explorer open is the top path bar; it's a hidden gem I recently learned about. You can click on the file or folder in the path, and it expands to let you pick any file sitting beside it. Check it out:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ksFnAcKg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/path_bar.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ksFnAcKg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/path_bar.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since VSCode is based on Electron, you use the tab switching shortcut from Chrome + Terminal + Firefox... basically most applications that have tabs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Cmd + Shift + [ or ]&lt;/code&gt;&lt;/strong&gt;: Go to Left or Right Tab&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_Jiu2dIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/tab_shifting.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Jiu2dIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/tab_shifting.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intellisense
&lt;/h2&gt;

&lt;p&gt;Intellisense is my favourite component to VSCode, it's so seamless. VSCode gives you very basic static analysis and refactoring capabilities depending on the type of file you're editing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Ctrl + Space&lt;/code&gt;&lt;/strong&gt;: Activate autocomplete feature for item under cursor&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e10FxESZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/autocomplete.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e10FxESZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/autocomplete.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The editor also showcases all of the properties, methods, and blocks of the current file in the &lt;code&gt;Outline&lt;/code&gt; window (Bottom-Left). This can be opened from the Command Palette we used previously to navigate by simply entering &lt;code&gt;@&lt;/code&gt;. You can use the Command Palette like this to navigate within your active file with either &lt;code&gt;@&lt;/code&gt; or &lt;code&gt;:&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W31nu0dJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/jump_to_section.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W31nu0dJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/jump_to_section.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The real meat of intellisense comes in it's refactoring capabilities! I will showcase my most used feature and leave the rest for you to explore. Did you know you can rename a variable safely across your whole codebase? &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UWcbUO0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/rename.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UWcbUO0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/rename.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was only able to show an example from a local function in my project. Try it in your own codebase, it will affect the naming for all appropriate instances.&lt;/p&gt;

&lt;h2&gt;
  
  
  VCS/Git
&lt;/h2&gt;

&lt;p&gt;I like using the command line for Git personally, on the other hand a lot of my co-workers say a GUI Git tool is the best.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--owhqkoqs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/whatever.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--owhqkoqs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://kaushalpatel.ca/images/whatever.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whichever option you choose, the out-of-the-box VCS and Git feature is useful. It's so powerful with diff-checking, conflicts, tracking by file, etc.... For command line users, this can be a time-saver. For GUI users, this means one less application to open and have running on your machine. To me, this is a win/win.&lt;/p&gt;

&lt;p&gt;You can access the VCS window on the left-hand side (it looks like the Git logo). It's pretty difficult to cover everything it has to offer without adding a million images, but the big thing to note are the vertical ellipsis and the quick options when hovering over a file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pya0MzfC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kaushalpatel.ca/images/VCS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pya0MzfC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kaushalpatel.ca/images/VCS.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refined and common Git commands can be accessed by clicking the ellipsis. The &lt;strong&gt;plus&lt;/strong&gt; lets you add all changes to the next commit, whilst the &lt;strong&gt;hooked arrow&lt;/strong&gt; lets you rollback all changes. When you click on a file, the diff will be shown in the main window as a split between old and new. Get used to checking this tab and running through your files before committing!! It has saved me from minor mistakes and endless build times on multiple occasions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--chVgw39D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kaushalpatel.ca/images/diff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--chVgw39D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kaushalpatel.ca/images/diff.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if only there was a way to review PRs in VSCode when using Github enterprise. If any of you know of a tool like this, please DM me on &lt;a href="https://twitter.com/talesofadev"&gt;Twitter&lt;/a&gt; 🙏&lt;/p&gt;

&lt;h2&gt;
  
  
  Zen Mode
&lt;/h2&gt;

&lt;p&gt;Let your mind be free of distractions 📿 &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cmd + K -&amp;gt; Z&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you can use this mode effectively, you know you have mastered VSCode&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Extensions
&lt;/h2&gt;

&lt;p&gt;I think we all know about Extensions, they are essentially plugins to help with specific issues/expansions you want for the editor. As a web developer I use a few productivity and tracking extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Todo Tree&lt;/li&gt;
&lt;li&gt;Todo Highlight&lt;/li&gt;
&lt;li&gt;Prettier&lt;/li&gt;
&lt;li&gt;GitLens&lt;/li&gt;
&lt;li&gt;Language-specific extensions&lt;/li&gt;
&lt;li&gt;Bonus: Themes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://twitter.com/talesofadev"&gt;Follow me on Twitter&lt;/a&gt; for updates on my ebook: &lt;code&gt;Git Animated - A Visual Guide to Understanding Git&lt;/code&gt; 😎&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Let me convince you why you should use Chrome's REAL debugger and not `console.log`</title>
      <dc:creator>Kaushal Patel</dc:creator>
      <pubDate>Thu, 04 Feb 2021 14:08:51 +0000</pubDate>
      <link>https://dev.to/kaushal197/let-me-convince-you-why-you-should-use-chrome-s-real-debugger-and-not-console-log-20eb</link>
      <guid>https://dev.to/kaushal197/let-me-convince-you-why-you-should-use-chrome-s-real-debugger-and-not-console-log-20eb</guid>
      <description>&lt;p&gt;We've all been introduced to the Chrome DevTools as new devs... heck, even regular users messing around with the browser have discovered the "Inspect Element" tool. As a dev, you will have learned about using &lt;code&gt;console.log&lt;/code&gt; to print variables and logic to the "console" on the browser. This is all normal in the passage of a fresh web developer, however lot of devs never take full advantage of the Chrome DevTools.&lt;/p&gt;

&lt;p&gt;Do you still use &lt;code&gt;console.log&lt;/code&gt; as your sole debugging tool? There is a high chance that it's wasting you a lot of time when it comes to modern Frontend development for the web.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;console.log&lt;/code&gt; is a viable logging tool, but as a debugger it lacks a lot vision. Let's take some sample projects and compare the two tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  console.log
&lt;/h2&gt;

&lt;p&gt;Here's an example of how we could log out json data that our application uses. Take note of how we have to log json out as a string. This means we cannot actually traverse the json; it'll be printed out as a flat string.&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%2Fi%2Faby85hl2px2uvvnh5ky0.png" 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%2Fi%2Faby85hl2px2uvvnh5ky0.png" alt="console log in code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is the output we get from logging our product and cart data.&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%2Fi%2Fa6s7ge8xbxo9pse1a86s.png" 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%2Fi%2Fa6s7ge8xbxo9pse1a86s.png" alt="console log in DevTools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The effort it takes to explore this data is a little daunting. It's so easy to get stuck in a bad "debugging loop" with logging data that goes something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Add logging 
2. Analyze what was logged
3. Realize we need more info
4. Repeat steps 1-3 until bug is found or we have an understanding of the issue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This seems like a fine solution for most, but we spend so much time: trying to re-serve the application, figuring out where and when data needs to be logged, understanding how all of the data interacts with itself........&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%2Fi%2F8nigosylqacye7vy7dhf.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%2Fi%2F8nigosylqacye7vy7dhf.gif" alt="sweaty"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Chrome DevTools
&lt;/h2&gt;

&lt;p&gt;So, how can Chrome DevTools make this process any easier? &lt;/p&gt;

&lt;p&gt;DevTools provides a proper debugger that can be manipulated in real-time. It displays the relevant data when a breakpoint is hit, shows the current call stack, and lets us use all of that in the console with temp globals. If we look back at our "debugging loop", we saved so much time by avoiding spinning up the app and hunting down exactly where to log info from. &lt;/p&gt;

&lt;p&gt;It's all provided in the DevTools: all we have to do is set a breakpoint c:&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%2Fi%2Ffrgfiwkzrpcw3yhdtp2s.png" 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%2Fi%2Ffrgfiwkzrpcw3yhdtp2s.png" alt="Breakpoint and scope"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most useful "feature" that completely sells DevTools for me is that it is time-centric rather than data-centric. With &lt;code&gt;console.log&lt;/code&gt;, we try to decipher what/when something happened with the information we log. Debugging with DevTools lets us actively walk through the running application, allowing us to see the flow of our data and logic. Example:&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%2Fi%2F11d6x1ver3632709pulf.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%2Fi%2F11d6x1ver3632709pulf.gif" alt="DevTools debugging"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This feels like a superpower to me. I can actively walk through how my code is executed and watch the data be affected. Doing the same with &lt;code&gt;console.log&lt;/code&gt; requires a lot of assumptions to be made based on the information logged. I think I've made it pretty clear, Chrome DevTools is a pretty effecient debugger, but that doesn't discredit &lt;code&gt;console.log&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Every tool has its time and place.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you NEED to use Chrome DevTools
&lt;/h2&gt;

&lt;p&gt;I'll argue there is one reason we MUST use the Chrome DevTools, and that's to understand network requests. As a web developer, you almost definitely work with REST calls (or any other network related call). Javascript natively does not allow us to hook onto requests. Chrome DevTools to the rescue! Open the Network tab before the request is triggered; it'll record all network calls being made. This has been a lifesaver when it comes to spotting subscription leaks in RxJS, malformed request bodys, request failures, etc.&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%2Fi%2Fxr2tx1diaruqwk7bka4z.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%2Fi%2Fxr2tx1diaruqwk7bka4z.gif" alt="Network"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Truth
&lt;/h2&gt;

&lt;p&gt;Yes, we can absolutely stick to just using &lt;code&gt;console.log&lt;/code&gt; for all your debugging needs. My first employer runs a web solutions business with over 200 regular clients... he solely relies on &lt;code&gt;console.log&lt;/code&gt;. I understand he does this due to comfort and feeling in his "zone" logging everything, but if he took an hour to understand the DevTools that come with his browser, his work would be friendlier. &lt;/p&gt;

&lt;p&gt;Chrome DevTools comes with a lot out of the box and that can feel very intimidating. I only described two parts to all of the Chrome DevTools assortment!! As a new dev, this is the main reason we skip using them and never come back. We end up sticking to console logging all our issues in hopes of finding the bug sooner or later.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
