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

Block/Multiple-line commenting #77

Closed
tdalon opened this issue Mar 19, 2021 · 6 comments
Closed

Block/Multiple-line commenting #77

tdalon opened this issue Mar 19, 2021 · 6 comments
Assignees
Labels
enhancement new feature or request

Comments

@tdalon
Copy link

tdalon commented Mar 19, 2021

I would like the possibility to multiple lines/block comment/ uncomment selected code lines like in AHK-Studio.

This include the selected code between /* */
See screenshot attached.
image

The block is nicely indented and color-highlighted.
One shouldn't need to select the comment block but it will get it from the cursor position and take the block around it.

@tdalon tdalon added the enhancement new feature or request label Mar 19, 2021
@fade2gray
Copy link

Try this...

;region
These tags will create a
folding region of code
that doesn't require
indentation
;endregion

/* ;region
Prefixing with /* and */
will create a folding
block comment
*/ ;endregion

@tdalon
Copy link
Author

tdalon commented Mar 26, 2021

Try this...

;region
These tags will create a
folding region of code
that doesn't require
indentation
;endregion

/* ;region
Prefixing with /* and */
will create a folding
block comment
*/ ;endregion

As written in the issue description: I would know how to do this manually (or with an ahk script). The request here is to have this built-in in the extension. Also adding some additional features with indenting and color formatting. The feature shall also toggle the block on and off. And at the best I wouldn't need to select the comment block but it will get it from the cursor position and take the block around it.

@fade2gray
Copy link

@tdalon Sorry, didn't read beyond the image.

I bought up a similar request here, so @mark-wiemer might have something on the back-burner.

But, I have created myself a simplistic helper script that can automatically add and remove the folding/comment tags, though it does need the block of code to be highlighted. I could post it in the discussion section if you want to make use of it.

EasyFolding

@mark-wiemer
Copy link
Owner

This is a good one! I've been meaning to simplify the foldable region snippet for a while, thanks for reporting this

@mark-wiemer mark-wiemer added this to the May 2021 milestone Apr 22, 2021
@mark-wiemer mark-wiemer modified the milestones: May 2021, vNext May 30, 2021
@mark-wiemer
Copy link
Owner

Alright, I misunderstood this as folding block comments, not toggling block comments. My mistake.

For toggling block comments, VS Code's built-in commands should be sufficient. There is expand selection which can be applied repeatedly to highlight the block, and then we can finish with toggle block comment. Both are accessible through the command palette and have default keyboard shortcuts that are re-mappable as well.

The color will stay the default "comment" color (usually green) since I don't see a need (or way) to distinguish between plain comments and commented code.

I'm going to add folding for non-indented block comments, even though that's beyond the scope of this issue.

Closing this issue since there is a sufficient workaround with built-in features.

@FuPeiJiang
Copy link

this is literally selecting code block, which requires a parser
https://github.com/wangchunsen/vscode-bracket-select
https://github.com/FuPeiJiang/vscode-bracket-select/releases/tag/2.0.1
here, I've used typescript parser (pretty inefficiently) to select code block

ripppp, no ahk parser, yet.
though, zero-plusplus/vscode-autohotkey-debug#90 (reply in thread)
I think there is ?

@mark-wiemer mark-wiemer added this to AHK++ Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new feature or request
Projects
Status: No status
Development

No branches or pull requests

4 participants