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

Formatting comments, new lines are not kept #97

Closed
4 of 8 tasks
PapsOu opened this issue Aug 29, 2018 · 2 comments
Closed
4 of 8 tasks

Formatting comments, new lines are not kept #97

PapsOu opened this issue Aug 29, 2018 · 2 comments

Comments

@PapsOu
Copy link
Contributor

PapsOu commented Aug 29, 2018

Issue Type

  • Bug
  • Enhancement
  • Feature Request
  • Question
  • Other

Prerequisites (For bugfixes)

  • Are you running the latest version?
  • Did you check the logs?
  • Did you check the Setup?

Description

I've got a similar bug to this issue (#87) when formatting simple queries with comments :

SELECT * FROM user;

-- RESET ALL PASSWORD REQUESTS

UPDATE user SET password_requested_at = NULL, confirmation_token = NULL;

Steps to Reproduce (For bugfixes)

  1. Create a .sql file with file content type set as SQL
  2. Put those simple queries into the file
  3. Apply format document command

Expected behavior: [What you expected to happen]

The file should be formatted as bellow, the comment should keep its new lines (before and after)

SELECT
    *
FROM
    user;

-- RESET ALL PASSWORD REQUESTS

UPDATE
    user
SET
    password_requested_at = NULL,
    confirmation_token = NULL;

Actual behavior: [What actually happened]

The comment is after the last sql part without any new lines.

SELECT
    *
FROM
    user;-- RESET ALL PASSWORD REQUESTS
UPDATE
    user
SET
    password_requested_at = NULL,
    confirmation_token = NULL;

Versions

  • Version: v0.15.0 (vscode 1.26.1)
  • OS: fedora 28
  • SGDB: PostgresSQL (but it doesn't look like to be related to a specific database vendor)
@mtxr
Copy link
Owner

mtxr commented Sep 23, 2018

Just opened an issue sql-formatter-org/sql-formatter#50 in the 3rd party lib.

@mtxr mtxr mentioned this issue Sep 23, 2018
7 tasks
@mtxr mtxr closed this as completed in 0e31775 Feb 4, 2019
mtxr added a commit that referenced this issue Apr 7, 2019
@Jule-
Copy link

Jule- commented Dec 1, 2020

@mtxr Hi! For me this issue is still happening. Are you sure it is fixed? If so what could possibly be wrong on my side?
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants