0.5.0
0.5.0
Note: With this release, we also started improving our documentation. If you are interested in Refactor, check the new layout and tutorials out and let us know how you feel!
Major
This release includes the overhaul of our action system, and with the next releases we will start removing the old ones. A list
of changes regarding actions can be seen here:
refactor.coreno longer contains any actions (the deprecated aliases are still imported and exposed but all the new actions go intorefactor.actions)Actionis now split into two, arefactor.actions.BaseActionwhich is the base of all actions (useful for type hinting) and arefactor.actions.LazyReplace(a replace action that builds the node lazily in itsbuild()).ReplacementActionis nowrefactor.actions.ReplaceNewStatementActionis nowrefactor.actions.LazyInsertAfterTargetedNewStatementActionis nowrefactor.actions.InsertAfter
For migrating your code base to the new style actions, we wrote a small tool (that we also used internally), examples/deprecated_aliases.py. Feel free to try it, and let us know if the transition was seamless.
Other Changes
- Added experimental Windows support, contributed by Hakan Celik
common.find_closestnow takesend_linenoandend_col_offsetinto account. It also ensures there is at least one target node.- Added
debug_modesetting torefactor.context.Configuration. - Added a command-line flag (
-d/--enable-debug-mode) to the default CLI runner to change session's configuration. - When unparsable source code is generated, the contents can be now seen if the debug mode is enabled.
- [Experimental] Added ability to partially recover floating comments (from preceding or succeeding lines) bound to statements.
- The context providers now can be accessed with attribute notation, e.g.
self.context.scopeinstead ofself.context.metadata["scope]. - If you access a built-in context provider (scope/ancestry) and it is not already imported, we auto-import it. So most common context providers are now ready to be used.
- Added
common.next_statement_of.