Skip to content

Folding ranges not returned for highly nested functions #25596

Open

Description

@mjbvz

From Alex Ryltsov (@ryaa) on July 9, 2018 5:38

  • VSCode Version: Version 1.25.0 (1.25.0)
  • OS Version: MacOS High Sierra 10.13.5

Steps to Reproduce:

  1. Create .ts file and add multiple enclosed blocks of code
  2. 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

screen shot 2018-07-09 at 08 31 53

Does this issue occur when all extensions are disabled?: Yes

Copied from original issue: microsoft/vscode#53842

Activity

  1. mjbvz commented on Jul 12, 2018

    @mjbvz
    Author
  2. mjbvz commented on Jul 12, 2018

    @mjbvz
    ContributorAuthor

    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

    screen shot 2018-07-11 at 07 13 55

  3. added
    VS Code TrackedThere is a VS Code equivalent to this issue
    and removed
    Needs More InfoThe issue still hasn't been fully clarified
    on Jul 12, 2018
  4. removed their assignment
    on Jul 12, 2018
  5. mjbvz commented on Jul 12, 2018

    @mjbvz
    ContributorAuthor

    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?

  6. 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
  7. mhegazy commented on Jul 12, 2018

    @mhegazy
    Contributor

    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.

  8. added
    SuggestionAn idea for TypeScript
    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.
    on Jul 12, 2018
  9. ryaa commented on Jun 24, 2020

    @ryaa

    Is it possible to make this value configurable and allow the user to set it to a higher value, if required?

  10. vincentvictoria commented on Aug 18, 2021

    @vincentvictoria

    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.

  11. bhaynes777 commented on Oct 24, 2022

    @bhaynes777

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: LS: OutliningRelates to multi-line regions that editors can collapseNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions