Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️

If you’re a tech lead who spends a lot of time reviewing code and helping others, you know how crucial it is to be efficient. Over time, I’ve set up some handy keyboard shortcuts in Visual Studio Code (VSCode) that make my life a whole lot easier. Let …


This content originally appeared on DEV Community and was authored by Krzysztof Platis

If you're a tech lead who spends a lot of time reviewing code and helping others, you know how crucial it is to be efficient. Over time, I've set up some handy keyboard shortcuts in Visual Studio Code (VSCode) that make my life a whole lot easier. Let me show you my keybindings.json and how these shortcuts can help you too.

Switch Between Diff and Source

Switching between the diff view and the source view can be such a hassle, especially during code reviews.

These shortcuts make it super easy:

// Toggle between file diff and file source when in a diff editor
{
  "key": "cmd+ctrl+f",
  "command": "git.openFile",
  "when": "editorFocus && isInDiffEditor"
},
// Toggle between file source and file diff when not in a diff editor
{
  "key": "cmd+ctrl+f",
  "command": "git.openChange",
  "when": "editorFocus && !isInDiffEditor"
}

How to Use: Just hit cmd+ctrl+f to switch between the diff and source views, no matter where you are. It feels like magic!

Quick GitHub Links

I share specific lines of our codebase from GitHub all the time. These shortcuts make copying and opening GitHub permalinks a breeze:

// Copy GitHub permalink
{
  "key": "shift+cmd+c",
  "command": "issue.copyGithubPermalink"
},
// Open GitHub permalink
{
  "key": "shift+cmd+x",
  "command": "issue.openGithubPermalink"
}

How to Use: Press shift+cmd+c to copy a permalink to your clipboard and shift+cmd+x to open a permalink right in your browser. So simple and fast!

See Tree of All Changed Files

During code reviews, I often need to switch between the tree of changed files and the tree of all files in the repo. This shortcut makes that transition seamless:

// Focus on the active pull request
{
  "key": "shift+cmd+l",
  "command": "github:activePullRequest.focus"
}

How to Use: With the official GitHub Pull Request extension installed, press shift+cmd+l to quickly focus on the active pull request. This keeps your workflow smooth and uninterrupted. When you need to switch to a tree of all files in the project, you can use the default shortcut shift+cmd+e.

Navigate Changes in File

When you're deep into a code review, navigating through changes efficiently is key. These shortcuts help you jump between changes within a single file effortlessly, without needing to manually scroll to the next change:

// Go to the next change in the compare editor
{
  "key": "ctrl+shift+down",
  "command": "workbench.action.compareEditor.nextChange",
  "when": "textCompareEditorVisible"
},
// Go to the previous change in the compare editor
{
  "key": "ctrl+shift+up",
  "command": "workbench.action.compareEditor.previousChange",
  "when": "textCompareEditorVisible"
},

How to Use: Use ctrl+shift+down to jump to the next change and ctrl+shift+up to go back to the previous change in the compare editor. This makes navigating through changes in your code reviews quick and efficient.

Wrapping Up

These custom VSCode shortcuts have saved me tons of time and made my work a lot smoother. Whether you’re reviewing code, sharing GitHub links or switching between diff and source file of your own changes, these shortcuts can seriously up your game. Give them a try and see how much easier your workflow can get!


This content originally appeared on DEV Community and was authored by Krzysztof Platis


Print Share Comment Cite Upload Translate Updates
APA

Krzysztof Platis | Sciencx (2024-06-19T20:42:09+00:00) Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️. Retrieved from https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/

MLA
" » Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️." Krzysztof Platis | Sciencx - Wednesday June 19, 2024, https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/
HARVARD
Krzysztof Platis | Sciencx Wednesday June 19, 2024 » Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️., viewed ,<https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/>
VANCOUVER
Krzysztof Platis | Sciencx - » Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/
CHICAGO
" » Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️." Krzysztof Platis | Sciencx - Accessed . https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/
IEEE
" » Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️." Krzysztof Platis | Sciencx [Online]. Available: https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/. [Accessed: ]
rf:citation
» Boost Your Code Review Game with Custom VSCode Shortcuts ⌨️ | Krzysztof Platis | Sciencx | https://www.scien.cx/2024/06/19/boost-your-code-review-game-with-custom-vscode-shortcuts-%e2%8c%a8%ef%b8%8f/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.