Commit graph

82 commits

Author SHA1 Message Date
Andrew Hlynskyi
3c0152a331 chore(fmt): Apply 'cargo fmt' to the whole code base 2021-05-19 23:21:43 +03:00
pbug90
9d04efda94 update wording 2021-03-13 19:55:04 +01:00
pbug90
9a833d165e update test command filter help 2021-03-13 19:53:10 +01:00
pbug90
858160172f update test command help outputs 2021-03-13 19:45:55 +01:00
Max Brunsfeld
8e894ff3f1 Add --no-bindings flag to generate subcommand 2021-03-08 12:01:45 -08:00
Yijun Yu
9e08712773 Add --xml option to save the parsed code into XML, using node.start_byte() and node.end_byte() 2021-01-04 22:07:38 +00:00
Max Brunsfeld
026231e93d Merge branch 'master' into HEAD 2020-12-03 09:44:33 -08:00
Patrick Thomson
938eae8536 Merge remote-tracking branch 'origin/master' into query-testy 2020-10-27 09:16:58 -04:00
Max Brunsfeld
b972a7158d Tweak cancellation logic for CLI commands
In 'parse' and 'highlight' cancel on stdin if stdin is a tty.
2020-10-23 12:15:44 -07:00
Patrick Thomson
91d5d59d85 Introduce query/assert and call it in query.rs. 2020-10-21 12:37:24 -04:00
Max Brunsfeld
0a46033391 Remove duplication of LossyUtf8 helper 2020-10-14 11:35:50 -07:00
Patrick Thomson
470733b323 Fix crash when nonexistent files were passed to parse.
We were unwrapping the result of counting the characters in the vector
returned by collect_files(), which, if that vector is empty, returns
None. The most correct behavior is to halt if a nonexistent filename
was provided or a glob failed.
2020-09-30 15:52:21 -04:00
Patrick Thomson
33435f43c0 Take Max's suggestions. 2020-09-30 09:28:58 -04:00
Patrick Thomson
16bd061b33 Have the caller track stats here. 2020-09-29 15:43:30 -04:00
Patrick Thomson
939cdf12b9 Add --stats flag for reporting parse information. 2020-09-29 12:34:25 -04:00
Max Brunsfeld
32099050d6 node_types: Fix panic when field is associated with a hidden token
Fixes #695
2020-07-24 09:26:56 -07:00
Max Brunsfeld
91a715799e Accept a paths file to most CLI subcommands 2020-07-14 15:04:39 -07:00
Tuấn-Anh Nguyễn
c2fb0f5229 cli: Add --byte-range flag to query command 2020-07-12 20:47:23 +07:00
Max Brunsfeld
e4e785b567 Remove unused flags from tags CLI command 2020-07-10 13:47:56 -07:00
Max Brunsfeld
b52f28d6d5 Allow measuring time for tags subcommand 2020-07-09 11:28:07 -07:00
lerencao
37ee7acc9e
[cli]: add an option to no open browser in web-ui command (#620) 2020-05-15 23:56:40 -07:00
Max Brunsfeld
4996cbe830 cli: Move more of the tags code from main into the tags module 2020-03-10 16:52:10 -07:00
Max Brunsfeld
feac368a30 Start work on new tree-sitter-tags crate
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
2020-03-04 14:27:31 -08:00
Mark Schmitz
b1c7768cc2
Output also HTML_FOOTER with highlight --html (#550)
* Output also HTML_FOOTER with highlight --html

* move html footer output after end of for loop, as only one closing tag
is needed
2020-03-02 15:04:15 -08:00
Max Brunsfeld
7421836ee4 Improve cli error message on invalid glob 2020-01-16 16:17:33 -08:00
Max Brunsfeld
f53e7377dc Allow highlight to command to take glob patterns 2019-12-17 15:49:05 -08:00
Max Brunsfeld
5edf97bca9 Remove accidentally-commited garbage line in arg parsing config 2019-12-16 11:59:26 -08:00
Max Brunsfeld
bea6e0e28b cli: Generate parseres with the new ABI by default 2019-12-06 11:51:55 -08:00
Max Brunsfeld
bd49fbab12 cli: Allow globs and exclusions (via '!' prefix) as args to parse 2019-12-06 11:41:21 -08:00
Max Brunsfeld
4b9feccd13 Run syntax highlighting tests as part of the main test command
Also, allow `corpus` to be in the `test/corpus` directory, and expect 
highlighting tests to be in the `test/highlight` directory.
2019-12-05 15:28:16 -08:00
Max Brunsfeld
6dbfbaed07 Start work on a system for testing syntax highlighting 2019-12-05 09:45:54 -08:00
Max Brunsfeld
e14e285a10 cli: Check queries when running tree-sitter test 2019-10-18 14:44:16 -07:00
Max Brunsfeld
b79295e1a0 🔥 Everything related to property sheets 2019-10-17 11:00:31 -07:00
Max Brunsfeld
075a552430 Tweak how highlight query paths are specified in package.json 2019-10-17 10:14:05 -07:00
Max Brunsfeld
f4903578f8 Start reimplementing highlight crate with tree queries 2019-10-14 12:30:22 -07:00
Max Brunsfeld
d9b8bae629 rust: Include pattern indices when iterating query captures 2019-09-18 14:22:55 -07:00
Max Brunsfeld
c71de5bd81 Tweak query interface
* Rename TSQueryContext -> TSQueryCursor
* Remove the permanent association between the cursor and its query. The 
cursor can now be used again for a different query.
2019-09-11 17:33:48 -07:00
Max Brunsfeld
ad3f21b0e5 Add simple CLI command for running tree queries 2019-09-11 15:12:45 -07:00
Ika
d88dae7a3e feat(cli): support snapshot testing with --update flag
This PR adds an `--update` flag to the `tree-sitter test` command, which adds the ability to replace the _expected_ output in the corpus.txt with the _actual_ output produced by the parser, that is, we can now simply use this `--update` flag to write all the corresponding parser output back to the corpus.txt, and we just need to check the output without typing its actual sexp.

- use the same output format as `tree-sitter parse`, except there won't be any position information printed.
- the corpus.txt won't be touched if there's no difference between the _expected_ output and the _actual_ output in that file.
- if there're differences between _expected_ and _actual_, _expected_ will be replaced by _actual_ and the whole file will be reformatted, i.e., all the output sexp will be formatted just like the output from `tree-sitter parse` and all the delimiters `===`/`---` will be normalized as 80-column long.
- this flag also works with `--filter` flag.
2019-09-06 10:57:59 +08:00
Ika
807fdf3ef0 Revert "feat(cli): support snapshot testing with --update flag"
This reverts commit 1b033fdfa4.
2019-09-06 10:42:37 +08:00
Ika
1b033fdfa4 feat(cli): support snapshot testing with --update flag
This PR adds an `--update` flag to the `tree-sitter test` command, which adds the ability to replace the _expected_ output in the corpus.txt with the _actual_ output produced by the parser, that is, we can now simply use this `--update` flag to write all the corresponding parser output back to the corpus.txt, and we just need to check the output without typing its actual sexp.

- use the same output format as `tree-sitter parse`, except there won't be any position information printed.
- the corpus.txt won't be touched if there's no difference between the _expected_ output and the _actual_ output in that file.
- if there're differences between _expected_ and _actual_, only the test case that is different will be replaced, the rest test cases will stay as-is. (All the delimiters `===`/`---` will be normalized as 80-column long, though.)
- this flag also works with `--filter` flag.
2019-09-01 23:52:39 +08:00
Max Brunsfeld
8037607583 Only generate the new parse table format if --next-abi flag is used 2019-08-29 17:37:33 -07:00
Max Brunsfeld
aeb2f895b4 Add --report-states flag for reporting state counts for each rule 2019-08-29 17:36:39 -07:00
Max Brunsfeld
09b46b87dd Remove unnecessary blank lines from parse command output on error 2019-08-28 15:29:44 -07:00
Max Brunsfeld
93f7de03e2 cli: Handle multi-parser repos, content-regex property
Prompted by tree-sitter/tree-sitter-typescript#68
2019-08-07 17:41:45 -07:00
Max Brunsfeld
f4740a1beb Make properties generation aware of which nodes are leaves 2019-07-22 09:30:05 -07:00
Max Brunsfeld
f85ce2fbfa Remove state-ids-to-log flag 2019-07-18 16:06:13 -07:00
Max Brunsfeld
bd466febb4 highlight: Fix panic when cancelled before parsing a nested document 2019-07-16 14:34:24 -07:00
Max Brunsfeld
fa68ef4cea Make git sha optional at build time
Fixes #352
2019-06-06 13:12:53 -07:00
Max Brunsfeld
d274e81d0d Overhaul CLI error handling to allow multiple levels of context 2019-05-30 16:52:55 -07:00