From 68b21578ac4b5ded1a262469c6887794a689284f Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 10 Jan 2024 14:31:05 -0500 Subject: Reimplement tree motions in terms of syntax::TreeCursor This uses the new TreeCursor type from the parent commit to reimplement the tree-sitter motions (`A-p/o/i/n`). Other tree-sitter related features like textobjects are not touched with this change and will need a different, unrelated approach to solve. --- helix-term/tests/test/movement.rs | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'helix-term/tests') diff --git a/helix-term/tests/test/movement.rs b/helix-term/tests/test/movement.rs index 4ebaae85..1c25032c 100644 --- a/helix-term/tests/test/movement.rs +++ b/helix-term/tests/test/movement.rs @@ -635,3 +635,60 @@ async fn test_surround_delete() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn tree_sitter_motions_work_across_injections() -> anyhow::Result<()> { + test_with_config( + AppBuilder::new().with_file("foo.html", None), + ( + "", + "", + "", + ), + ) + .await?; + + // When the full injected layer is selected, expand_selection jumps to + // a more shallow layer. + test_with_config( + AppBuilder::new().with_file("foo.html", None), + ( + "", + "", + "#[|]#", + ), + ) + .await?; + + test_with_config( + AppBuilder::new().with_file("foo.html", None), + ( + "", + "", + "", + ), + ) + .await?; + + test_with_config( + AppBuilder::new().with_file("foo.html", None), + ( + "", + "", + "", + ), + ) + .await?; + + test_with_config( + AppBuilder::new().with_file("foo.html", None), + ( + "", + "", + "", + ), + ) + .await?; + + Ok(()) +} -- cgit v1.2.3-70-g09d2