When i want to collapse a function (block), it doesn't collapse everything in between the braces, but it just collapses the piece until it encounters a #ifdef . I have beta 7.
Thanks for your report @natanassies ! I have submitted a formal report about this to the Arduino IDE developers:
opened 04:18AM - 22 Oct 21 UTC
topic: infrastructure
type: imperfection
## Describe the bug
The IDE's code folding system assumes that code blocks wi… ll always be indented, and that indented text is always a code block.
🐛 This not a valid assumption. As a result, some code blocks are not foldable, some don't fold correctly, and some things fold that should not.
## To Reproduce
1. Open a sketch that contains code with structure not reflected by indentation:
```cpp
/*
this is not foldable
this is foldable
*/
/* this block is not foldable
the IDE does not indent the contents of block comments
*/
void setup() { // this block is not foldable
#ifdef FOO // common code style is no indentation preprocessor blocks, since they are independent from the C++ code structure
// this block is foldable
#endif
}
void loop() { // This block folds incorrectly
// only this line is folded when folding the `loop` block
#ifdef FOO
// this block is foldable
#endif // this is treated as a block
// this is not folded when folding the `loop` block
}
```
1. Hover the mouse pointer up and down through the left margin of the editor pane in the IDE. Noting the locations of the fold controls.
- 🐛 Expected fold controls are missing at lines: 1, 6, 10
- 🐛 An unexpected fold control is present at line 2
1. Do a "**Fold All**". Note the results.
- 🐛 Expected folds do not occur at lines 7, 11-13, 21
- 🐛 Unexpected fold occurs at line 3
## Expected behavior
Folding occurs based on code structure, independent from indentation.
## Screenshots


## Desktop
- OS: Windows 10
- Version: 2.0.0-beta.12-nightly.20211021
Date: 2021-10-21T03:03:16.691Z
CLI Version: 0.19.1 alpha [718bbbf2]
## Additional context
Previously reported at https://github.com/arduino/arduino-pro-ide/issues/13 and claimed to be fixed at that time, so perhaps a regression.
Reported at:
- https://forum.arduino.cc/t/some-suggestions-about-edi-v2-beta4/700972
- https://forum.arduino.cc/t/block-folding-stops-at-ifdef/863239
- https://forum.arduino.cc/t/option-to-hide-comments/900318/7
---
Folding is more reliable in the classic Arduino IDE:

