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

CSharpIndentationService simplification #76580

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

jnm2
Copy link
Contributor

@jnm2 jnm2 commented Dec 29, 2024

While looking into #38057, with some interest in sharing smart indent logic so that the formatter can use it when it formats elastic whitespace, I did some simplification in CSharpIndentationService.

Methods that handle specific situations no longer decide what's next to try, if the situation they are responsible for does not apply. "What's next" is decided in one method now. There's no GetDefaultIndentation that can be independently called from elsewhere.

As a result, I found and fixed two smart indent bugs (see the added unit tests).

Another special case was also removed, deciding not to add an additional increment of indentation when inside a separated syntax list, since that decision is always ignored when inside a separated syntax list. This special case dates back to the initial commit in this repo. More details are in the commit message where this was done.

@jnm2 jnm2 requested a review from a team as a code owner December 29, 2024 23:44
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 29, 2024
@dotnet-policy-service dotnet-policy-service bot added Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode labels Dec 29, 2024
@jnm2 jnm2 force-pushed the csharp_indentation_simplification branch from aded4de to 9184234 Compare December 29, 2024 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants