Skip to content

Add indentation rules for GLSL syntax#58520

Merged
MrSubidubi merged 5 commits into
zed-industries:mainfrom
Helmutt03:patch-1
Jun 5, 2026
Merged

Add indentation rules for GLSL syntax#58520
MrSubidubi merged 5 commits into
zed-industries:mainfrom
Helmutt03:patch-1

Conversation

@Helmutt03
Copy link
Copy Markdown
Contributor

@Helmutt03 Helmutt03 commented Jun 4, 2026

Add C-Style indentation rules for GLSL. By adding an indents.scm file for GLSL we get the same automatic indentation as we have for other languages.

Release Notes:

  • N/A

Add C-Style indentation rules for GLSL
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 4, 2026
@yara-blue yara-blue added the area:tree-sitter Syntax highlighting and tree-sitter label Jun 4, 2026
Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Overall looks fine, one minor note

Comment on lines +20 to +21
((comment) @indent
(#match? @indent "^/\\*"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious whether we can instead not add either block_comments or documentation_comment to the language config?

Copy link
Copy Markdown
Contributor Author

@Helmutt03 Helmutt03 Jun 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indents.scm is essentially just a copy of the one C uses. I can remove those lines if it’s not needed here

Copy link
Copy Markdown
Contributor Author

@Helmutt03 Helmutt03 Jun 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried getting it to work but it seems that glsl treesitter doesn't support block comments so adding
block_comment = { start = "/*", prefix = "", end = "*/", tab_size = 1 } &
documentation_comment = { start = "/**", prefix = "* ", end = "*/", tab_size = 1} to config.toml didn't do anything. I have removed the lines, normal comments are probably sufficient anyways.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm that is odd since this should really be unrelated to Tree-sitter IIRC. If you are down, feel free to push a follow-up or dig this more if you can find the underlying issue. Maybe you need to specify a non-empty prefix? Would need to check, but perhaps something did break.

Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a solid improvement and happy to merge. Thanks!

@MrSubidubi MrSubidubi enabled auto-merge June 5, 2026 22:47
@MrSubidubi MrSubidubi added this pull request to the merge queue Jun 5, 2026
Merged via the queue into zed-industries:main with commit 16991c9 Jun 5, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tree-sitter Syntax highlighting and tree-sitter cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants