You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Folding ranges not returned for highly nested functions #25596
Create .ts file and add multiple enclosed blocks of code
Note that starting some level (> 7?) the folding icon is not displayed and folding/unfolding does not work - see attached (note that + icon is not displayed)
Please note that //#region seems to be working
Does this issue occur when all extensions are disabled?: Yes
Here is the file (just remove .txt extension and open the file in VS Code) and the screenshot.
Note that that there are collapsing icons at the line 1380, 1390, 1411 and no collapsing icon for the line 1400, 1422, 1433 etc.)
Looked through the file and tried narrow down the root cause. Here's a more minimal example:
describe('testing methods',()=>{describe('addPhotoAttachment',()=>{describe('when isPhotoBeingTaken is false',()=>{describe('when platform.ready resolves',()=>{describe('when deviceUtils.isRunningOnRealDevice returns true',()=>{describe('when cameraPreview.takePicture resolves',()=>{describe('when locationUtils.getCurrentLocation resolves',()=>{describe('when coordinates are defined',()=>{describe('when exifUtils.setCoordinatesToBase64String resolves',()=>{describe('when fileUtils.saveBase64StringAsBinaryFile rejects',()=>{it('should NOT invoke thumbnailCreator.thumbnailify',()=>{// no collapse on this function});});});});});});});});});});});
Seems that TS Server stops returning spans after a folding level of 10?
changed the title [-] Folding icons next to the line numbers are not shown in the nested block[/-][+]Folding ranges not returned for highly nested functions[/+]on Jul 12, 2018
We have a limit on depth. this avoid excessively large response from the server for large files. the current depth is 40, but that includes every node in the tree (e.g. call expression, lambdas, etc..).
That said, we could look into increasing it.. but from our previous experience it can affect perf fairly quickly on large files.
Just a notification will be greatly helpful to prevent any confusions from users. When I experienced this issue for the first time, I thought there was a syntax error in my code which prevents folding regions to occur. Then I found out the limit by gradually removing functions manually.
I would love to see this fixed. As in mjbvz's example, it is really easy to run into this with nested unit test describe blocks, and folding is really nice when trying to navigate large unit test files.
Activity
mjbvz commentedon Jul 12, 2018
mjbvz commentedon Jul 12, 2018
From Alex Ryltsov (@ryaa) on July 11, 2018 4:16
Here is the file (just remove .txt extension and open the file in VS Code) and the screenshot.
Note that that there are collapsing icons at the line 1380, 1390, 1411 and no collapsing icon for the line 1400, 1422, 1433 etc.)
add-multiple-photos-using-preview.spec.ts.txt
mjbvz commentedon Jul 12, 2018
Looked through the file and tried narrow down the root cause. Here's a more minimal example:
Seems that TS Server stops returning spans after a folding level of 10?
[-] Folding icons next to the line numbers are not shown in the nested block[/-][+]Folding ranges not returned for highly nested functions[/+]mhegazy commentedon Jul 12, 2018
We have a limit on depth. this avoid excessively large response from the server for large files. the current depth is 40, but that includes every node in the tree (e.g. call expression, lambdas, etc..).
That said, we could look into increasing it.. but from our previous experience it can affect perf fairly quickly on large files.
ryaa commentedon Jun 24, 2020
Is it possible to make this value configurable and allow the user to set it to a higher value, if required?
vincentvictoria commentedon Aug 18, 2021
Just a notification will be greatly helpful to prevent any confusions from users. When I experienced this issue for the first time, I thought there was a syntax error in my code which prevents folding regions to occur. Then I found out the limit by gradually removing functions manually.
bhaynes777 commentedon Oct 24, 2022
I would love to see this fixed. As in mjbvz's example, it is really easy to run into this with nested unit test describe blocks, and folding is really nice when trying to navigate large unit test files.