I’m trying to create a tree-sitter extension with full support for PostgreSQL. PostgreSQL supports creating functions written in other languages where the source is specified between dollar quotes. For example:
CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$
BEGIN
RETURN i + 1;
END;
$$ LANGUAGE plpgsql;
My injection specification looks like this:
((function_body
"AS" @keyword
script: (source_string content: (content) @injection.content))
(#set! injection.language postgresql))
I’m getting no highlighting if I use ‘postgresql’ as the injection language, but it does work if I change it to ‘javascript’. Bug or is it not possible for the injection language to be the same as the primary language?