-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Better (post-parser) errors #1058
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a33f77b
Add `generate_row_and_column` and `generate_error_info` public functi…
GuillaumeGomez e452b76
Create `askama_parser::WithSpan` type
GuillaumeGomez 368fd82
Wrap `Expr` into `WithSpan`
GuillaumeGomez a2c50d1
Update `Node` variants to use `WithSpan`
GuillaumeGomez e40056e
Add `Node::span` method
GuillaumeGomez c36eeb3
Update askama_parser AST tests
GuillaumeGomez e47b973
Update to new `WithSpan` type in `askama_derive`
GuillaumeGomez a2881bb
Add `askama_derive::FileInfo` type
GuillaumeGomez debd9af
Migrate config errors to new more complete `CompileError` version
GuillaumeGomez dbfa09e
Add `Context::generate_error` method
GuillaumeGomez 344b0ef
Migrate errors with file information
GuillaumeGomez 326b02e
Remove `From` trait implementations for `CompileError`
GuillaumeGomez a6613b6
Update ui tests
GuillaumeGomez 22d352b
Fix clippy lints
GuillaumeGomez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the direction is good, this still has too much going on. Suggest a few steps, maybe in a separate PR?
Ast::from_str()
into aParseError::new()
function{row}:{column}
for both path and non-path errorsErrorInfo
type with animpl Display
that takes care of the final formatting step, which will need to include apath: Option<Rc<Path>>
generate_row_and_column()
andgenerate_error_info()
later in the PR, they should perhaps be constructors onErrorInfo
.Also please keep functions in top-down order -- maybe do more self-review to check for style issues? Reviewing your changes is taking many round trips.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback is appreciated. I don't plan to send another PR for this, all changes are tied together and at this point your suggestions (even if great) are only improvements over this code. I'll implement what you suggested though.
Well, as you said, it's code styling, so we're entering personal preferences. I don't mind following a project code's style but if there is no test to enforce it and tell me what and where I did something wrong, then you shouldn't expect people to remember it or to implement it as such. Therefore, I don't plan to try to remember what style you want to apply until there is a check for it, I work on way too many different codebases to have motivation for this. If this is a blocker for you, then I'll just fork askama from this point and implement what I need on my side while backporting changes from your repository to mine. Just to be clear: this is not a hostile take or anything, I really love
askama
and really enjoy your suggestions. It's just that you have high expectations for PRs, and I don't have the tools nor the time to live up to your expectations. So I'll let it up to you. I don't mind if you send commits to my PRs to fix code formatting, this is very welcome as well.