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

Formatter issue #30

Open
hankhsu1996 opened this issue Jun 22, 2022 · 4 comments
Open

Formatter issue #30

hankhsu1996 opened this issue Jun 22, 2022 · 4 comments

Comments

@hankhsu1996
Copy link

If I format a file with no trailing new line, the last line will be duplicated.

For example,

module my_module;
endmodule

Would become:

module my_module;
endmodule
endmodule
@hankhsu1996
Copy link
Author

BTW I use the default verible-verilog-format format command.

@kkanhere
Copy link
Collaborator

Can you please provide details about the editor you are using and the verible-verilog-format verison.
Thanks

@hankhsu1996
Copy link
Author

hankhsu1996 commented Jun 30, 2022

$ verible-verilog-format --version 
v0.0-2152-gdd5e91a4
Commit  2022-05-23 14:53:23 -0700
Built   2022-05-23T22:18:27Z
$ code --version 
1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
x64

I would guess it's line 65 in svformatter.ts. The formatter only replace from the first character in the file to the first character of the last line. However, I haven't tested it yet.

Maybe you can use Range(document.lineAt(0).range.start, document.lineAt(document.lineCount-1).range.end).

@kkanhere
Copy link
Collaborator

kkanhere commented Jul 1, 2022

Thanks.
I am able to reproduce the error. Looks like the output range is excluding the last line. Should be fixed in next release.

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

2 participants