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

Unable to correctly format comments with CRLF line breaks #3

Closed
01010101lzy opened this issue Apr 6, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@01010101lzy
Copy link

commented Apr 6, 2019

Describe the bug
When formatting a sql file with comments and CRLF line breaks, -- comment becomes - - comment and new lines are not preserved.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new query with CRLF line breaks.
  2. Write some sql lines along with some comments.
  3. Press alt+shift+F to format the file (ctrl+E, ctrl+B does not work in my case)
  4. File gets scrambled.

Before formatting

--
-- 1.

select sum(quantity)
from (select *
   from db_lab3.order
   where cid = 3 
) as selected_orders  
join db_lab3.food on selected_orders.fid = food.fid
where price < 50;

After formatting

- - - - 1.
select
  sum(quantity)
from
  (
    select
      *
    from
      db_lab3.order
    where
      cid = 3
  ) as selected_orders
  join db_lab3.food on selected_orders.fid = food.fid
where
  price < 50;

Expected behavior
The comment should not be scrambled

Screenshots

Before formatting:
图片

After formatting:
图片

Desktop:

  • OS: Windows
  • VSCode: 1.33.0
  • SQLTools Version 0.17.10

Additional context

The formatting seems to be correct when using LF line breaks:

--
-- 1
select
  sum(quantity)
from
  (
    select
      *
    from
      db_lab3.order
    where
      cid = 3
  ) as selected_orders
  join db_lab3.food on selected_orders.fid = food.fid
where
  price < 50;
@mtxr

This comment has been minimized.

Copy link
Owner

commented Apr 6, 2019

Thanks!

Will fix shortly

@mtxr mtxr self-assigned this Apr 6, 2019

@mtxr mtxr transferred this issue from mtxr/vscode-sqltools Apr 6, 2019

@mtxr mtxr closed this in 6c6f911 Apr 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.