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
extraQueries.javascript.injections =
extraQueries =
let
lang = "sql";
langMatch = ''^//+( )*${lang}( )*|^/[*]+( )*${lang}( )*[*]+/$'';
in
''
((comment) @comment .
([ (string(string_fragment) @injection.content)
(template_string(string_fragment) @injection.content)
] @injection.content
langMatch = ''^//+[ \t]*${lang}[ \t]*|^/[*]+[ \t]*${lang}[ \t]*[*]+/$'';
javascriptInjection = ''
((comment) @comment .
([ (string(string_fragment) @injection.content)
(template_string(string_fragment) @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 = {
incremental_selection = {