# go: Fix tree-sitter query for outlines \(\#24861\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 1d26a27afa768f9e267c7406264fa0addcbb5f0f

Requested commit: 1d26a27afa768f9e267c7406264fa0addcbb5f0f

Commit: 1d26a27afa768f9e267c7406264fa0addcbb5f0f

Tree: 8e05b5e51257c9933a0dcd6c302770121040a023

Author: Ashish Bhate

Committer: GitHub

## Message

```
go: Fix tree-sitter query for outlines (#24861)

Closes #14497

Release Notes:
- Fixed outline view for Go to correctly indent types and show missing
variables.
----
This PR fixes the tree-sitter query for outlines for Go code. It
correctly indents "grouped" `type` declarations. It also fixes missing
variables for "grouped" `var` declarations.

### Before: 
1. Incorrectly indented types from `G` to `K` and `aliasInt`
2. Missing vars `M` and `N` in outline 

![Screenshot_20250214_175404](https://github.com/user-attachments/assets/7c1142bd-fe60-4c65-9fa2-3bae4eb43d63)

### After:
1. Types no longer indented incorrectly
2. Missing vars `M` and `N` appear in the outline, as expected

![Screenshot_20250214_175431](https://github.com/user-attachments/assets/61010273-e98d-425d-93ad-17f04bd83b54)

### Caveats:
1. This fix comes from an hour or so of reading about tree-sitter and
its query syntax. I'm not an expert.
2. I'm not sure how to test this. I've done manual testing and it
appears to works as expected without an regressions.
```

## Parents

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

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