Unnamed repository; edit this file 'description' to name the repository.
add a new Enum TagKind (#15361)
* add enum as possible tag kind * document the `definition.enum` capture in the tags guide * tags(rust, c): mark enums as `@definition.enum`
may 4 months ago
parent f8b3171 · commit a85d92d
-rw-r--r--book/src/guides/tags.md1
-rw-r--r--helix-term/src/commands/syntax.rs3
-rw-r--r--runtime/queries/c/tags.scm2
-rw-r--r--runtime/queries/rust/tags.scm2
4 files changed, 6 insertions, 2 deletions
diff --git a/book/src/guides/tags.md b/book/src/guides/tags.md
index 1cf20804..2fb08bed 100644
--- a/book/src/guides/tags.md
+++ b/book/src/guides/tags.md
@@ -19,6 +19,7 @@ The following [captures][tree-sitter-captures] are recognized:
|--- |
| `definition.class` |
| `definition.constant` |
+| `definition.enum` |
| `definition.function` |
| `definition.interface` |
| `definition.macro` |
diff --git a/helix-term/src/commands/syntax.rs b/helix-term/src/commands/syntax.rs
index ae6fcec6..5070ec45 100644
--- a/helix-term/src/commands/syntax.rs
+++ b/helix-term/src/commands/syntax.rs
@@ -39,6 +39,7 @@ use super::Context;
enum TagKind {
Class,
Constant,
+ Enum,
Function,
Interface,
Macro,
@@ -53,6 +54,7 @@ impl TagKind {
match self {
Self::Class => "class",
Self::Constant => "constant",
+ Self::Enum => "enum",
Self::Function => "function",
Self::Interface => "interface",
Self::Macro => "macro",
@@ -67,6 +69,7 @@ impl TagKind {
match name {
"class" => Some(TagKind::Class),
"constant" => Some(TagKind::Constant),
+ "enum" => Some(TagKind::Enum),
"function" => Some(TagKind::Function),
"interface" => Some(TagKind::Interface),
"macro" => Some(TagKind::Macro),
diff --git a/runtime/queries/c/tags.scm b/runtime/queries/c/tags.scm
index 83125b58..6ab7cbe1 100644
--- a/runtime/queries/c/tags.scm
+++ b/runtime/queries/c/tags.scm
@@ -12,4 +12,4 @@
name: (type_identifier) @definition.struct)
(enum_specifier
- name: (type_identifier) @definition.type)
+ name: (type_identifier) @definition.enum)
diff --git a/runtime/queries/rust/tags.scm b/runtime/queries/rust/tags.scm
index 0c4d66bf..cad37733 100644
--- a/runtime/queries/rust/tags.scm
+++ b/runtime/queries/rust/tags.scm
@@ -14,7 +14,7 @@
name: (identifier) @definition.function)
(enum_item
- name: (type_identifier) @definition.type)
+ name: (type_identifier) @definition.enum)
(enum_variant
name: (identifier) @definition.struct)