pub const OBJECTSCRIPT_INJECTIONS_QUERY: &str = "; SQL and HTML Injections\n\n(embedded_html\n (angled_bracket_fenced_text) @injection.content\n (#set! injection.language \"html\")\n ;; TODO: Investigate if we can use html as the fallback grammar\n ;; We REALLY need to make it easy for users to bundle all of these\n ;; grammars\n)\n\n(embedded_sql\n (_\n (paren_fenced_text) @injection.content\n )\n (#set! injection.language \"sql\")\n)\n\n(embedded_js\n (angled_bracket_fenced_text) @injection.content\n (#set! injection.language \"javascript\")\n)\n\n(embedded_xml\n (angled_bracket_fenced_text) @injection.content\n (#set! injection.language \"xml\")\n)\n\n([\n (line_comment_1)\n (line_comment_2)\n (line_comment_3)\n (block_comment)\n] @injection.content\n (#set! injection.language \"comment\"))\n\n\n; Target method_body_content and reparse it using\n; objectscript_core\n;\n\n((documatic_line) @injection.content\n (#set! injection.language \"comment\")\n)\n\n;; Keywords, one of type language = \"python\", none of type codemode\n(method_definition\n\tkeywords:\n (_\n \t(kw_External_Language rhs: _ @injection.language)\n )\n body: (_) @injection.content\n (#set! injection.include-children \"true\")\n)\n\n(trigger\n\tkeywords:\n (_\n \t(kw_External_Language rhs: _ @injection.language)\n )\n body: (_) @injection.content\n (#set! injection.include-children \"true\")\n)\n\n; A query must be of type %SQLQuery to have an SQL body, otherwise the body\n; is empty\n(query\n\ttype: (_ (typename (identifier) @_querytype (#eq? @_querytype \"%SQLQuery\")))\n (_ (query_body_content) @injection.content)\n (#set! injection.language \"sql\")\n (#set! injection.include-children \"true\")\n)\n\n; XDATA blocks. There\'s a MimeType keyword that defines the content-type\n; To prevent overlapping matches, we use a different body for the case where\n; no MimeType is given and default to XML, otherwise we extract the language\n; from the mimetype.\n\n(xdata\n keywords:\n (_\n (kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype \"\\\"text/markdown\\\"\"))\n )\n body: (xdata_body_content_any) @injection.content\n (#set! injection.language \"markdown\")\n (#set! injection.include-children \"true\")\n)\n\n(xdata\n keywords:\n (_\n (kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype \"\\\"text/xml\\\"\"))\n )\n ; NOTE: Since MimeType is given, we match xdata_body_content_any not xml\n body: (xdata_body_content_any) @injection.content\n (#set! injection.language \"xml\")\n (#set! injection.include-children \"true\")\n)\n\n(xdata\n keywords:\n (_\n (kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype \"\\\"text/html\\\"\"))\n )\n body: (xdata_body_content_any) @injection.content\n (#set! injection.language \"html\")\n (#set! injection.include-children \"true\")\n)\n\n(xdata\n keywords:\n (_\n (kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype \"\\\"application/json\\\"\"))\n )\n body: (xdata_body_content_any) @injection.content\n (#set! injection.language \"json\")\n (#set! injection.include-children \"true\")\n)\n\n(xdata\n keywords:\n (_\n (kw_MimeType rhs: _ @_mimetype (#eq? @_mimetype \"\\\"text/css\\\"\"))\n )\n body: (xdata_body_content_any) @injection.content\n (#set! injection.language \"css\")\n (#set! injection.include-children \"true\")\n)\n\n; Match an unspecified XDATA -- defaults to XML\n(xdata\n body: (xdata_body_content_xml) @injection.content\n (#set! injection.language \"xml\")\n (#set! injection.include-children \"true\")\n)\n\n\n; NOTE: This should work in tree-sitter, but #strip! seems to not be available\n; in Zed and possibly other environments.\n;\n; Also, it\'s not exactly clear if include-children and combined are needed\n;\n; (xdata\n; keywords:\n; (_\n; (kw_MimeType rhs: (_) @injection.language\n; (#match? @injection.language \"^\\\"[A-Za-z0-9.+-]+/[^\\\"/]+\\\"$\")\n; )\n; )\n;\n; (#strip! @injection.language \"^\\\"|\\\"$\") ; strip outer quotes\n; (#strip! @injection.language \"^[^/]+/\") ; drop leading application or text prefix\n; (#strip! @injection.language \"^x-\") ; drop leading x- on the name\n;\n; body: (xdata_body_content_any) @injection.content\n; (#set! injection.include-children \"false\")\n; (#set! injection.combined \"true\")\n; )\n;\n; ; Match an unspecified XDATA -- that is XML\n; (xdata\n; body: (xdata_body_content_xml) @injection.content\n; (#set! injection.language \"xml\")\n; (#set! injection.include-children \"false\")\n; (#set! injection.combined \"true\")\n; )\n\n; Storage definition is XML\n(storage\n body: (_) @injection.content\n (#set! injection.language \"xml\")\n (#set! injection.include-children \"true\")\n)\n\n";Expand description
The injections query for ObjectScript.