From f05393381d3bf3ac4f3fe3df940df088d87f3c39 Mon Sep 17 00:00:00 2001 From: Danila Mihailov Date: Sat, 11 May 2024 01:02:35 +0500 Subject: [PATCH] feat(treesitter): add injections of glsl --- after/queries/lua/injections.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 after/queries/lua/injections.scm diff --git a/after/queries/lua/injections.scm b/after/queries/lua/injections.scm new file mode 100644 index 0000000..30e9fcf --- /dev/null +++ b/after/queries/lua/injections.scm @@ -0,0 +1,19 @@ +;; extends + +;; inject glsl for any string that starts `#pragma language glsl` +(string + content: _ @injection.content + (#lua-match? @injection.content "^%s*#pragma language glsl") + (#set! injection.language "glsl")) + + +; inject glsl for calls to newShader +; love.graphics.newShader([[...]]) +; and even just newShader([[...]]) +((function_call + name: (_) @_function + arguments: (arguments + (string + content: _ @injection.content))) + (#contains? @_function "newShader") + (#set! injection.language "glsl"))