Files
oak-gpui/extensions/zig/languages/zig/outline.scm
T
xdBronch 029d08350e zig: Switch to official Zig grammar (#20004)
Closes #20001

the old outline was *weird* for many reasons so ill just show it with a
hodgepodge of zig declarations
before:

![image](https://github.com/user-attachments/assets/87395623-3e28-491c-9693-c1714da6b29f)
after:

![image](https://github.com/user-attachments/assets/1aa3f3b7-18b0-4d39-b1c6-99740e7bcd6a)

why were values shown? why werent `var`s or modifiers like pub, const,
export? it was very odd to me and inconsistent with other languages. i
chose to leave out unnamed tests, it just seemed like noise to me since
they werent distinct but i can easily revert that
unfortunately there seems to be a bug upstream which causes those
`t`/`f` decls to show 2 things
https://github.com/tree-sitter-grammars/tree-sitter-zig/issues/3

im very new to treesitter and queries so i really havent looked over the
rest of the stuff here, other than outline theyre unmodified please lmk
if theres anything wrong

Release Notes:

- Changed upstream treesitter grammar for zig
2024-11-07 09:47:15 +01:00

51 lines
856 B
Scheme

(test_declaration
"test" @context
[
(string)
(identifier)
] @name) @item
(function_declaration
"pub"? @context
[
"extern"
"export"
"inline"
"noinline"
]? @context
"fn" @context
name: (_) @name) @item
(source_file
(variable_declaration
"pub"? @context
(identifier) @name
"=" (_) @context) @item)
(struct_declaration
(variable_declaration
"pub"? @context
(identifier) @name
"=" (_) @context) @item)
(union_declaration
(variable_declaration
"pub"? @context
(identifier) @name
"=" (_) @context) @item)
(enum_declaration
(variable_declaration
"pub"? @context
(identifier) @name
"=" (_) @context) @item)
(opaque_declaration
(variable_declaration
"pub"? @context
(identifier) @name
"=" (_) @context) @item)
(container_field
. (_) @name) @item