Improved errors
This commit is contained in:
parent
b6ae67a610
commit
17d26c0d5a
2 changed files with 10 additions and 1 deletions
|
|
@ -83,7 +83,7 @@ impl<'a> From<tree_sitter_highlight::Error> for Error {
|
|||
|
||||
impl<'a> From<tree_sitter_tags::Error> for Error {
|
||||
fn from(error: tree_sitter_tags::Error) -> Self {
|
||||
Error::new(format!("{:?}", error))
|
||||
Error::new(format!("{}", error))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,15 @@ pub enum Error {
|
|||
InvalidCapture(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Error::InvalidCapture(name) => write!(f, "Invalid capture @{}. Expected one of: @definition.*, @reference.*, @doc, @name, @local.(scope|definition|reference).", name),
|
||||
_ => write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct PatternInfo {
|
||||
docs_adjacent_capture: Option<u32>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue