Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

move collapsed only matches outside item parent in embedding.scm

KCaverly9f160537ef4e
diff --git a/crates/semantic_index/src/semantic_index_tests.rs b/crates/semantic_index/src/semantic_index_tests.rs
index f2cae8a5570..182010ca833 100644
--- a/crates/semantic_index/src/semantic_index_tests.rs
+++ b/crates/semantic_index/src/semantic_index_tests.rs
@@ -305,6 +305,11 @@ async fn test_code_context_retrieval_rust() {
todo!();
}
}
+
+ #[derive(Clone)]
+ struct D {
+ name: String
+ }
"
.unindent();
@@ -361,6 +366,15 @@ async fn test_code_context_retrieval_rust() {
.unindent(),
text.find("fn function_2").unwrap(),
),
+ (
+ "
+ #[derive(Clone)]
+ struct D {
+ name: String
+ }"
+ .unindent(),
+ text.find("struct D").unwrap(),
+ ),
],
);
}
@@ -1422,6 +1436,9 @@ fn rust_lang() -> Arc<Language> {
name: (_) @name)
] @item
)
+
+ (attribute_item) @collapse
+ (use_declaration) @collapse
"#,
)
.unwrap(),
diff --git a/crates/zed/src/languages/rust/embedding.scm b/crates/zed/src/languages/rust/embedding.scm
index c4ed7d20976..286b1d13571 100644
--- a/crates/zed/src/languages/rust/embedding.scm
+++ b/crates/zed/src/languages/rust/embedding.scm
@@ -2,8 +2,6 @@
[(line_comment) (attribute_item)]* @context
.
[
- (attribute_item) @collapse
- (use_declaration) @collapse
(struct_item
name: (_) @name)
@@ -29,3 +27,6 @@
name: (_) @name)
] @item
)
+
+(attribute_item) @collapse
+(use_declaration) @collapse