Jostein Kjønigsen
d0559ca43f
Fix whitespace issues when using paths-file.
2021-10-25 23:51:01 +02:00
Andrew Hlynskyi
16470bc0b1
chore(cli): Rename all internal web_ui stuff to playground
2021-09-22 04:28:08 +03:00
Andrew Hlynskyi
62d79b80e1
feat(cli): add a flag to compile a parser in debug mode with -O0 C/C++ compiler flag
2021-09-13 13:48:02 +03:00
Kolja Lampe
99243ddaf2
Correct quiet description for playground
2021-08-06 01:58:24 +03:00
Max Brunsfeld
59cd1c3962
Merge pull request #1235 from ahlinc/feat/cli-help-messages
...
feat(cli): Add a lot of help messages for CLI options
2021-07-19 11:32:32 -07:00
Andrew Hlynskyi
b4208ee307
feat(cli): Add a lot of help messages for CLI options
2021-07-03 16:14:57 +03:00
Andrew Hlynskyi
bc94c0cc2f
fix(cli): fix theme key loading from config.json, closes #1232
2021-07-03 03:38:24 +03:00
Andrew Hlynskyi
60f0953b65
feat(cli): Set TREE_SITTER_DEBUG env var on 'tree-sitter parse -d'
2021-06-30 18:51:43 +03:00
Andrew Hlynskyi
202a37f1a1
chore(cli): Use DeriveDisplayOrder Clap's setting
...
To show sub commands in the defined order that looks more accurate
and have more meaning for sub commands use order.
2021-06-27 03:37:56 +03:00
Andrew Hlynskyi
2e2b239c42
fix(cli): Don't silently overwrite existing config file
2021-06-27 03:15:35 +03:00
Vladimir Panteleev
5adf7bdcde
cli/src/main.rs: Fix panic with empty file list to parse
...
E.g.: tree-sitter parse --paths /dev/null
2021-06-26 18:11:30 +00:00
Andrew Hlynskyi
bd0e60240e
fix(cli): Change -h -> -H for the highlight subcommand to don't clash with the help flag
2021-06-24 12:09:00 +03:00
Andrew Hlynskyi
650ee94800
fix(cli): disable help subcommand, -h, --help are enough
2021-06-24 12:04:12 +03:00
Andrew Hlynskyi
1220ec3852
feat(cli): Rename web-ui -> playground with fallback alias
2021-06-24 12:04:12 +03:00
Andrew Hlynskyi
80ee33b073
feat(cli): Add short aliases for frequent subcommands
2021-06-24 11:55:50 +03:00
Andrew Hlynskyi
04badf8a8e
feat(cli): Enable clap colored help
2021-06-24 11:55:50 +03:00
Andrew Hlynskyi
421815a68d
feat(cli): Make more clearer sub command selection
2021-06-23 10:51:55 +03:00
Andrew Hlynskyi
318b00e437
fix(cli): Don't print 'Error:' prefix
2021-06-14 10:46:39 +03:00
Douglas Creager
b44270efab
cli: Missing config file shouldn't be an error
...
Just fall back on the default values for each configuration option.
2021-06-10 10:22:20 -04:00
Douglas Creager
e841fcfa1b
cli: Extract CLI configuration into separate crate
...
This patch adds the `tree-sitter-config` crate, which manages
tree-sitter's configuration file. This new setup allows different
components to define their own serializable configuration types, instead
of having to create a single monolithic configuration type. But the
configuration itself is still stored in a single JSON file.
Before, the default location for the configuration file was
`~/.tree-sitter/config.json`. This patch updates the default location
to follow the XDG Base Directory spec (or other relevant platform-
specific spec). So on Linux, for instance, the new default location is
`~/.config/tree-sitter/config.json`. We will look in the new location
_first_, and fall back on reading from the legacy location if we can't
find anything.
2021-06-10 10:21:22 -04:00
Douglas Creager
66c30648c2
rust: Extract runtime language detection into separate crate
...
This patch adds a new `tree-sitter-loader` crate, which holds the CLI's
logic for finding and building local grammar definitions at runtime.
This allows other command-line tools to use this logic too!
2021-06-09 17:42:30 -04:00
Douglas Creager
75da247317
cli: Ignore BrokenPipe errors again
...
With the change to anyhow in the previous commit, we stopped ignoring
BrokenPipe errors. Now we do again, not as a core part of our error
type, but as part of the `main` functions reaction to any error that
occurs.
2021-06-09 16:17:23 -04:00
Douglas Creager
d2d01e77e3
cli: Use anyhow and thiserror for errors
...
This patch updates the CLI to use anyhow and thiserror for error
management. The main feature that our custom `Error` type was providing
was a _list_ of messages, which would allow us to annotate "lower-level"
errors with more contextual information. This is exactly what's
provided by anyhow's `Context` trait.
(This is setup work for a future PR that will pull the `config` and
`loader` modules out into separate crates; by using `anyhow` we wouldn't
have to deal with a circular dependency between with the new crates.)
2021-06-09 16:17:23 -04:00
Max Brunsfeld
22620dee73
Merge pull request #1135 from ahlinc/fix/panic-on-broken-pipe
...
fix(cli): Panic on broken pipe
2021-06-07 11:15:37 -07:00
Andrew Hlynskyi
ce2bb561b4
chore(cli): Panic on broken pipe; review fixes
2021-06-07 21:11:49 +03:00
Andrew Hlynskyi
65dc922944
fix(cli): Panic on broken pipe for: 'tree-sitter parse ... | head'
...
Introduce a concept of ignored errors when the Error wrapper struct
contains None instead of Vec of String messages.
2021-05-31 18:34:09 +03:00
Max Brunsfeld
d72771a19f
Make ::set_{byte,point}_range methods take a Range
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:21:11 -07:00
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