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
Feature Request : SHOW / HIDE comments in editor #46505
Comments
This would be really useful |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
glad to know I'm not the only one. Would be great to be able to toggle comments visible/hidden. |
@xpnerd fold comments doesn't hide them. so if you have a lot of comments the code is still hard to read. |
@fabiospampinato Do you think this is feasible with current code's exposed API? |
@Astrantia probably not, as I don't think one can fold arbitrary lines. Also I'm not sure how one would hide comments such as: |
@bpasero @alexandrudima just a little ping for this little issue ;) |
With the power of Regex? |
It may make spacing look a bit weird (pick your poison), but what about setting the themes comment |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
If you could ask your friends to upvote this issue that could be wonderfull |
And also post comments |
I need it so much too! I am converting a complex jQuery app to Vue. There are 6000+ lines. In my work I am commenting out lines and sections of jQuery code and gradually replacing them with much shorter Vue code. I need the out commented lines for comparison, but it makes the code look like a mess. So it would be awesome if I could turn on and off the comments. Folding is not good enough. Also there are a lot of single line comments. Setting the opacity to zero would be better than nothing, but preferably lines with only comments should be omitted in the editor. Of course it will create gaps in the line numbers, but it already creates if not gaps then white space if you have long wrapped lines. |
is it must be a regular expression, no? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
maybe an extension that set the commented code color the same as the background color would be useful already |
This comment has been minimized.
This comment has been minimized.
Maybe in some cases it will help. But I can use actual folding sometimes when reviewing where they went overboard on JSDoc & there is only 1 line of actual code per 10 typed lines. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Suddenly I've recall why once I've stopped using Microsoft technologies completely |
This would be incredibly useful to me. As I learn to code, I put comments in to explain what is happening. Being able to hide and unhide them all would be great, |
Adding my support. It would also be useful to just hide the first comment. On many project there will be a header comment with licensing information and it really bugs me to always see the comment instead of the code, e.g.: /*
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package code
var veryImportant = "PseudoCode" |
Hiding the first comment might not be desirable if it is a shebang. The toggle should be for all comments |
Of course, but it might be good to have an API for selective hiding of comments. Than you could write your own filter for allowing or disallowing certain comments. |
Sometime indeed be very useful |
I would like visual studio code to not show lines which contain comments at all but only if the line contains only comments and dosent contain code. e.g. 1 This way its like comment dosent exist and if I need them I can enable them. |
So... Over 4 years after the initial post, still no progress on this? Wow |
Looks like this extension is doing the job: https://github.com/estruyf/vscode-hide-comments |
Nope. It’s making them invisible. The spaces in the areas where there was a comment remain. |
true |
This would be really useful. Sometimes I really want to document my code well, and then it makes the code really hard to actually navigate. The command "Fold All Block Comments" is nice, but you still see these bold bars from the folds that are distracting, and this doesn't help with inline comments. The ideal solution would be something relatively language aware. For Documentation comments - that is, blocks that are generating Intelisense hints, we could have those comments completely hidden, and replaced with a small indicator that when clicked would temporarily expand the comment for editing. Since hovering over an identifier pops up the hint box, which has nice formatting and such, we don't need to see the raw comment for anything but modification. Inline comments are a little trickier, but one solution might be for the comments to simply have a lower opacity when the mouse isn't hovering over them. This would at least reduce distraction. |
I again mention that most of other IDEs support this basic features. So i thnk that's one of the last feature we are waiting on vscode |
I'm not sure I've seen a feature like this before @Aarbel, could you perhaps supply some specific examples of how other IDEs have implemented this feature? |
Well I can at least say that most of JetBrains IDEs allow to fold/collapse comments. This is especially useful for License Headers (as by my previous comment). |
This is especially useful in this new era of AI code assistance. It's really easy to create really good documentation of each function, but it's a lot of clutter to keep in your files if you can't hide it. But it's nice for it to be there for Intelisense pop-ups to surface later when we need it. |
We use SPDX tagging for copyright and license information in file and snippet level, including AI generated code. It would be very good feature to be able to hide all the comments that contain a certain string (in our case "SPDX") to make it more comfortable for the developers to review the code itself. |
Its 2024 now and still no progress??? This is a big need! |
Hi VsCode teams !
Why developers need it
Conclusion: toggling comments visibility could be a very nice productivity feature directly inside VSCode ! Moreover, this feature exists on most of other text editors.
Question
If i missed the feature in VSCode, how could i show / hide comments in my code ?
I saw this extension on vscode store, but it's not maintained and it doesn't work with last versions of VSCode
Thanks for your work ! 👐
Tasks
The text was updated successfully, but these errors were encountered: