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
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
Max Brunsfeld
8c3d1466ec
Allow QueryCursor's text callback to return an iterator
2021-05-23 21:05:26 -07:00
Douglas Creager
850007718a
cli: Warn about queries that exceed match limit
2021-04-27 09:38:43 -04:00
Patrick Thomson
e1da6e554b
Remove fanciful nomenclature.
2020-11-23 12:01:08 -05:00
Patrick Thomson
6764b803a0
Allow overlap in specs.
2020-11-23 11:58:07 -05:00
Patrick Thomson
6adeb7b40d
move shared code to query_testing
2020-10-26 14:27:33 -04:00
Patrick Thomson
3e18e97f7c
start pulling in the stuff from test_highlight
2020-10-26 12:58:32 -04:00
Patrick Thomson
363a0ce4fc
things are working: time to piggyback off the highlighter's parser
2020-10-21 14:54:47 -04:00
Patrick Thomson
947528f019
use our Result type here
2020-10-21 12:49:41 -04:00
Patrick Thomson
91d5d59d85
Introduce query/assert and call it in query.rs.
2020-10-21 12:37:24 -04: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
58617cfa0c
Improve output format for query subcommand
2020-01-15 17:08:31 -08:00
Max Brunsfeld
9872a083b7
rust: Change QueryCursor::captures to expose the full match
2019-10-03 12:45:58 -07:00
Max Brunsfeld
d9b8bae629
rust: Include pattern indices when iterating query captures
2019-09-18 14:22:55 -07:00
Max Brunsfeld
096126d039
Allow predicates in queries, to match on nodes' text
2019-09-15 22:06:51 -07:00
Max Brunsfeld
a1fec71b19
Tweak QueryCursor to allow iterating either matches or captures
...
For syntax highlighting, we want to iterate over all of the captures in
order, and don't care about grouping the captures by pattern.
2019-09-13 15:19:04 -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