Bug #111330 MySQL Workbench formats SQL syntax in single-line comments as live SQL
Submitted: 8 Jun 2023 9:54 Modified: 20 Jun 2023 12:25
Reporter: Richard Brookfield Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: comment, formatting, workbench

[8 Jun 2023 9:54] Richard Brookfield
Description:
Using the default Windows colour scheme, comments appear in blue text on white.

If the comment contains some valid SQL it will be formatted as if it were live SQL, e.g. numbers appear in orange text, braces in black, reserved SQL words appear in bold blue, etc.

How to repeat:
Add the following text comments:

-- 1) Copy the table
-- 2) Modify it to add the audit columns
-- 3) Add 3 triggers to store the changes

The items highlighted in quotes will be formatted other than in the light blue of a standard comment:

-- "1)" Copy the "table"
-- "2) Modify" it "to add" the audit "columns"
-- "3) Add 3 triggers to" store the changes

Note that multi-line comments are corrected formatted, e.g. the same comments:

/*
1) Copy the table
2) Modify it to add the audit columns
3) Add 3 triggers to store the changes
*/

Suggested fix:
Format the entire comment in "standard" format, even if it contains reserved words, SQL syntax, etc.
[19 Jun 2023 12:09] MySQL Verification Team
Hello Richard,

Thank you for the bug report.
Could you please provide screenshot of the issue?

Regards,
Ashwini Patil
[20 Jun 2023 11:14] Richard Brookfield
Formatting incorrect (single line comment) then correct (block comment)

Attachment: MySQL formatting.png (image/png, text), 20.62 KiB.

[20 Jun 2023 11:15] Richard Brookfield
Screenshot added
[20 Jun 2023 12:14] MySQL Verification Team
Hello Richard,

Thank you for the details.
I tried to reproduce your issue on windows 10 with MySQL workbench 8.0.33 but I am not seeing any issues at my end. Please see the attached screenshot. Thanks.

Regards,
Ashwini Patil
[20 Jun 2023 12:15] MySQL Verification Team
8.0.33 test results

Attachment: 111330_test_results.PNG (image/png, text), 84.26 KiB.

[20 Jun 2023 12:25] Richard Brookfield
I'm on Windows 11 here.

Wonder if that makes a difference?
22H2 - 10.0.22621.1848