From 4f256c757762397fc0ce507067d90d2e564c2a18 Mon Sep 17 00:00:00 2001 From: Ulysse Buonomo Date: Fri, 10 May 2024 12:00:51 -0400 Subject: [PATCH] Add Ruby language injections (#8796) This adds support for Ruby heredoc's syntax highlighting. The injection was directly taken from the tree-sitter [documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection). It is quite simple, but has the drawback of only showing highlighting once the heredoc is fully written and next line is started. This is due to the fact that we use the last line of the heredoc to determine the language. As using the first one would require some cleaning up that we cannot do trivially. (I might have not fully understood the behaviour of the `#match?` predicate, which could help us) Fixes #4473 Release Notes: - Added Ruby language injections ([#4473](https://github.com/zed-industries/zed/issues/4473)). image --- crates/languages/src/ruby/injections.scm | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 crates/languages/src/ruby/injections.scm diff --git a/crates/languages/src/ruby/injections.scm b/crates/languages/src/ruby/injections.scm new file mode 100644 index 0000000000000000000000000000000000000000..fa6e25369128ee2a08fd08e08e4a7e7d7dfe1cac --- /dev/null +++ b/crates/languages/src/ruby/injections.scm @@ -0,0 +1,2 @@ +(heredoc_body + (heredoc_end) @language) @content