vscode-sql-formatter icon indicating copy to clipboard operation
vscode-sql-formatter copied to clipboard

SQL formatter incorrectly formats exponential numbers

Open gamersover opened this issue 2 years ago • 0 comments

When using the SQL formatter in VS Code, I noticed that it incorrectly formats exponential numbers, specifically expressions like 1e-9. Instead of keeping the exponent notation together, it adds a space between the e and the negative sign, resulting in 1e -9.

This is problematic because it can cause syntax errors when running queries in certain SQL engines, especially those that are more strict with formatting rules.

Steps to Reproduce:

Write a SQL query that includes an expression with an exponential number (e.g. SELECT 1e-9) Use the "Format Document" command or shortcut (e.g. Shift + Alt + F) Observe that the exponential number is incorrectly formatted with a space between the e and negative sign (e.g. 1e -9) Expected Behavior: The SQL formatter should keep the e and negative sign together in exponential numbers, so 1e-9 should remain 1e-9 after formatting.

Actual Behavior: The SQL formatter incorrectly adds a space between the e and negative sign, resulting in 1e -9.

Environment:

VS Code version: 1.76.1 SQL Formatter extension version: 1.4.0 Operating System: Mac os monterey

Thanks for your attention to this issue.

gamersover avatar Mar 14 '23 09:03 gamersover