HookyQR / VSCodeBeautify

Enable js-beautify (https://github.com/beautify-web/js-beautify) in VS Code
MIT License
606 stars 180 forks source link

Prevent formatting of a section #374

Open marcusdiy opened 3 years ago

marcusdiy commented 3 years ago

Hi, is there a way to prevent the formatting of a part of code? Something like Related to https://github.com/microsoft/TypeScript/issues/18261


$youcanformathere = 'as usal';

// @formatter:off
$keep_this_at_it_is = array(
   'a'         => 'firstvalue',
   'b'        => 'secondavalue' 
);
// @formatter:on

$youcanformatheretoo= 'as usal';
msawired commented 3 years ago

This would be really helpful to me as well, in php -> js injections we use on the site: <script> var user = <?= json_encode($user) ?>; </script>

Code above at the moment is broken with beautify: <script> var user = < ? = json_encode($user) ? > ; //doesn't work </script>