neovim: add sql injection for typescript

This commit is contained in:
Dmitriy Pleshevskiy 2024-12-11 12:29:44 +03:00
parent 596b3213d6
commit e3c55b0e1e
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -68,21 +68,25 @@ in
}; };
# Source: https://github.com/DariusCorvus/tree-sitter-language-injection.nvim/blob/main/lua/tree-sitter-language-injection/init.lua # Source: https://github.com/DariusCorvus/tree-sitter-language-injection.nvim/blob/main/lua/tree-sitter-language-injection/init.lua
extraQueries.javascript.injections = extraQueries =
let let
lang = "sql"; lang = "sql";
langMatch = ''^//+( )*${lang}( )*|^/[*]+( )*${lang}( )*[*]+/$''; langMatch = ''^//+[ \t]*${lang}[ \t]*|^/[*]+[ \t]*${lang}[ \t]*[*]+/$'';
in javascriptInjection = ''
'' ((comment) @comment .
((comment) @comment . ([ (string(string_fragment) @injection.content)
([ (string(string_fragment) @injection.content) (template_string(string_fragment) @injection.content)
(template_string(string_fragment) @injection.content) ] @injection.content
] @injection.content )
(#match? @comment "${langMatch}")
(#set! injection.language "${lang}")
) )
(#match? @comment "${langMatch}") '';
(#set! injection.language "${lang}") in
) {
''; javascript.injections = javascriptInjection;
typescript.injections = javascriptInjection;
};
settings = { settings = {
incremental_selection = { incremental_selection = {