microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.25k stars 29.3k forks source link

Collapse issue with commented functions #134800

Closed zohaibmalik994 closed 3 years ago

zohaibmalik994 commented 3 years ago

Issue Type: Bug

When I comment out a function temporarily then I lose the arrow to collapse this function in the comment. I wish we still be able to collapse the code blocks in the comments for a faster read. (Also, if there is any possibility to collapse/hide selected code.) Thanks!

VS Code version: Code 1.61.0 (ee8c7def80afc00dd6e593ef12f37756d8f504ea, 2021-10-07T18:13:09.652Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

aeschli commented 3 years ago

Fo which language is this? TypeScript?

zohaibmalik994 commented 3 years ago

Hi Martin,

I am not exactly sure what typescript is. I was using JavaScript. Whenever I comment out a block of code, it sticks there and I am not able to collapse any of the functions or blocks used inside it.

From: Martin @.> Sent: Friday, October 15, 2021 7:33 PM To: @.> Cc: @.>; @.> Subject: Re: [microsoft/vscode] Collapse issue with commented functions (#134800)

Fo which language is this? TypeScript?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode/issues/134800#issuecomment-944349242, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM2ULLGYJW5FC446MNWXV53UHA3RTANCNFSM5FYNEAIA.

aeschli commented 3 years ago

Ok, thanks. JavaScript and TypeScript are powered by the same extension.

aeschli commented 3 years ago

The JavaScrit extension adds a folding range for the while comment which I think is the right thing to do image

Folding for stuff inside the comment is problematic as there can be anything in a comment such as incomplete code with missing brackets so it's hard and can lead to strange folding ranges that are more confusing than helpful.

zohaibmalik994 commented 3 years ago

Right. Thanks, @aeschli for your explanation and how it can be problematic to have incomplete code and missing brackets. But what if we decide to hide this intentionally, I mean we select the code we want to hide and then collapse it? I hope it would be really convenient to have this option to select and collapse the selected code. Thanks!

aeschli commented 3 years ago

@zohaibmalik994 https://github.com/microsoft/vscode/issues/75819 is the issue for folding a selection.

zohaibmalik994 commented 3 years ago

Thank you @aeschli for sharing the link. But I didn't find it useful for folding a selection of code, especially the one with no multiple levels inside. I am sharing a screenshot and you can see there is no arrow to collapse the whole code it contains. So, what if vscode does not support folding such elements. So, the user should have the capability to fold it manually by selecting a section of code and then collapse it. Thanks! image