code reformatting issues
已回答
I have two problems when using "Reformat Code" in Clion.
1. There is a space before < in case like:
(i) std::vector <std::string> x;
but not in case like:
(ii) std::vector<int> x.
I would like to remove the space before < in (i).
2. I would like to enforce a blank line after the line of visibility keywords (public, private). Is it possible?
请先登录再写评论。
Hello!
1. Go to File | Settings | Editor | Code Style | C/C++ > Spaces > In Template Instantiation and turn off the "Before '<'" option.
2. I've created https://youtrack.jetbrains.com/issue/CPP-14429, feel free to comment or upvote.
Hi Anna,
Thanks for your reply!
Regarding issue 1, I already have the option unchecked. I guess that's why there is no space between std::vector and <int> in (ii). However, I still get a space between std::vector and <std::string> in (i).
I can't reproduce this on my side in CLion 2018.2.4:
Please provide a screencast illustrating the issue here or send it to clion-support at jetbrains.com.
Just chiming in to say that I also get this issue exactly as described above, when selecting 'Reformat Code' (Ctrl-Alt-L).
CLion 2019.1.3
Build #CL-191.7141.37, built on May 6, 2019
JRE: 1.8.0_202-release-1483-b49 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1
Exactly same issue here. No space before template instantiation (as expected from the Settings) when instantiating primitive template types (such as int), but a space appears for other template types when using 'Reformat Code'. For some obscure reason, this unexpected behavior does not appear on all my projects, and typically not on some minimalist examples.
CLion 2019.2.1
Build #CL-192.6262.62, built on August 21, 2019
Runtime version: 11.0.3+12-b304.39 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-138-generic
Probably the issue is related to https://youtrack.jetbrains.com/issue/CPP-10297. Feel free to comment or upvote in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
Thanks. Actually it looks more similar to https://youtrack.jetbrains.com/issue/CPP-8873 . Will update on this.
I also have the same issue despite of correct setting in C/C++ spaces checkbox. Latest 2019.2 version of Clion