A strange problem i have, i'm new to VScode, in .js files, code folding works, but when i am editing a .php, code folding doesn't seem to work. No conflicts with any installed extensions. Or does VScode simply just doesn't have this feature??
1 Answer
I believe code folding used to be indentation based. Things like a differently-indented HEREDOC really screw that up.
vscode added support for language-aware folding, but it needs an extension to implement it. The vscode team suggests filing an issue against one of the popular PHP extensions:
So to get this implemented, please file a feature request against one the PHP extensions: e.g. https://github.com/felixfbecker/vscode-php-intellisense or https://github.com/bmewburn/vscode-intelephense
-
1Wow, you would think they would allow language-based folding to be specified in the config, and not require one of the bloated extensions that insist on trying to do everything, even the things you don't want them to do. Code folding is as standard as syntax highlighting, which is done by default in VSCode, and the code folding should be identical to JS code folding, which is included as standard.– SEoFCommented Aug 27, 2021 at 11:03
/* #region */
and/* #endregion */
in every function to get the code to collapse.