Feature Request: Comment controls
It would be great if we could hide comments.
I like putting a lot of comments in my code, but I frequently work with people who don't like comments.
It would be great if I could add tags to comments ('#walkthough' at the end of the comment, or in a line afterwards) That tag list would be hidden, but expandable to edit. The IDE would track comments based on type (TODO, inline, block, XML), tags, author, and location and allow users to create rules to hide comments.
There should be an option to hide a specific comment unless it get changed. If a comment changes you might re assess weather you want to see it generally.
there should be a show hidden comments toggle somewhere and some sort of minimal icon that denotes there is a hidden comment at a point.
This feature would not just be great in Rider, but also Intelij and other editors.
Please sign in to leave a comment.
Hello,
You can configure IDE to fold comments by default:
Doesn't it cover your needs?
Not really. What i am looking for is the power to add more categories to those settings. For example, i frequently leave comments designed for someone who doesn't know C# because I remember what it was like trying to learn the language from context. I wanted someone to explain each line and what it actually. I find these helpful for remembering what the code does a year down the line which I haven't touched it in ages. But i am working with people who find them distracting. It would be great if i could say
// test if the list is empty #tutorialand then tell rider to wrap comments with #tutorial.So, you are talking about line-level comments where you comment some lines inside a method (every line?), right?
And you want Rider to be able to hide and show such comments depending on user preferences, for e.g.:
So, the developer that would configure “#tutorial” as an ‘ignore’ pattern would see:
Do I understand your request correctly?
Did you consider using method-level XML comments instead? It can be the same as a simple high-level explanation of the method, the same as a detailed instruction describing what and how the method does. It is very flexible and is widely used for any commenting purpose. For e.g.:
Also, it can be folded by default. It should be enough to explain what the method does, isn't it. It is supported in most IDE's which is an extra advantage. Because, even if the feature you describe is implemented in Rider, any other code editors will have no idea what the uncommon comment with custom #whatever is there in your code. It will be rendered in the editor just like a common comment.
first of yes you are understanding the request. Maybe a little logo next to the line number indicating there is a hidden comment here, but maybe not.
I do use XML comments to document my functions, i am very happy with the functionality there, and this is sufficient for a short function, but if i have a function longer than about 20 lines that makes several decision, I don't want to put all that documentation in the XML. When i write the XML I focus on the people who will use this function and want to know what it does.
You might consider using preprocessor directives for compilation with the #region feature for writing a tutorial for a piece of code. Look at such an example:
Such regions can be folded by default in most code editors, and you could use it as a place for writing tutorials to specific code snippets. There is what it can look like:
Does it help? If not, please tell me more, why it doesn't address your needs.
Have a nice day!