Skip to content

folding: provider event to signal that folding ranges have changed #99914

@Colengms

Description

@Colengms

In the C/C++ Extension, we have a scenario in which folding ranges may not be accurate if partially overlapping with inactive regions, until a semantic parse has been completed. The semantic parse allows us to determine if a #if/#ifdef region is active or inactive.

A contrived example:

#define TEST 0

void foo(bool b)
{
    if (b)
    {
#if TEST
        // ...
    }
#else
        // ...
    }
#endif
}

We could wait until the semantic pass is complete, but for very complex source it can take several seconds, possibly minutes.

We could provide ranges (as we are now) without considering inactive regions. If we receive a subsequent request for folding range (such as the user editing the file), we could take the inactive regions into consideration. Though, this would leave inaccurate folding ranges for files that are viewed and not edited.

If there were a way for us to programmatically trigger a new folding ranges request as inactive regions become available (or change), that would seem to provide the best experience.

(Related: microsoft/vscode-cpptools#5429 )

Version: 1.46.0 (user setup)
Commit: a5d1cc2
Date: 2020-06-10T09:03:20.462Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions