ggVG
=
The indentation gets messed up. Whereas emacs perfectly indents the same code.
This is the correct indentation, based on emacs.
8.2
OS: Ubuntu 20.04 [WSL]
Terminal: Windows Terminal
$TERM: xterm-256color
$SHELL: /bin/bash
BASH: 5.0.17
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Same issue exists in neovim.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
please try to contact the maintainer of this file: https://github.com/vim/vim/blob/master/runtime/indent/verilog.vim
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@chrisbra Are you sure that indent script is the issue? Because, there is also systemverilog.vim that is the syntax and filetype I using.
Also verilog and systemverilog both have similar syntax. I tried setting the syntax and filetype to verilog. The issue still remains. I think both indent files have this issue.
Should I contact the systemverilog.vim maintainer or verilog.vim?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
ah, I don't know verilog and systemverilog at all. I just assumed that would be the correct one. In that case, try to contact the maintainer of the systemverilog indent script.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@raveensrk Thank you for contacting us. I have checked and corrected the problem.
Could you please try it once.
If there seems to be no problem, I will issue a PR.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@Kocha Thank you for the fix. All the issues I faced were solved. You can proceed with the PR.
Not sure if i did the check properly. This is what i did,
Replaced the /usr/local/share/vim/vim82/indent/systemverilog.vim in the $VIMRUNTINE path with your indent file.
and Indented with ggVG=
I did not check with my actual code base. I will check this indent fix there and get back to you.
The only difference between emacs and vim this the \
ifndefindendation. Vim indents everything after
`ifndef` where emacs doesnot. I do not know which is the right way to indent this. So I will let you decide.
Left is vim with the new indent file and the right is emacs.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
There is some misalignment going on in multiline comments. I will get back with example code tomorrow.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@Kocha There is some junk commented code in my code base with a mix of multiline and single line comments which is causing some problems. Can you take a look at this as well? Thanks.
I have attached the files below.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@raveensrk Could you please try this?
Regarding the ifndef
indentation, I have added an option.
Once this is set, there will be no indentation.
b:systemverilog_indent_ifdef_off
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @Kocha, I tried the above fix and some above-mentioned problems went away. I also tried the b:systemverilog_indent_ifdef_off
option. That also worked fine.
In systemverilog file buffer, To set the ifdef indent off,
let b:systemverilog_indent_ifdef_off = 1
To revert this change, I used,
unlet b:systemverilog_indent_ifdef_off
Both worked file. Let me know if this is the correct way to test this. Could this option be inverted instead? Let the indent option be off by default and let the user decide to switch it on. I am suggesting this based on Emacs implementation taken as reference.
I also tested this on my codebase, and it looks like there are few more issues when single line comments are used after the multiline comments. For example,
(Same as before, left is vim with the new indent file and right is Emacs.)
I have attached the files below.
fix_systemverilog.vim.3.tar.gz
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @raveensrk
I think I'll go default ifdef indent on.
Because that is what the example code in the IEEE1800 22.6.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @Kocha, Are you working on the fix for the previous comment?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @raveensrk, Sorry to keep you waiting.
Next... Could you please try this?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @Kocha, I checked the fix, and it worked. There are a few other places where the indentation is off again.
fix_systemverilog.vim.4.tar.gz
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @raveensrk, Sorry for the many updates.
Next... Could you please try this?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@Kocha Sorry for the delay. I had to test this out a bit. The previous reported issue fixed. But there are a few more issues that I discovered.
fix_systemverilog.vim.5.tar.gz
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @raveensrk Thank you for response.
let b:systemverilog_indent_modules=1
option.—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
HI @raveensrk
I tried to solve task close parenthesis
, but I am not sure if this is the right way to do it.
Could you please try this?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi @Kocha, checked the fix, it works fine. Could I request one more update to the indentation? The ability to break argument into multiple lines for print statements would be a nice addition. I will let you decide.
fix_systemverilog.vim.6.tar.gz
I think after this update, we can close this issue and do a pull request. Meanwhile, I will be using this indentation file, if I see more issues I will reopen this issue and post the issues. I think most bugs I faced were fixed. Thanks for the help.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@Kocha Any updates? Will you be doing a pull request?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@raveensrk Sorry for the wait.
Updated the indent/systemverilog.vim
file.
If there seems to be no problem, I will issue a PR.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks, the update looks good to me. Issue a pr @Kocha lets merge it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hi, @raveensrk I sent to PR and closed.
If all is well, please close the Issue.
Best regards.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks @Kocha. Closing this issue.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #10242 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.