Hi - I prefer the functionality to format JS code in Webuilder 2022 - specifically the formatting options
Webuilder 2022 - after formatting (for myself nice and neat)
var weekday =["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",];
WeBuilder 2025 - after formatting (for myself - not necessary, to much white space, to many lines)
var weekday = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
];
I cannot find an option to control this behaviour.
Format javascript code Webuilder 2022 vs 2025
Moderator: kfury77
Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
Please try to follow these guidelines. This will help to receive faster and more accurate response.
- Check the Support section of the corresponding product first. Chances are you will find your answer there;
- Do not create new topics for already reported problems. Add your comments to the existing topics instead;
- Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
- Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
- Include the version number of the software you are using;
- This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Re: Format javascript code Webuilder 2022 vs 2025
Hi - in JavaScript formatter dialog, go to Misc tab and set "Line width for wrapping" to something larger e.g. 150 - this controls when your long lines get split for readability. And in "JavaScript" tab you can set quote style to Double quotes.
Blumentals Software Programmer
Re: Format javascript code Webuilder 2022 vs 2025
Hi - Thanks for the reply. I set "Line width for wrapping" to 155 then 255 + quote style to Double quotes.
The above changes did fix the problem with the example code but still changes:
/* I know - doc.write not so good - However it is exactly what I want as it deletes all HTML */
var mylinkstyle = "<style> a:link { color: black; text-decoration: none;} \
a:visited { color: black; text-decoration: none; } \
a:hover { color: grey; text-decoration: none !important;} \
</style>";
document.write(mylinkstyle,
" ", dayname, " ", day, " ", monthname, " ", year,
" ", hours, ":", min, ampm, " ",
"<a href='#'title='(Week #)'>(", weeknum, ")</a> ",
"<a href='#'title='(Day #-Days to end / # in Year)'>(", daynum, "-",
daytoend, " / ", yeardays, ")</a>");
TO:
/* I know - doc.write not so good - However it is exactly what I want as it deletes all HTML */
var mylinkstyle =
"<style> a:link { color: black; text-decoration: none;} \
a:visited { color: black; text-decoration: none; } \
a:hover { color: grey; text-decoration: none !important;} \
</style>";
document.write(
mylinkstyle,
" ",
dayname,
" ",
day,
" ",
monthname,
" ",
year,
" ",
hours,
":",
min,
ampm,
" ",
"<a href='#'title='(Week #)'>(",
weeknum,
")</a> ",
"<a href='#'title='(Day #-Days to end / # in Year)'>(",
daynum,
"-",
daytoend,
" / ",
yeardays,
")</a>"
);
I prefer to leave line width to 90. The above problem is only in 2025 not 2022.
Thanks Bill D.
The above changes did fix the problem with the example code but still changes:
/* I know - doc.write not so good - However it is exactly what I want as it deletes all HTML */
var mylinkstyle = "<style> a:link { color: black; text-decoration: none;} \
a:visited { color: black; text-decoration: none; } \
a:hover { color: grey; text-decoration: none !important;} \
</style>";
document.write(mylinkstyle,
" ", dayname, " ", day, " ", monthname, " ", year,
" ", hours, ":", min, ampm, " ",
"<a href='#'title='(Week #)'>(", weeknum, ")</a> ",
"<a href='#'title='(Day #-Days to end / # in Year)'>(", daynum, "-",
daytoend, " / ", yeardays, ")</a>");
TO:
/* I know - doc.write not so good - However it is exactly what I want as it deletes all HTML */
var mylinkstyle =
"<style> a:link { color: black; text-decoration: none;} \
a:visited { color: black; text-decoration: none; } \
a:hover { color: grey; text-decoration: none !important;} \
</style>";
document.write(
mylinkstyle,
" ",
dayname,
" ",
day,
" ",
monthname,
" ",
year,
" ",
hours,
":",
min,
ampm,
" ",
"<a href='#'title='(Week #)'>(",
weeknum,
")</a> ",
"<a href='#'title='(Day #-Days to end / # in Year)'>(",
daynum,
"-",
daytoend,
" / ",
yeardays,
")</a>"
);
I prefer to leave line width to 90. The above problem is only in 2025 not 2022.
Thanks Bill D.
Re: Format javascript code Webuilder 2022 vs 2025
Were you actively using the old formatter? We might bring it back as a legacy command, but it's really old and every time I've tried to use it, I could not find the configuration that formats well in the modern style. The philosophy behind the new formatter is to make every code look the same so that any programmer can effortlessly read code of another programmer and it's the most popular formatter now.
Blumentals Software Programmer
Re: Format javascript code Webuilder 2022 vs 2025
One more thing - you can add this before the line that you don't want changed:
// prettier-ignore
// prettier-ignore
Blumentals Software Programmer
Re: Format javascript code Webuilder 2022 vs 2025
Hi - Thanks for the reply
Yes indeed - I am still using the "old formatter"!
Your suggestion to use // prettier-ignore works, I only need 4 of these, so problem solved. Is "// prettier-ignore" etc documented anywhere?
Let me explain where I coming from. On my small laptop, the statements that are broken(on every comma) into many separate lines do not even show one complete line of code while only using about a 1.5 inch column down the left of my screen. The saving grace is - I have a very nice background.
Back in the day, and I'm going to give away my age here - I use to use Punch Cards! Your new formatter would have significantly increased the stack of cards. Also use to use a line editor on a hard copy terminal that, with some long forgotten command, would display the current line plus 3 lines above and below, quite a paper gobbler.
I hope that the above has at the least given a bit of a chuckle.
Thanks for producing an excellent editor which I enjoy using, just can't keep away from a keyboard. In my opinion editors such as yours have made a significant contribution to quality, readable and understandable code.
Anyone figure out my age, last column.
Cheers Bill D.
Yes indeed - I am still using the "old formatter"!
Your suggestion to use // prettier-ignore works, I only need 4 of these, so problem solved. Is "// prettier-ignore" etc documented anywhere?
Let me explain where I coming from. On my small laptop, the statements that are broken(on every comma) into many separate lines do not even show one complete line of code while only using about a 1.5 inch column down the left of my screen. The saving grace is - I have a very nice background.
Back in the day, and I'm going to give away my age here - I use to use Punch Cards! Your new formatter would have significantly increased the stack of cards. Also use to use a line editor on a hard copy terminal that, with some long forgotten command, would display the current line plus 3 lines above and below, quite a paper gobbler.
I hope that the above has at the least given a bit of a chuckle.
Thanks for producing an excellent editor which I enjoy using, just can't keep away from a keyboard. In my opinion editors such as yours have made a significant contribution to quality, readable and understandable code.
Anyone figure out my age, last column.
Cheers Bill D.
-
- Posts: 1
- Joined: Tue May 16, 2023 6:44 am
Re: Format javascript code Webuilder 2022 vs 2025
Webuilder 2025 may automatically space out arrays when formatting, but you can manually edit the array format to reduce the white space following these steps:
Select the array code.
Use Ctrl + Shift + F to format, then manually remove extra spaces or line breaks. This won't be a perfect solution if you're formatting frequently Block Blast, but it might help until the program matches your preferences.
Select the array code.
Use Ctrl + Shift + F to format, then manually remove extra spaces or line breaks. This won't be a perfect solution if you're formatting frequently Block Blast, but it might help until the program matches your preferences.
Re: Format javascript code Webuilder 2022 vs 2025
If WeBuilder 2025 still doesn’t offer enough granularity in formatting controls, you may want to consider using external code formatting tools that can be configured to your exact specificationsspace waves, and then you can copy-paste the formatted code into WeBuilder.