VSCode - Remove Line Breaks

computer

Sometimes you want to write a shell command on VSCode first, and then copy and paste it on the terminal, unfortunately that doesn't always go well. A lot of the time, line breaks are the problem, VSCode has a very helpful shortcut to help solve this issue.

Just select the portion of the code you want to remove the break lines and type:

ctrl + j

Before:

var pipeline = [
  {
    $match: {
      "imdb.rating": { $gte: 7 },
      genres: { $nin: ["Crime", "Horror"] },
      rated: { $in: ["PG", "G"] },
      languages: { $all: ["English", "Japanese"] },
    },
  },
];

After:

var pipeline = [ { $match: { "imdb.rating": { $gte: 7 }, genres: { $nin: ["Crime", "Horror"] }, rated: { $in: ["PG", "G"] }, languages: { $all: ["English", "Japanese"] }, }, }, ];

More from Teo Oliver
All posts