Search code examples
javascriptvisual-studio-codeprettier

How do I prevent Visual Studio Code from breaking long lines when formatting code?


I'm using the latest Visual Studio Code with Prettier code formatting plugin. The problem is, it breaks long statements like this:

var text = Ext.String.format(gettext("{0} used of {1}"), local_used, local_quota);

Into this:

var text = Ext.String.format(
  gettext("{0} used of {1}"),
  local_used,
  local_quota
);

Is there a way to disable this setting?


Solution

  • Apparently there's no way of doing this globally. Since I only need this plugin for Javascript, I switched to Beautify altogether and changed the default formatter from Prettier to Beautify with a right click -> "Format Document With" -> "Configure Default Formatter...".

    The Beautify plugin seems to keep single line statements as they are.