on master help sign in
feat(prql): add prql support (#6126)
commit2bd8bc8d8484a4a8852280f16888a819acbfde7a authorMatthias Q <35303817+matthias-Q@users.noreply.github.com> dateFri 3 Mar 2023, 20:12 (4 years ago) parent5c716af
4 files changed+158
book/src/generated/lang-support.md+1 languages.toml+13 runtime/queries/prql/highlights.scm+136 runtime/queries/prql/injections.scm+8
book/src/generated/lang-support.md+1
@@ -104,6 +104,7 @@
104104| prisma | ✓ | | | `prisma-language-server` |
105105| prolog | | | | `swipl` |
106106| protobuf | ✓ | | ✓ | |
107+| prql | ✓ | | | |
107108| purescript | ✓ | | | `purescript-language-server` |
108109| python | ✓ | ✓ | ✓ | `pylsp` |
109110| qml | ✓ | | ✓ | `qmlls` |
languages.toml+13
@@ -2208,6 +2208,19 @@ indent = { tab-width = 2, unit = " " }
22082208name = "yuck"
22092209source = { git = "https://github.com/Philipp-M/tree-sitter-yuck", rev = "9e97da5773f82123a8c8cccf8f7e795d140ed7d1" }
22102210
2211+[[language]]
2212+name = "prql"
2213+scope = "source.prql"
2214+injection-regex = "prql"
2215+file-types = ["prql"]
2216+roots = []
2217+comment-token = "#"
2218+indent = { tab-width = 4, unit = " " }
2219+
2220+[[grammar]]
2221+name = "prql"
2222+source = { git = "https://github.com/PRQL/tree-sitter-prql", rev = "3f27cac466f030ee7d985d91eba5470e01dd21ea" }
2223+
22112224[[language]]
22122225name = "po"
22132226scope = "source.po"
runtime/queries/prql/highlights.scmnew file+136
@@ -0,0 +1,136 @@
1+[
2+ (keyword_from)
3+ (keyword_filter)
4+ (keyword_derive)
5+ (keyword_group)
6+ (keyword_aggregate)
7+ (keyword_sort)
8+ (keyword_take)
9+ (keyword_window)
10+ (keyword_join)
11+ (keyword_select)
12+ (keyword_switch)
13+ (keyword_append)
14+ (keyword_remove)
15+ (keyword_intersect)
16+ (keyword_rolling)
17+ (keyword_rows)
18+ (keyword_expanding)
19+ (keyword_let)
20+ (keyword_prql)
21+ (keyword_from_text)
22+] @keyword
23+
24+(literal) @string
25+
26+(assignment
27+ alias: (field) @variable.other.member)
28+
29+alias: (identifier) @variable.other.member
30+
31+(f_string) @string.special
32+(s_string) @string.special
33+
34+(comment) @comment
35+
36+(keyword_func) @keyword.function
37+
38+(function_call
39+ (identifier) @function)
40+
41+[
42+ "+"
43+ "-"
44+ "*"
45+ "/"
46+ "="
47+ "=="
48+ "<"
49+ "<="
50+ "!="
51+ ">="
52+ ">"
53+ "->"
54+ (bang)
55+] @operator
56+
57+[
58+ "("
59+ ")"
60+ "["
61+ "]"
62+] @punctuation.bracket
63+
64+[
65+ ","
66+ "."
67+ (pipe)
68+] @punctuation.delimiter
69+
70+(literal
71+ (integer) @constant.numeric.integer)
72+
73+(integer) @constant.numeric.integer
74+
75+(literal
76+ (decimal_number) @constant.numeric.float)
77+
78+(decimal_number) @constant.numeric.float
79+
80+[
81+ (keyword_min)
82+ (keyword_max)
83+ (keyword_count)
84+ (keyword_count_distinct)
85+ (keyword_average)
86+ (keyword_avg)
87+ (keyword_sum)
88+ (keyword_stddev)
89+ (keyword_count)
90+] @function
91+
92+[
93+ (keyword_side)
94+ (keyword_version)
95+ (keyword_target)
96+ (keyword_null)
97+ (keyword_format)
98+] @attribute
99+
100+(target) @function.builtin
101+
102+ [
103+ (date)
104+ (time)
105+ (timestamp)
106+] @string.special
107+
108+[
109+ (keyword_left)
110+ (keyword_inner)
111+ (keyword_right)
112+ (keyword_full)
113+ (keyword_csv)
114+ (keyword_json)
115+] @function.method
116+
117+[
118+ (keyword_true)
119+ (keyword_false)
120+] @constant.builtin.boolean
121+
122+[
123+ (keyword_and)
124+ (keyword_or)
125+] @keyword.operator
126+
127+(function_definition
128+ (keyword_func)
129+ name: (identifier) @function)
130+
131+(parameter
132+ (identifier) @variable.parameter)
133+
134+(variable
135+ (keyword_let)
136+ name: (identifier) @constant)
runtime/queries/prql/injections.scmnew file+8
@@ -0,0 +1,8 @@
1+((s_string) @injection.content
2+ (#set! injection.language "sql"))
3+
4+(from_text
5+ (keyword_from_text)
6+ (keyword_json)
7+ (literal) @injection.content
8+ (#set! injection.language "json"))