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.

go: support highlight regexp (#11538)

d1y9d681bda8d60
diff --git a/crates/languages/src/go/injections.scm b/crates/languages/src/go/injections.scm
new file mode 100644
index 00000000000..7744d98679b
--- /dev/null
+++ b/crates/languages/src/go/injections.scm
@@ -0,0 +1,13 @@
+; Refer to https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/go/injections.scm#L4C1-L16C41
+(call_expression
+ (selector_expression) @_function
+ (#any-of? @_function
+ "regexp.Match" "regexp.MatchReader" "regexp.MatchString" "regexp.Compile" "regexp.CompilePOSIX"
+ "regexp.MustCompile" "regexp.MustCompilePOSIX")
+ (argument_list
+ .
+ [
+ (raw_string_literal)
+ (interpreted_string_literal)
+ ] @content
+ (#set! "language" "regex")))