File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as path from "path";
4
4
5
5
import Mocha from "mocha" ;
6
6
import glob from "glob" ;
7
+ import Parser from "tree-sitter" ;
7
8
8
9
export async function run ( ) : Promise < void > {
9
10
// Create the mocha test
@@ -33,12 +34,20 @@ export async function run(): Promise<void> {
33
34
// create parsers dir
34
35
await fs . mkdir ( parsersDir ) ;
35
36
37
+ const testParser = new Parser ( ) ;
38
+
36
39
// install tree-sitter-rust
37
40
let result = await Installer . getLanguage ( "test-parsers" , "rust" , true ) ;
38
41
if ( result . status === "err" ) {
39
42
throw new Error ( `Failed to install language: ${ result . result } ` ) ;
40
43
}
41
44
45
+ try {
46
+ testParser . setLanguage ( result . result ) ;
47
+ } catch ( error ) {
48
+ throw new Error ( `Failed to install language: ${ result . result } ` ) ;
49
+ }
50
+
42
51
console . log ( `Installed language: ${ JSON . stringify ( result . result ) } ` ) ;
43
52
44
53
// install tree-sitter-typescript
@@ -47,6 +56,12 @@ export async function run(): Promise<void> {
47
56
throw new Error ( `Failed to install language: ${ result . result } ` ) ;
48
57
}
49
58
59
+ try {
60
+ testParser . setLanguage ( result . result ) ;
61
+ } catch ( error ) {
62
+ throw new Error ( `Failed to install language: ${ result . result } ` ) ;
63
+ }
64
+
50
65
console . log ( `Installed language: ${ JSON . stringify ( result . result ) } ` ) ;
51
66
52
67
return new Promise ( ( c , e ) => {
You can’t perform that action at this time.
0 commit comments