-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[core] Add Rewrite Events #871
Conversation
- Update Node interface - Add insert method to insert new children in certain indexes - Add replace method to replace current children with new ones in certain indexes - Rename removeChildAtIndex method to remove with an index parameter - Fix test cases to match the new convention - Implement insert & replace methods in AbstractNode - Add test cases for the new features - Leave some TODOs related to the autofix flow - NodeEvents will be implemented soon; that's why these TODOs were left in the code
- Add main classes to support Rewrite Events - Update AbstractNode to record rewrite events over children nodes - Add test cases for implemented functionality - Fix test cases - It would be nice to disable the `haveChildrenChanged` property in xpath. This would allow to leave test cases as they were, but I actually don't know how to achieve this. So, for the momment, I've added this new field to the test cases
@@ -32,7 +32,7 @@ public void testAttributeAxisIterator() { | |||
Attribute attribute = it.next(); | |||
atts.put(attribute.getName(), attribute); | |||
} | |||
Assert.assertEquals(7, atts.size()); | |||
Assert.assertEquals(8, atts.size()); |
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.
It would be nice to disable the haveChildrenChanged
property in xpath.
@@ -28,6 +28,7 @@ public void testCopyXmlToClipboard() { | |||
String xml = Designer.getXmlTreeCode(compilationUnit); | |||
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | |||
+ "<dummyNode BeginColumn=\"1\" BeginLine=\"1\" EndColumn=\"0\" EndLine=\"0\" FindBoundary=\"false\"\n" | |||
+ " Image=\"Foo\"\n" + " SingleLine=\"false\"/>", xml); | |||
+ " Image=\"Foo\"\n" + " SingleLine=\"false\"\n" | |||
+ " haveChildrenChanged=\"false\"/>", xml); |
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.
It would be nice to disable the haveChildrenChanged
property in xpath.
* </p> | ||
* <p> | ||
* Rewrite events occurring on the same index are merged straight away, so at all moment only one rewrite event | ||
* is hold for a given index. This helps to understand exactly what kind of change has the node suffer, |
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.
Change suffer to suffered
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.
I'd add that "hold" should be "held"
Thanks for yet another PR. I've briefly reviewed this changeset, but I have two problems with it.
|
We are closing this as it has been deprecated in favor of a new autofixes approach. See #693. |
Depends on #858 ==> Start review from commit 41c3684
PR Description
Implements: #693: Generate & identify events over AST nodes
List of changes
haveChildrenChanged
property in xpath. This would allow to leave test cases as they were, but I actually don't know how to achieve this. So, for the moment, I've added this new field to the test cases.