Skip to content

Commit f9bd01a

Browse files
committed
Implement sample testing
Squash a ton of uncovered bugs
1 parent b62c542 commit f9bd01a

File tree

113 files changed

+1736525
-726464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1736525
-726464
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
- Vimscript
7272
- x86 Assembly
7373
- Zig
74+
- Removed languages due to a lack of working highlight queries:
75+
- Astro
76+
- Common Lisp
77+
- Iex
7478

7579

7680
### 0.10.5

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Inkjet comes bundled with support for over seventy languages, and it's easy to a
3030
| ---- | ------- |
3131
| Ada | `ada` |
3232
| Assembly (generic) | `asm` |
33-
| Astro | `astro` |
3433
| Awk | `awk` |
3534
| Bash | `bash`, `sh`, `shell` |
3635
| BibTeX | `bibtex`, `bib` |
@@ -40,7 +39,6 @@ Inkjet comes bundled with support for over seventy languages, and it's easy to a
4039
| Cap'N Proto | `capnp` |
4140
| Clojure | `clojure`, `clj`, `cljc` |
4241
| C# | `c_sharp`, `c#`, `csharp`, `cs` |
43-
| Common Lisp | `commonlisp`, `common-lisp`, `cl`, `lisp` |
4442
| C++ | `c++`, `cpp`, `hpp`, `h++`, `cc`, `hh` |
4543
| CSS | `css` |
4644
| Cue | `cue` |
@@ -64,7 +62,6 @@ Inkjet comes bundled with support for over seventy languages, and it's easy to a
6462
| HCL | `hcl`, `terraform` |
6563
| HEEx | `heex` |
6664
| HTML | `html`, `htm` |
67-
| IEx | `iex` |
6865
| INI | `ini` |
6966
| JavaScript | `javascript`, `js` |
7067
| JSON | `json` |

build/dev.rs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ pub fn generate_themes_module() -> Result<()> {
228228
#![allow(dead_code)]
229229
};
230230

231-
let themes = themes
232-
.into_iter()
231+
let consts = themes
232+
.iter()
233233
.map(|t| {
234234
let name = quote::format_ident!(
235235
"{}",
@@ -243,9 +243,37 @@ pub fn generate_themes_module() -> Result<()> {
243243
}
244244
});
245245

246+
let tests = themes
247+
.iter()
248+
.map(|t| {
249+
let name = quote::format_ident!(
250+
"{}",
251+
t.replace('-', "_").to_uppercase()
252+
);
253+
254+
let path = include_path(t);
255+
256+
quote::quote! {
257+
#[test]
258+
fn #name() {
259+
let data = #path;
260+
261+
Theme::from_helix(data).unwrap();
262+
}
263+
}
264+
});
265+
246266
let combined = quote::quote!{
247267
#module_start
248-
#(#themes)*
268+
#(#consts)*
269+
270+
#[cfg(test)]
271+
#[allow(non_snake_case)]
272+
mod tests {
273+
use crate::theme::*;
274+
275+
#(#tests)*
276+
}
249277
};
250278

251279
let combined = format!("{combined}");

build/inherits.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
IFS=$(echo -en "\n\b")
6+
7+
for res in $(grep -r "; inherits" languages/); do
8+
FILE=$(echo "$res" | cut -d ":" -f 1 | xargs)
9+
LANG=$(echo "$res" | cut -d ":" -f 3 | xargs)
10+
TARG=$(echo "$res" | cut -d ":" -f2- | xargs)
11+
12+
NAME=$(basename "$FILE")
13+
14+
sed -i "/$TARG/{r languages/$LANG/queries/$NAME
15+
d}" $FILE
16+
done

build/languages.toml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ repo = "https://github.com/rush-rs/tree-sitter-asm"
1313
hash = "55b2b91"
1414
helix_override = true
1515
aliases = ["assembly", "assembler"]
16+
command = '''
17+
set -euxo pipefail &&
18+
cp languages/temp/asm/queries/asm/* languages/temp/asm/queries
19+
'''
1620

17-
[[languages]]
18-
name = "astro"
19-
repo = "https://github.com/virchau13/tree-sitter-astro"
20-
hash = "4be1807"
21-
helix_override = true
21+
# [[languages]]
22+
# name = "astro"
23+
# repo = "https://github.com/virchau13/tree-sitter-astro"
24+
# hash = "4be1807"
25+
# helix_override = true
2226

2327
[[languages]]
2428
name = "awk"
@@ -80,20 +84,21 @@ hash = "fd7f740"
8084
aliases = ["c#", "csharp", "cs"]
8185
helix_override = true
8286

83-
[[languages]]
84-
name = "commonlisp"
85-
pretty_name = "CommonLisp"
86-
helix_path = "common-lisp"
87-
repo = "https://github.com/theHamsta/tree-sitter-commonlisp"
88-
hash = "bf2a65b"
89-
aliases = ["cl", "lisp", "common-lisp"]
87+
# [[languages]]
88+
# name = "commonlisp"
89+
# pretty_name = "CommonLisp"
90+
# helix_path = "common-lisp"
91+
# repo = "https://github.com/theHamsta/tree-sitter-commonlisp"
92+
# hash = "bf2a65b"
93+
# aliases = ["cl", "lisp", "common-lisp"]
9094

