From 024f5fbcc6fab26aa5699cd632e02d0ae98c2314 Mon Sep 17 00:00:00 2001 From: elgiano Date: Thu, 27 Oct 2022 16:21:09 +0200 Subject: [PATCH] move js to ecma to avoid jsx problems --- queries/ecma/injections.scm | 31 +++++++++++++++++ queries/html/highlights.scm | 7 ++-- queries/html/injections.scm | 16 +++------ queries/javascript/injections.scm | 58 ------------------------------- queries/typescript/injections.scm | 1 - 5 files changed, 39 insertions(+), 74 deletions(-) create mode 100644 queries/ecma/injections.scm delete mode 100644 queries/javascript/injections.scm delete mode 100644 queries/typescript/injections.scm diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm new file mode 100644 index 0000000..8ac2bed --- /dev/null +++ b/queries/ecma/injections.scm @@ -0,0 +1,31 @@ +;; extends +((decorator + (call_expression + function: ((identifier) @_name + (#eq? @_name "Component")) + arguments: (arguments + (object + (pair + key: ((property_identifier) @_prop + (#eq? @_prop "template")) + value: ((template_string) @html (#offset! @html 0 1 0 -1)) + ) + )) + ) +)) + +((decorator + (call_expression + function: ((identifier) @_name + (#eq? @_name "Component")) + arguments: (arguments + (object + (pair + key: ((property_identifier) @_prop + (#eq? @_prop "styles")) + value: (array + ((template_string) @css (#offset! @css 0 1 0 -1))) + ) + )) + ) +)) diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index 14ddaa4..f157b20 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,11 +1,12 @@ +;; extends (attribute ((attribute_name) @_name - (#lua-match? @_name "%[.*%]"))) @keyword + (#lua-match? @_name "%[.*%]")) @keyword) (attribute ((attribute_name) @_name - (#lua-match? @_name "%(.*%)"))) @keyword + (#lua-match? @_name "%(.*%)")) @keyword) (attribute ((attribute_name) @_name - (#lua-match? @_name "^%*.*"))) @keyword + (#lua-match? @_name "^%*.*")) @keyword) diff --git a/queries/html/injections.scm b/queries/html/injections.scm index 04185dc..804e1d2 100644 --- a/queries/html/injections.scm +++ b/queries/html/injections.scm @@ -1,26 +1,18 @@ -; [state]="myState$ | async" +;; extends (attribute ((attribute_name) @_name - (#lua-match? @_name "%[.*%]")) + (#lua-match? @_name "[%[%(].*[%)%]]")) (quoted_attribute_value (attribute_value) @angular)) -; (myEvent)="handle($event)" (attribute ((attribute_name) @_name - (#lua-match? @_name "%(.*%)")) + (#lua-match? @_name "^%*")) (quoted_attribute_value ((attribute_value) @angular))) -; *ngIf="blorgy" -(attribute - ((attribute_name) @_name - (#lua-match? @_name "^%*.*")) - (quoted_attribute_value - ((attribute_value) @angular))) - -; {{ someBinding }} (element ((text) @angular (#lua-match? @angular "%{%{.*%}%}") (#offset! @angular 0 2 0 -2))) + diff --git a/queries/javascript/injections.scm b/queries/javascript/injections.scm deleted file mode 100644 index 10d6ad9..0000000 --- a/queries/javascript/injections.scm +++ /dev/null @@ -1,58 +0,0 @@ -;; Angular language injections -;; TODO: Figure out how to inject preproccessors languages - -(class_declaration - decorator: (decorator - (call_expression - function: ((identifier) @_name - (#eq? @_name "Component")) - arguments: (arguments - (object - (pair - key: ((property_identifier) @_prop - (#eq? @_prop "template")) - value: ((template_string) @html - (#offset! @html 0 1 0 -1)))))))) - -(export_statement - decorator: (decorator - (call_expression - function: ((identifier) @_name - (#eq? @_name "Component")) - arguments: (arguments - (object - (pair - key: ((property_identifier) @_prop - (#eq? @_prop "template")) - value: ((template_string) @html - (#offset! @html 0 1 0 -1))))))) - declaration: (class_declaration)) - -(class_declaration - decorator: (decorator - (call_expression - function: ((identifier) @_name - (#eq? @_name "Component")) - arguments: (arguments - (object - (pair - key: ((property_identifier) @_prop - (#eq? @_prop "styles")) - value: (array - ((template_string) @css - (#offset! @css 0 1 0 -1))))))))) - -(export_statement - decorator: (decorator - (call_expression - function: ((identifier) @_name - (#eq? @_name "Component")) - arguments: (arguments - (object - (pair - key: ((property_identifier) @_prop - (#eq? @_prop "styles")) - value: (array - ((template_string) @css - (#offset! @css 0 1 0 -1)))))))) - declaration: (class_declaration)) diff --git a/queries/typescript/injections.scm b/queries/typescript/injections.scm deleted file mode 100644 index 1d2bceb..0000000 --- a/queries/typescript/injections.scm +++ /dev/null @@ -1 +0,0 @@ -;inherits (javascript)