microsoft / microsoft/vscode-cpptools

Feature Request: Folding range for inactive regions

Open
#10,963 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Code Folding Language Service Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Feature Request

There are cases in which the extension emits symbol information but does not emit a corresponding folding range. This makes it more difficult and in some cases impossible for extensions to create advanced commands for folding and unfolding code.

Notice in this screenshot that the Outline contains symbols for both versions of foo. But if you look at the fold icons in the gutter there is no folding range associated with the inactive foo on line 2.
image

I have an extension that folds definitions without folding comments and preprocessor blocks. In order to do this I obtain the symbols for the document then assume they are valid folding ranges. While it's not an ideal approach it works in all cases so far except symbols inside inactive preprocessor blocks.

If the extension goes through the trouble of emitting a symbol it's desirable that it reliably produces a folding scope as well. In this specific case, even in the absence of my extension it's desirable for the first foo to fold.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by tracing how symbols and folding ranges are emitted for inactive preprocessor regions, then verify that the inactive foo receives a folding range while existing symbol behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.