95+
# Note - must manually comment out the (nullptr) @constant.builtin line in the highlights.scm for this to work
9196
[[languages]]
9297
name = "cpp"
9398
repo = "https://github.com/tree-sitter/tree-sitter-cpp"
9499
hash = "30f973c"
95100
aliases = ["c++", "hpp", "h++", "cc", "hh"]
96-
helix_override = true
101+
97102

98103
[[languages]]
99104
name = "css"
@@ -230,10 +235,10 @@ repo = "https://github.com/tree-sitter/tree-sitter-html"
230235
hash = "14bdaf0"
231236
aliases = ["htm"]
232237

233-
[[languages]]
234-
name = "iex"
235-
repo = "https://github.com/elixir-lang/tree-sitter-iex"
236-
hash = "39f20bb"
238+
# [[languages]]
239+
# name = "iex"
240+
# repo = "https://github.com/elixir-lang/tree-sitter-iex"
241+
# hash = "39f20bb"
237242

238243
[[languages]]
239244
name = "ini"
@@ -270,7 +275,7 @@ repo = "https://github.com/tree-sitter/tree-sitter-javascript"
270275
hash = "b6f0624"
271276
helix_override = true
272277
command = '''
273-
cp languages/temp/jsx/queries/highlights-jsx.scm languages/temp/jsx/queries/highlights.scm &&
278+
cat languages/temp/jsx/queries/highlights-jsx.scm >> languages/temp/jsx/queries/highlights.scm &&
274279
sed -i -e 's/tree_sitter_javascript/tree_sitter_jsx/g' languages/temp/jsx/src/parser.c &&
275280
sed -i -e 's/tree_sitter_javascript/tree_sitter_jsx/g' languages/temp/jsx/src/scanner.c
276281
'''
@@ -335,7 +340,7 @@ helix_override = true
335340

336341
[[languages]]
337342
name = "nim"
338-
repo = "https://github.com/aMOPel/tree-sitter-nim"
343+
repo = "https://github.com/alaviss/tree-sitter-nim"
339344
hash = "4900b68"
340345
helix_override = true
341346

@@ -403,9 +408,11 @@ repo = "https://github.com/tree-sitter/tree-sitter-php"
403408
hash = "74c6b0d"
404409
command = '''
405410
set -euxo pipefail &&
406-
sed -i -e 's/#include "\(.*\)"/#include "scanner.h"/g' languages/temp/php/php/src/scanner.c &&
407-
cp -r languages/temp/php/php/src languages/temp/php &&
408-
cp languages/temp/php/common/scanner.h languages/temp/php/src
411+
sed -i -e 's/#include "\(.*\)"/#include "scanner.h"/g' languages/temp/php/php_only/src/scanner.c &&
412+
cp -r languages/temp/php/php_only/src languages/temp/php &&
413+
cp languages/temp/php/common/scanner.h languages/temp/php/src &&
414+
sed -i -e 's/tree_sitter_php_only/tree_sitter_php/g' languages/temp/php/src/parser.c &&
415+
sed -i -e 's/tree_sitter_php_only/tree_sitter_php/g' languages/temp/php/src/scanner.c
409416
'''
410417
helix_override = true
411418

@@ -447,6 +454,7 @@ name = "racket"
447454
repo = "https://github.com/6cdh/tree-sitter-racket"
448455
hash = "5b211bf"
449456
aliases = ["rkt"]
457+
helix_override = true
450458

451459
[[languages]]
452460
name = "regex"
@@ -476,6 +484,7 @@ name = "scheme"
476484
repo = "https://github.com/6cdh/tree-sitter-scheme"
477485
hash = "63e25a4"
478486
aliases = ["scm", "ss"]
487+
helix_override = true
479488

480489
[[languages]]
481490
name = "scss"

languages/asm/queries/highlights.scm

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
; General
2+
(label
3+
[(ident) (word)] @label)
4+
5+
(reg) @variable.builtin
6+
7+
(meta
8+
kind: (_) @function.builtin)
9+
10+
(instruction
11+
kind: (_) @function.builtin)
12+
13+
(const
14+
name: (word) @constant)
15+
16+
; Comments
17+
[
18+
(line_comment)
19+
(block_comment)
20+
] @comment @spell
21+
22+
; Literals
23+
(int) @number
24+
25+
(float) @number.float
26+
27+
(string) @string
28+
29+
; Keywords
30+
[
31+
"byte"
32+
"word"
33+
"dword"
34+
"qword"
35+
"ptr"
36+
"rel"
37+
"label"
38+
"const"
39+
] @keyword
40+
41+
; Operators & Punctuation
42+
[
43+
"+"
44+
"-"
45+
"*"
46+
"/"
47+
"%"
48+
"|"
49+
"^"
50+
"&"
51+
] @operator
52+
53+
[
54+
"("
55+
")"
56+
"["
57+
"]"
58+
] @punctuation.bracket
59+
60+
[
61+
","
62+
":"
63+
] @punctuation.delimiter

languages/asm/queries/injections.scm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
([
2+
(line_comment)
3+
(block_comment)
4+
] @injection.content
5+
(#set! injection.language "comment"))

languages/astro/queries/highlights.scm

Lines changed: 0 additions & 12 deletions
This file was deleted.

languages/astro/queries/injections.scm

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)