Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit d95c26b

Browse files
authored
Merge pull request #638 from bennypowers/css-tagged-templates
Add CSS, GraphQL, and SQL template literal tags to Tree-Sitter grammar
2 parents 975351d + 76b5c69 commit d95c26b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: lib/main.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,17 @@ exports.activate = function () {
6565
}
6666
}
6767

68-
const STYLED_REGEX = /\bstyled\b/i
68+
const CSS_REGEX = /\bstyled\b|\bcss\b/i
69+
const GQL_REGEX = /\bgraphql\b|\bgql\b/i
70+
const SQL_REGEX = /\bsql\b/i
6971

7072
function languageStringForTemplateTag (tag) {
71-
if (STYLED_REGEX.test(tag)) {
73+
if (CSS_REGEX.test(tag)) {
7274
return 'CSS'
75+
} else if (GQL_REGEX.test(tag)) {
76+
return 'GraphQL'
77+
} else if (SQL_REGEX.test(tag)) {
78+
return 'SQL'
7379
} else {
7480
return tag
7581
}

0 commit comments

Comments
 (0)