Skip to content

Implement access specifier folding range collection and add unit tests - #14675

Open
Prashant Kumar Rai (8prashant) wants to merge 3 commits into
microsoft:mainfrom
8prashant:feature/14645-collapsible-access-specifiers
Open

Implement access specifier folding range collection and add unit tests#14675
Prashant Kumar Rai (8prashant) wants to merge 3 commits into
microsoft:mainfrom
8prashant:feature/14645-collapsible-access-specifiers

Conversation

@8prashant

Copy link
Copy Markdown

Adds folding ranges for class access specifier sections (public:, private:, protected:) so users can collapse each section independently.

Related to #14645.

What changed

  • Added access-specifier folding detection logic in a pure utility module.
  • Integrated those computed ranges into the existing folding range provider response.
  • Kept existing server-provided folding behavior and appended the new client-side ranges.

Why

When classes contain multiple access blocks, collapsing by section helps reduce noise and improves readability, especially in large third-party headers.

Testing

  • Built extension successfully:
    • yarn compile
  • Ran targeted unit test successfully:
    • mocha dist/test/unit/foldingRangeProvider.test.js --timeout 30000
  • Result:
    • 1 passing, 0 failing
Image1 (2) Image2 (2)

@8prashant

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds collapsible folding ranges for C++ class access-specifier sections while retaining server-provided ranges.

Changes:

  • Implements client-side access-section detection.
  • Integrates detected ranges with server results.
  • Adds a basic unit test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
foldingRangeUtils.ts Detects access-specifier folding ranges.
foldingRangeProvider.ts Appends client-computed ranges.
foldingRangeProvider.test.ts Tests basic access-section folding.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Extension/src/LanguageServer/Providers/foldingRangeUtils.ts Outdated
Comment thread Extension/src/LanguageServer/Providers/foldingRangeProvider.ts Outdated
Comment thread Extension/src/LanguageServer/Providers/foldingRangeUtils.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

3 participants