-
Notifications
You must be signed in to change notification settings - Fork 60
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
Allow setting custom line numbers #157
Comments
Ahh wow! That is a pretty challenging use case? Any idea how we might be able to support this? |
It looks like for The only thing that needs to change is // blank
#line 1
int main() {}
#line 10
int f() {} the Let me know if that sounds doable. |
Oh forgot to mention: the API would look something like |
@Marwes would this help you out with macro support on Gluon? |
Wondering if we could have a pub trait Files {
⋮
/// The line number of the line at the given line index.
fn line_number(&self, id: Self::FileId, line_index: usize) -> Option<usize>;
⋮
} |
This is a bit of an edge case ... In C there is a
#line
macro that allows setting the current line number, it looks like this:Note how the error message says the error occurs on line 1, not line 4.
Currently, it looks like the lines in a file are calculated once and can't be modified. Would it be possible to make the line numbers configurable?
This has the unfortunate complication that there's no longer a 1-1 mapping between the line numbers displayed to the user and the lines in a file: in my example above, there are 2 lines with line number 1. However, this corresponds pretty closely to the current difference between
LineIndex
(internal) andLineNumber
(user-facing) so I don't forsee it being a giant deal.The text was updated successfully, but these errors were encountered: