Skip to content

SQL formatter incorrectly formats exponential numbers #45

@gamersover

Description

@gamersover

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions