# languages: Fix broken whitespace for C\+\+ \(\#53709\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8b1520467b3a37d8fc9e9699c0f243b192c24879)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8b1520467b3a37d8fc9e9699c0f243b192c24879

Requested commit: 8b1520467b3a37d8fc9e9699c0f243b192c24879

Commit: 8b1520467b3a37d8fc9e9699c0f243b192c24879

Tree: a4bf1c1b200df287c8f2907ef83a5cccad97eacf

Author: Phillip Davis

Committer: GitHub

## Message

```
languages: Fix broken whitespace for C++ (#53709)

Uses tree-sitter indent queries to create a pseudo-scope, since access
modifiers are single-node in thetree-sitter grammar.

The @outdent capture truncates the parent { } indent range at the access
specifier, keeping it at the same level as the class keyword and the
pseudo-scopes from stacking.

The @outdent range selects siblings so we don't outdent the access
specifiers themselves, since screenshots from the reference issue seem
to show that at least one interested party does not prefer outdented
access modifiers, and also it seemed like less of a departure from
existing design.

Also, there are probably more tests than needed because this is my first
time writing treesitter queries and I wanted to triple-guess myself.
Quite open too feedback on which ones are more valuable.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #53175

Release Notes:

- Improves handling of indentation after C++ access modifiers
```

## Parents

- [a1eed3c742e43712704ea8376de483cb5ab5f45e](https://git.cafe/gitcafe/zed/commit/a1eed3c742e43712704ea8376de483cb5ab5f45e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8b1520467b3a37d8fc9e9699c0f243b192c24879?format=markdown)
