Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inhibit formatting for specific lines? #43

Open
JDeeth opened this issue Oct 20, 2022 · 0 comments
Open

Inhibit formatting for specific lines? #43

JDeeth opened this issue Oct 20, 2022 · 0 comments

Comments

@JDeeth
Copy link

JDeeth commented Oct 20, 2022

I write a lot of SQL queries for SAP BusinessObjects reports. These have a @Prompt expression which allows the statement to take input from the user when it is run. Unfortunately, these only work when the entire expression is on a single line:

WITH "params" AS (
    SELECT
        @Prompt('Username', 'A', , Multi, Free, Persistent, { 'PRODUCT', 'MODEL_OFFICE' }, User:0) :: text as user,
        @Prompt('Date from','D', , Mono, Free, Persistent, , User:1) :: timestamp with time zone at time zone 'UTC' as from_date,
        @Prompt('Date to', 'D', , Mono, Free, Persistent, , User:2) :: timestamp with time zone at time zone 'UTC' as to_date
)
SELECT
    ...

But SQL Formatter will reformat these into a much more sensible multiline presentation, which I then need to change back to single-line.

Is there a feature to make the formatter skip individual lines or sets of lines in the query?

For instance, the black formatter for Python supports # fmt: off and # fmt: on comments:

# fmt: off
custom_formatting = [
    0,  1,  2,
    3,
]
# fmt: on
regular_formatting = [
    0,  1,  2,
    3,
]

black would format the above like this:

# fmt: off
custom_formatting = [
    0,  1,  2,
    3,
]
# fmt: on
regular_formatting = [
    0,
    1,
    2,
    3,
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant