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

Feature Request : SHOW / HIDE comments in editor #46505

Open
Aarbel opened this issue Mar 25, 2018 · 81 comments
Open

Feature Request : SHOW / HIDE comments in editor #46505

Aarbel opened this issue Mar 25, 2018 · 81 comments
Labels
editor-comments Editor commenting/uncommenting commands feature-request Request for new features or functionality languages-basic Basic language support issues
Milestone

Comments

@Aarbel
Copy link

Aarbel commented Mar 25, 2018

Hi VsCode teams !

Why developers need it

  • Adding comments and documentation in a codebase is very important for maintenance.
  • But often it could make it harder to read (especially if you use jsdoc or swagger)

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

No tasks being tracked yet.
@vscodebot vscodebot bot added editor editor-contrib Editor collection of extras labels Mar 25, 2018
@alexdima alexdima added feature-request Request for new features or functionality languages-basic Basic language support issues and removed editor editor-contrib Editor collection of extras labels Mar 27, 2018
@alexdima alexdima added this to the Backlog milestone Mar 27, 2018
@alexdima alexdima removed their assignment Mar 27, 2018
@adesmier
Copy link

This would be really useful

@xpnerd
Copy link

xpnerd commented Jul 18, 2018

Similar to #45020 right?

For block comments see: #11524.
vscode: CTRL + SHIFT + P and type Fold All Block Comments

@vinniejames

This comment has been minimized.

@thejonamreddy

This comment has been minimized.

@abieganski

This comment has been minimized.

@Aarbel

This comment has been minimized.

@ulkas

This comment has been minimized.

@currentcreative
Copy link

glad to know I'm not the only one. Would be great to be able to toggle comments visible/hidden.

@Aarbel
Copy link
Author

Aarbel commented Jan 18, 2019

@xpnerd fold comments doesn't hide them. so if you have a lot of comments the code is still hard to read.

@Astrantia
Copy link

@fabiospampinato Do you think this is feasible with current code's exposed API?

@fabiospampinato
Copy link
Contributor

@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: function () {} // My comment

@Aarbel
Copy link
Author

Aarbel commented Mar 1, 2019

@bpasero @alexandrudima just a little ping for this little issue ;)

@xpnerd
Copy link

xpnerd commented Mar 3, 2019

@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: function () {} // My comment

With the power of Regex?

@ph-One
Copy link

ph-One commented Mar 18, 2019

It may make spacing look a bit weird (pick your poison), but what about setting the themes comment opacity to zero, or the same color as the bg. Just thinking here.

@kakarlus

This comment has been minimized.

@AdmiralRazorbeard

This comment has been minimized.

@tinaoct1

This comment has been minimized.

@Aarbel
Copy link
Author

Aarbel commented Apr 11, 2019

If you could ask your friends to upvote this issue that could be wonderfull

@Aarbel
Copy link
Author

Aarbel commented Apr 11, 2019

And also post comments

@marlarius
Copy link

marlarius commented May 13, 2019

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.

@mylastnameisboyko
Copy link

is it must be a regular expression, no?

@wasife

This comment has been minimized.

@raf202

This comment has been minimized.

@raf202
Copy link

raf202 commented Jun 16, 2020

maybe an extension that set the commented code color the same as the background color would be useful already

@Soneji

This comment has been minimized.

@tomByrer
Copy link

maybe an extension that set the commented code color the same as the background color would be useful already

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.

@rpajaresWT

This comment has been minimized.

@RomanVanLoo

This comment has been minimized.

@Aarbel

This comment has been minimized.

@amorphius
Copy link

Suddenly I've recall why once I've stopped using Microsoft technologies completely

@behatted
Copy link

behatted commented Dec 4, 2020

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,

@DanielHabenicht
Copy link

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"

@Soneji
Copy link
Member

Soneji commented Mar 18, 2021

Hiding the first comment might not be desirable if it is a shebang. The toggle should be for all comments

@DanielHabenicht
Copy link

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.
But this shouldn't hold back the core of this issue.

@tjx666
Copy link
Contributor

tjx666 commented Jan 24, 2022

Sometime indeed be very useful

@muhamedkarajic
Copy link

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
2
9

This way its like comment dosent exist and if I need them I can enable them.

@ZackMercury
Copy link

So... Over 4 years after the initial post, still no progress on this? Wow

@Aarbel
Copy link
Author

Aarbel commented Dec 4, 2022

Looks like this extension is doing the job: https://github.com/estruyf/vscode-hide-comments

@ZackMercury
Copy link

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.

@Aarbel
Copy link
Author

Aarbel commented Dec 4, 2022

true

@zeel01
Copy link

zeel01 commented Mar 22, 2023

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.

@Aarbel
Copy link
Author

Aarbel commented Mar 22, 2023

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

@zeel01
Copy link

zeel01 commented Mar 24, 2023

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?

@DanielHabenicht
Copy link

DanielHabenicht commented Mar 24, 2023

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).

@zeel01
Copy link

zeel01 commented Apr 8, 2023

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.

@mikavuo
Copy link

mikavuo commented Jan 24, 2024

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.

@cartier55
Copy link

Its 2024 now and still no progress???

This is a big need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-comments Editor commenting/uncommenting commands feature-request Request for new features or functionality languages-basic Basic language support issues
Projects
None yet
Development

No branches or pull requests