-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Debug mode #74
Comments
Yeah, I also find it quite hard to debug interactions between the rules. Though, I am not sure if just somehow showing matching rules would help: it seems like it would produce way to much information to be useful. At the moment, I just comment out some rules to minimize the example. I imagine that could be automated: formatting could print a series of diffs, starting with "zero rules applied", and ending with "all rules applied". Still not sure if that would be more effective than just manually commenting out specifc things |
The difference would mainly be that as a user it would be possible to understand what is going on without toughing the code (assuming that the output is helpful). I think rules would also have to have names attached to them so they could be distinguished one from another. Brainstorming a bit more, another approach might be to attach some assertions onto a node, asserting that rule X is going to be applied to it. |
79: implement new version of indentation DLS r=matklad a=matklad I've looked how Kotlin handles this and I liked the approach: https://github.com/JetBrains/kotlin/blob/7d173ed3856e429739b55d8c3892e1b85ca41571/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt#L682-L690 The main trick they use is negative rules: "indent all children except X". They nicely handle comments and in general simplify things a bit. I've also added names to rules to as a step towards future debug mode, as well as an ability to specify simple tests in-line, which should help with long-term rule maintainability. closes #71, #65 prerequisite of #74 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This is implemented as |
It would be cool if the engine could should all the matching rules with the diff. The more rule we add, the harder it becomes to understand how they interact with each-other.
Example output:
What do you think @matklad ?
The text was updated successfully, but these errors were encountered: