Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is possible to only pass a small section of the whole source? #28

Open
mamcx opened this issue Feb 20, 2022 · 3 comments
Open

Is possible to only pass a small section of the whole source? #28

mamcx opened this issue Feb 20, 2022 · 3 comments

Comments

@mamcx
Copy link

mamcx commented Feb 20, 2022

I collect elsewhere the source in a vector of spans:

pub struct Source<'input> {
    pub tokens: &'input [Token<'input>],
    cursor: usize,
}

But for show the error I need to "materialize" all the code into Strings. I wish it were possible to only pass the relevant lines:

    let mut source =  Source::from( get from line 10 -> 20);
    source.line_start = 10;

    err.finish().print(("sample.tao",source))
@zesterer
Copy link
Owner

zesterer commented Jul 4, 2022

This is unlikely to be supported given that there's no good way to determine ahead of time which parts of the original source ariadne will require to generate the diagnostic.

@mamcx
Copy link
Author

mamcx commented Jul 17, 2022

How much different to look at this as a small snippet of source? I imagine only need to add the starting line so do not assume is the first?

@zesterer
Copy link
Owner

The report may require extra context, and the extent of that context isn't something that's desirable to expose to the API user, so this is unlikely to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants