diff --git a/plugin/query_predicates.lua b/plugin/query_predicates.lua index fed9a271b..7d90372f3 100644 --- a/plugin/query_predicates.lua +++ b/plugin/query_predicates.lua @@ -45,31 +45,3 @@ query.add_directive('set-lang-from-mimetype!', function(match, _, bufnr, pred, m metadata['injection.language'] = parts[#parts] end end, true) - -query.add_directive('downcase!', function(match, _, bufnr, pred, metadata) - local text, key, value ---@type string|string[], string, string|integer - local id = pred[2] - - if #pred == 3 then - -- (#downcase! @capture "key") - key = pred[3] - value = metadata[id][key] - else - -- (#downcase! "key") - key = id - value = metadata[key] - end - - if type(value) == 'string' then - text = value - else - local node = match[value] - text = vim.treesitter.get_node_text(node, bufnr, { metadata = metadata[id] }) or '' - end - - if #pred == 3 then - metadata[id][key] = string.lower(text) - else - metadata[key] = string.lower(text) - end -end, true) diff --git a/runtime/queries/hcl/injections.scm b/runtime/queries/hcl/injections.scm index fd881d503..aae0fb18f 100644 --- a/runtime/queries/hcl/injections.scm +++ b/runtime/queries/hcl/injections.scm @@ -3,5 +3,4 @@ (heredoc_template (template_literal) @injection.content - (heredoc_identifier) @injection.language - (#downcase! @injection.language)) + (heredoc_identifier) @injection.language) diff --git a/runtime/queries/hurl/injections.scm b/runtime/queries/hurl/injections.scm index 363e90046..8765d120a 100644 --- a/runtime/queries/hurl/injections.scm +++ b/runtime/queries/hurl/injections.scm @@ -6,6 +6,5 @@ (#set! injection.language "xml")) (multiline_string - (multiline_string_type) @_lang - (multiline_string_content) @injection.content - (#inject-language! @_lang)) + (multiline_string_type) @injection.language + (multiline_string_content) @injection.content) diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm index 0bead6f4a..fda703683 100644 --- a/runtime/queries/markdown/injections.scm +++ b/runtime/queries/markdown/injections.scm @@ -1,8 +1,7 @@ (fenced_code_block (info_string - (language) @_lang) - (code_fence_content) @injection.content - (#inject-language! @_lang)) + (language) @injection.language) + (code_fence_content) @injection.content) ((html_block) @injection.content (#set! injection.language "html") diff --git a/runtime/queries/php/injections.scm b/runtime/queries/php/injections.scm index 0e78d45e5..182ba0766 100644 --- a/runtime/queries/php/injections.scm +++ b/runtime/queries/php/injections.scm @@ -5,17 +5,15 @@ ((comment) @injection.content (#set! injection.language "phpdoc")) -((heredoc +(heredoc (heredoc_body) @injection.content (heredoc_end) @injection.language - (#set! injection.include-children) - (#downcase! @injection.language))) + (#set! injection.include-children)) -((nowdoc +(nowdoc (nowdoc_body) @injection.content (heredoc_end) @injection.language - (#set! injection.include-children) - (#downcase! @injection.language))) + (#set! injection.include-children)) ;; regex diff --git a/runtime/queries/ruby/injections.scm b/runtime/queries/ruby/injections.scm index 381d96b2f..06ecb3a93 100644 --- a/runtime/queries/ruby/injections.scm +++ b/runtime/queries/ruby/injections.scm @@ -3,8 +3,7 @@ (heredoc_body (heredoc_content) @injection.content - (heredoc_end) @injection.language - (#downcase! @injection.language)) + (heredoc_end) @injection.language) (regex (string_content) @injection.content