Issue #26  (Git Committing a Selected Range)10/19/22

Advertisement
Get a weekly dose of tools, articles, and other resources covering remote work, productivity, career well-being, and lots more.

A neat little feature in VS Code's source control panel is the ability to stage and commit a selected range from the code you're working on.

As an example, let's say I'm working in a JavaScript file and I've added a few new functions to that file. I might have added two functions that do different things. If I commit all the changes, my commit message will likely be a bit vague, something like "Added two JS functions".

What I would prefer is to commit each function separately so my commit messages make sense. This way, if I have to revert something, it's easy to see the exact change in each commit message.
 
Adding multiple functions to a JS file

With selected ranges, I can do exactly that. To do this, I'll open VS Code's source control panel then click on the changed file in the "Changes" section. This should open up a split view where I can see the changes to the file. In there, I'll select only the portion I want to commit.

Once the selection is made, I can either use the command palette or click the "More Actions" (three dots) button in the top right.
 
Using VS Code's Stage Selected Ranges feature

In the menu, I can choose from one of three options related to selected ranges. In this case I would choose "Stage Selected Ranges".

From there I can commit and push my changes while including a specific and more practical commit message. In this case I might write "Added doAnalytics() function". Now I know that if something breaks, it's definitely this function that caused the problem and I'm not left wondering.

I can repeat the same process for the other function I added, then write my new commit message accordingly.
 
Committing changes in VS Code

Pretty useful to be able to do this with such precision. This definitely makes your commit messages more readable and usable should you have problems in the future.
 
Now on to this week's hand-picked links!

 
 

VS Code Tools

Vue Language Features — A language support extension built for Vue, Vitepress and petite-vue. Based on @vue/reactivity to calculate everything on-demand, to implement native TypeScript language service level performance.

Codex — A VS Code extension that allows engineers to attach comments, questions, notes, or any kind of content to specific lines of code. Support for IntelliJ IDEA is in the works as well.

Cake Build — Adds language support to VS Code for Cake build scripts (i.e. C# based build scripts).

Debug Visualizer — VS Code extension that adds a visual watch window that lets you visualize your data structures while debugging.

Kubernetes Tools — A popular VS Code extension from Microsoft, for developers building applications to run in Kubernetes clusters and for DevOps staff troubleshooting Kubernetes applications.
 

VS Code Articles

VS Code 1.72 (September 2022 Updates) — The latest VS code updates include toolbar customizations, extension view updates, pin tasks, markdown link validation, and more.

7 Lesser-Known VS Code Shortcuts to Speed Up your Development — Some useful shortcuts you might want to consider learning, each with a GIF demo.

Create and Publish the VS Code Extension to the Marketplace — A fairly extensive step-by-step look at extension development for VS Code, with the all-important step of actually publishing to the marketplace.

Morning Brew — A 5-minute daily email that makes reading the news enjoyable. Stay informed and entertained, for free.   Sponsor 

Best of the Rest

CodeGeeX — A large-scale multilingual code generation model with 13 billion parameters, pre-trained on a large code corpus of more than 20 programming languages.

JavaScript Makeup — Another option for a JavaScript playground that features a console and a minimap for navigating code.

wrighter — A minimal yet powerful web-based markdown editor, no signup required.


Suggestions?

If you have any link suggestions, including a tool, article, or other resources related to VS Code or another IDE, send it via DM on X: @LouisLazaris or just hit reply on this email.

That's it for this issue.

Happy VS Coding!
Louis
VSCode.Email
@LouisLazaris
Copyright © VSCode.Email. All rights reserved.

Not affiliated with Microsoft, Visual Studio Code, or any of its trademarks.