Skip to content

Commit 027c8ff

Browse files
TheLeoPechasnovski
authored andcommitted
docs: mention treesitter injection for embedded lua in TESTING.md
1 parent d6d4c11 commit 027c8ff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

TESTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,3 +993,19 @@ local set_lines = function(lines) child.api.nvim_buf_set_lines(0, 0, -1, true, l
993993
- When working with automatically named screenshots, beware of the following caveats:
994994
- Some systems are case insensitive (like usually Windows and MacOS). So having two different file names which are the same ignoring case will introduce problems for users to properly install plugin.
995995
- Some system setups have restrictions on full path length (like 260 bytes on some Git+Windows combinations) or file name length (like 255 bytes on ext4 Windows partitions and 143 bytes on eCryptfs Linux partitions). Restriction on full path is hard to accommodate for (apart from limiting file name size to some reasonable number), but trying to not have file names longer than 143 bytes (by having shorter test case names) should be reasonable.
996+
997+
- To make reading strings that contain Lua code easier (for `child.lua` and `child.lua_get`), you can add the following treesitter capture to your personal configuration. Put it on the file `/queries/lua/injections.scm`, you may need to create it if it doesn't exist already. Don't forget to add `; extends` at the beginning of the file (see `:h treesitter-query-modeline-extends`)
998+
999+
```query
1000+
; extends
1001+
(function_call
1002+
name: (dot_index_expression
1003+
table: (identifier) @_table
1004+
field: (identifier) @_field)
1005+
arguments: (arguments
1006+
(string
1007+
content: (string_content) @injection.content))
1008+
(#eq? @_table child)
1009+
(#any-of? @_field lua lua_get)
1010+
(#set! injection.language "lua"))
1011+
```

0 commit comments

Comments
 (0)