Visar inlägg med etikett Visual Studio Code. Visa alla inlägg
Visar inlägg med etikett Visual Studio Code. Visa alla inlägg

tisdag 15 januari 2019

How to compare text files using Visual Studio Code or Notepad++

The need to compare

Sometimes I've had a need to compare two text files against each other, for example

  • to make sure that they were exactly identical
  • or to spot a minor difference among lots of text 
  • or just to make sure that the differences made sense, like when comparing configuration files for test and production environments.
Back in the days when I was using TortoiseSvn, it was as easy as selecting the two files, right click and select "SVN Diff" from the menu, as described here. Nowadays I do something of the following alternatives.

Compare in Visual Studio Code

Suppose you want to compare two files, "First.txt" and "Second.txt". 
  • Open them in VS Code
  • Make sure the explorer in VS Code is expanded
  • In explorer, right click one of the files and select "Select for Compare"
  • Then right click the other file and select "Compare with Selected"
  • See the diff






Compare in Notepad++

To compare files in Notepad++ you need to install a plugin. This was easily done in the plugin manager before, but it is no longer there, so you have to download the plugin and copy it to the Notepad++ plugin folder.
  • Download the compare plugin
    I'm using the 32-bit Notepad++ so I downloaded the x86 version
  • Unzip to
    C:\Program Files (x86)\Notepad++\plugins
  • Start Notepad++, open the "Plugin" menu and look for "Compare"
  • Open the files in Notepad++, select
    Plugins => Compare => Compare
  • To close the comparison, select
    Plugins => Compare => Clear Active Compare




söndag 11 mars 2018

Multi-cursor editing in Visual Studio Code, edit many places simultaneously!

Did some pair programming with @nevva and saw him do some multi-cursor editing in Visual Studio Code I hadn't seen before. So here's three different ways to edit your text files at multiple places simultaneously.

Use Esc to exit multi-cursor mode.

1. Ctrl + Alt + arrow down (or arrow up)
A simpler variant of this in the classic Visual Studio is Shift + Alt + any arrow


2. Alt + left mouse click


3. Mark some text => all occurrences gets highlighted
Ctrl + Shift + L => every occurrence gets its own cursor