Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio-style folding #214299

Closed
Sensuikan-U511 opened this issue Jun 5, 2024 · 5 comments
Closed

Visual Studio-style folding #214299

Sensuikan-U511 opened this issue Jun 5, 2024 · 5 comments
Assignees

Comments

@Sensuikan-U511
Copy link

Visual Studio recognises the line above a free-standing opening bracket as the basis for folding and folds it all into one line, like so:

2024-06-04 13_02_45
2024-06-04 13_02_51

In comparison, even with extensions, the closest I can get to replicating this behaviour in VSCode is this:
2024-06-04 13_19_33
2024-06-04 13_19_36

I have been informed by the extension developer that it is not possible to fix this issue by extension.
Although I've come to prefer VSCode in all other aspects, this lone issue does detract from the experience of using it as someone who has always written code in Allman-style. It doubles the vertical space consumed by a folded block, and it's much less clean to read.
If this will not be accepted as a feature, I would be grateful to receive a pointer as to where I could change this behaviour so that I can build a personal fork.

@aeschli
Copy link
Contributor

aeschli commented Jun 5, 2024

#3352 captures the request to have closing bracket in the folded region.

There's currently no plan to work on such a feature.

@aeschli aeschli closed this as completed Jun 5, 2024
@Sensuikan-U511
Copy link
Author

I think my request was misunderstood for a different, commonly-asked request. I was not requesting closing brackets captured in folding region. You are correct that this is already handled by an extension, which I mentioned in my request.

@aeschli
Copy link
Contributor

aeschli commented Jun 5, 2024

You want the folding marker to be with the function identifier, not on the opening bracket.
That decision is made by the language extension that you use. In your case C#?
e.g. for TypeScript, there the folding marker stays on the identifier.

Peek 2024-06-05 21-13

You could file a request against the C# extension.

@Sensuikan-U511
Copy link
Author

You want the folding marker to be with the function identifier, not on the opening bracket.

That is exactly correct. I cannot replicate the behaviour captured in your GIF. Even if I write a Typescript snippet, the folding marker stays with the opening bracket. I tried disabling extensions as well to make sure nothing I had was interfering with the default behaviour.

2024-06-06 14_53_36
2024-06-06 14_53_41

Is the behaviour in the GIF the result of a Typescript-specific extension? I notice, also, that in the GIF the opening bracket is hidden when collapsed, while when I attempted to try this without extensions only the lines between the brackets are collapsed.

@aeschli
Copy link
Contributor

aeschli commented Jun 6, 2024

Thats strange. It's not what I see with TypeScript.
Yes, the language extensions contribute a folding provider that is in full control where the folding ranges start and end.
That said, as a user you can switch to indentation based folding using the setting "editor.foldingStrategy": "indentation".
Maybe that's what you currently use?

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jul 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants