LU XIANGRUI та wildcatDownstairs
e5f078913c
feat(python): add Rearrange Code for Python classes ( #5392 )
...
There was no Rearrange Code for any language. **Rearrange Code** (Code menu, Find Action, IdeaVim's `RearrangeCode`) now orders the methods of every Python class in the file, nested ones included, as one undo step: `__new__` / `__init__` / `__post_init__`, other dunder methods, public, `_protected`, then `__private` methods, each group in its original order. The docstring and class attributes before the first method stay put; a method moves with its decorators and the comment lines directly above it; definitions sharing a name (a property and its setter, `@overload` stubs) move together in their order. Blank lines between methods stay where they were.
A class is left unchanged when moving could change it: other statements among its methods (`alias = method`, a nested class), standalone comments or `# region` / `# fmt: off` markers among them, or a decorator, default value or annotation that names another of its methods (`@_retry`, `@_visit.register`, `cb=_default`). Files with syntax errors are not rearranged.
The order is computed from one tree-sitter parse in `ide-language` (`Syntax::rearranged`); comments come from the syntax tree, so a `#` line inside a string is not taken for one. A language-neutral `doc_rearrange` command returns UTF-16 edits, so other languages can add an arrangement later. Backend errors are reported like formatting errors. There is no settings page yet.
Co-authored-by: wildcatDownstairs <[email protected] >
2026-11-24 05:07:03 +08:00
..
2026-11-11 21:23:38 +08:00
2026-11-22 21:57:30 +08:00
2026-11-24 05:07:03 +08:00
2026-11-18 09:10:40 +08:00
2026-11-18 19:27:54 +08:00
2026-11-13 13:46:25 +08:00
2026-11-19 08:36:35 +08:00
2026-11-20 19:36:19 +08:00
2026-11-23 22:32:58 +08:00
2026-11-23 22:32:58 +08:00
2026-11-18 21:25:58 +08:00
2026-11-09 17:05:20 +08:00
2026-11-20 13:45:47 +08:00
2026-11-04 01:09:07 +08:00
2026-11-19 17:07:13 +08:00
2026-11-19 17:07:13 +08:00
2026-11-01 12:23:08 +08:00
2026-11-01 12:23:08 +08:00
2026-11-23 23:22:47 +08:00
2026-11-01 15:04:28 +08:00
2026-11-01 15:04:28 +08:00
2026-11-22 21:57:30 +08:00
2026-11-18 09:20:09 +08:00
2026-11-18 09:20:09 +08:00
2026-11-13 22:29:59 +08:00
2026-11-01 19:02:00 +08:00
2026-11-22 00:07:39 +08:00
2026-11-22 00:37:11 +08:00
2026-11-06 14:24:59 +08:00
2026-11-06 14:24:59 +08:00
2026-11-12 22:50:59 +08:00
2026-11-12 22:50:59 +08:00
2026-11-17 04:09:12 +08:00
2026-11-19 21:40:05 +08:00
2026-11-06 23:02:34 +08:00
2026-11-06 23:02:34 +08:00
2026-11-08 06:13:21 +08:00
2026-11-08 06:13:21 +08:00
2026-11-12 22:42:10 +08:00
2026-11-12 22:42:10 +08:00
2026-11-14 00:52:49 +08:00
2026-11-14 00:52:49 +08:00
2026-11-12 03:27:33 +08:00
2026-11-23 23:22:47 +08:00
2026-11-23 23:22:47 +08:00
2026-11-11 19:30:15 +08:00
2026-11-15 04:32:12 +08:00
2026-11-09 17:17:27 +08:00
2026-11-10 06:48:36 +08:00
2026-11-09 17:17:27 +08:00
2026-11-03 22:34:29 +08:00
2026-11-03 22:34:29 +08:00
2026-11-20 22:10:02 +08:00
2026-11-20 22:10:02 +08:00
2026-11-22 00:37:11 +08:00
2026-11-04 06:51:41 +08:00
2026-11-04 06:51:41 +08:00
2026-11-16 09:36:14 +08:00
2026-11-12 02:38:45 +08:00
2026-11-12 02:38:45 +08:00
2026-11-18 23:38:57 +08:00
2026-11-14 01:17:26 +08:00
2026-11-18 16:14:32 +08:00
2026-11-16 23:50:42 +08:00
2026-11-23 20:40:44 +08:00
2026-11-05 23:09:55 +08:00
2026-11-05 23:09:55 +08:00
2026-11-19 22:42:00 +08:00
2026-11-19 22:42:00 +08:00
2026-11-22 15:33:47 +08:00
2026-11-22 15:14:54 +08:00
2026-11-22 00:37:11 +08:00
2026-11-22 00:37:11 +08:00
2026-11-20 16:26:23 +08:00
2026-11-04 14:22:38 +08:00
2026-11-24 05:07:03 +08:00
2026-11-23 23:58:16 +08:00
2026-11-23 23:58:16 +08:00
2026-11-20 09:13:29 +08:00
2026-11-20 09:13:29 +08:00
2026-11-10 03:14:20 +08:00
2026-11-10 03:14:20 +08:00
2026-11-05 21:50:06 +08:00
2026-11-22 15:14:54 +08:00
2026-11-05 21:50:06 +08:00
2026-11-22 14:43:09 +08:00
2026-11-20 05:41:29 +08:00
2026-11-23 23:22:47 +08:00
2026-11-17 03:20:18 +08:00
2026-11-23 22:01:15 +08:00
2026-10-27 12:09:51 +08:00
2026-10-27 18:56:54 +08:00
2026-11-17 23:22:56 +08:00
2026-11-23 23:58:16 +08:00
2026-11-23 23:58:16 +08:00
2026-11-04 02:54:31 +08:00
2026-11-24 01:34:36 +08:00
2026-11-08 00:05:41 +08:00
2026-11-12 02:09:24 +08:00
2026-11-12 02:09:24 +08:00
2026-11-12 02:09:24 +08:00
2026-11-16 03:32:43 +08:00
2026-11-14 10:28:39 +08:00
2026-11-14 10:28:39 +08:00
2026-11-19 23:07:13 +08:00
2026-11-20 02:49:08 +08:00
2026-11-01 00:14:56 +08:00
2026-11-01 00:14:56 +08:00
2026-11-12 02:09:24 +08:00
2026-11-12 02:09:24 +08:00
2026-11-21 19:33:15 +08:00
2026-11-21 19:33:15 +08:00
2026-11-08 01:16:31 +08:00
2026-11-08 01:16:31 +08:00
2026-11-11 22:18:48 +08:00
2026-11-11 22:18:48 +08:00
2026-11-23 22:24:23 +08:00
2026-11-23 22:24:23 +08:00
2026-11-09 08:40:40 +08:00
2026-11-04 20:44:19 +08:00
2026-11-04 20:44:19 +08:00
2026-11-09 19:23:05 +08:00
2026-11-16 18:37:29 +08:00
2026-11-05 11:23:39 +08:00
2026-11-05 11:23:39 +08:00
2026-10-31 20:58:45 +08:00
2026-11-22 00:13:04 +08:00
2026-11-01 16:58:49 +08:00
2026-10-29 10:43:30 +08:00
2026-10-29 10:43:30 +08:00
2026-11-16 09:34:42 +08:00
2026-11-16 09:34:42 +08:00
2026-11-23 22:24:23 +08:00
2026-11-23 22:24:23 +08:00
2026-11-20 10:12:35 +08:00
2026-11-13 19:18:33 +08:00
2026-11-05 13:33:35 +08:00
2026-11-05 13:33:35 +08:00
2026-11-09 08:40:40 +08:00
2026-11-16 09:36:14 +08:00
2026-11-16 09:36:14 +08:00
2026-11-23 22:24:23 +08:00
2026-11-23 22:24:23 +08:00
2026-11-08 00:21:42 +08:00
2026-11-18 21:25:58 +08:00
2026-11-18 21:25:58 +08:00
2026-11-17 09:33:49 +08:00
2026-11-18 09:10:40 +08:00
2026-11-07 10:56:59 +08:00
2026-11-05 21:38:12 +08:00
2026-11-12 22:42:10 +08:00
2026-11-12 22:42:10 +08:00
2026-11-04 02:54:31 +08:00
2026-11-22 21:57:30 +08:00
2026-11-22 21:57:30 +08:00
2026-11-21 12:25:12 +08:00
2026-11-23 21:13:35 +08:00
2026-11-23 21:13:35 +08:00
2026-11-22 05:23:22 +08:00
2026-11-22 05:23:22 +08:00
2026-10-29 15:01:01 +08:00
2026-11-17 21:15:20 +08:00
2026-11-17 21:15:20 +08:00
2026-10-30 22:45:42 +08:00
2026-10-30 22:45:42 +08:00
2026-11-22 21:57:30 +08:00
2026-11-22 21:57:30 +08:00
2026-10-31 22:38:16 +08:00