zed icon indicating copy to clipboard operation
zed copied to clipboard

`#pragma region` code folding

Open ske2004 opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the feature

#pragma region allows you to enclose a block of code in C++ to fold them in the editor. It's useful for big files.

If applicable, add mockups / screenshots to help present your vision of the feature

Unfolded Folded

ske2004 avatar May 31 '24 05:05 ske2004

I'd love to have something like

// region: Region name
// endregion: Region name

for Rust as well.

lufog avatar Jul 13 '24 21:07 lufog

I join this request (regions in rust-analyzer), in conjunction with the correct recognition of custom snippets in rust-analyzer.

niconsm16 avatar Jul 21 '24 02:07 niconsm16

Perhaps recognize/follow regions for VSCode and others. e.g., //#region types ... //#endregion types for TypeScript in VSCode

dcgrigsby avatar Sep 06 '24 14:09 dcgrigsby

recognizing a variety of (configurable?!) region block declarations would be great; providing a configurable a list of start/end pairs, and/or letting it be set on a per-language basis, would be one approach - allowing support for VSCode, JetBrains, pragma, and any other styles.

lokkju avatar Sep 23 '24 04:09 lokkju

I would like to see this feature as well in any implementation :)

skuzmin avatar Aug 26 '25 10:08 skuzmin

Regarding the original request for #pragma region folding, it could be supported by the C++ language server clangd, but it is not implemented yet.

Instead of relying on individual language servers, I think a better approach would be to implement a generalized solution for all languages (similar to VSCode).

hokein avatar Nov 14 '25 22:11 hokein

Would love a VSCode style implementation

JacksonMurphy-Design avatar Nov 21 '25 20:11 JacksonMurphy-Design

// #region Foo
// #endregion Foo

would be great!

ozanmuyes avatar Nov 26 '25 19:11 ozanmuyes