Smit Barmase
d09c7eb317
language: Add context-aware decrease indent for Python ( #33370 )
...
Closes #33238 , follow-up to
https://github.com/zed-industries/zed/pull/29625 .
Changes:
- Removed `significant_indentation`, which was the way to introduce
indentation scoping in languages like Python. However, it turned out to
be unnecessarily complicated to define and maintain.
- Introduced `decrease_indent_patterns`, which takes a `pattern` keyword
to automatically outdent and `valid_after` keywords to treat as valid
code points to snap to. The outdent happens to the most recent
`valid_after` keyword that also has less or equal indentation than the
currently typed keyword.
Fixes:
1. In Python, typing `except`, `finally`, `else`, and so on now
automatically indents intelligently based on the context in which it
appears. For instance:
```py
try:
if a == 1:
try:
b = 2
^ # <-- typing "except:" here would indent it to inner try block
```
but,
```py
try:
if a == 1:
try:
b = 2
^ # <-- typing "except:" here would indent it to outer try block
```
2. Fixes comments not maintaining indent.
Release Notes:
- Improved auto outdent for Python while typing keywords like `except`,
`else`, `finally`, etc.
- Fixed the issue where comments in Python would not maintain their
indentation.
2025-06-26 11:11:03 +05:30
..
2025-06-25 19:57:28 +03:00
2025-06-25 14:10:48 -04:00
2025-06-25 19:05:29 +02:00
2025-06-25 22:48:40 +00:00
2025-06-23 18:48:26 +00:00
2025-06-17 14:39:45 +00:00
2025-05-20 23:06:07 +00:00
2025-06-25 13:26:24 -04:00
2025-05-21 09:27:54 +00:00
2025-06-18 16:01:28 +05:30
2025-06-16 18:45:24 +03:00
2025-06-25 19:05:29 +02:00
2025-05-26 21:20:41 -03:00
2025-06-13 13:11:02 -04:00
2025-05-20 23:06:07 +00:00
2025-06-25 17:28:06 +00:00
2025-06-25 17:15:13 +03:00
2025-05-30 08:32:54 -07:00
2025-06-18 14:43:23 +00:00
2025-05-26 23:04:31 -04:00
2025-06-24 05:14:15 +00:00
2025-06-22 16:23:17 -04:00
2025-06-22 16:23:17 -04:00
2025-06-25 16:06:14 -04:00
2025-06-24 16:11:25 +00:00
2025-06-18 16:01:28 +05:30
2025-06-05 12:59:22 +00:00
2025-06-21 11:19:23 -04:00
2025-06-19 17:37:58 +03:00
2025-06-24 18:24:43 +00:00
2025-06-24 18:24:43 +00:00
2025-06-15 19:51:04 +00:00
2025-06-23 17:06:48 +00:00
2025-06-13 20:56:23 +00:00
2025-06-25 19:54:08 +05:30
2025-06-25 09:42:30 +02:00
2025-06-17 13:46:21 +00:00
2025-06-24 04:34:51 +00:00
2025-06-26 11:11:03 +05:30
2025-06-25 19:05:29 +02:00
2025-06-21 11:19:23 -04:00
2025-06-18 14:05:29 +00:00
2025-06-17 12:09:08 +02:00
2025-06-25 19:57:28 +03:00
2025-06-18 22:52:40 +00:00
2025-06-17 13:56:19 -06:00
2025-06-22 16:23:17 -04:00
2025-06-25 19:17:41 +03:00
2025-06-22 16:23:17 -04:00
2025-06-18 16:01:28 +05:30
2025-06-24 04:34:51 +00:00
2025-06-03 12:23:01 -04:00
2025-06-25 22:29:30 +00:00
2025-06-03 09:41:45 +02:00
2025-06-17 20:26:27 +00:00
2025-06-25 17:11:59 -06:00
2025-06-24 04:34:51 +00:00
2025-05-20 23:06:07 +00:00
2025-06-24 11:02:06 -03:00
2025-06-03 13:18:29 +02:00
2025-06-18 16:01:28 +05:30
2025-06-20 21:28:48 +00:00
2025-05-27 21:52:42 +00:00
2025-06-06 20:54:00 +00:00
2025-05-20 23:06:07 +00:00
2025-05-17 16:42:45 +00:00
2025-06-18 16:01:28 +05:30
2025-06-26 11:11:03 +05:30
2025-06-25 19:57:28 +03:00
2025-06-24 16:23:59 +00:00
2025-06-25 19:05:29 +02:00
2025-06-18 16:01:28 +05:30
2025-06-25 16:24:51 -06:00
2025-06-26 11:11:03 +05:30
2025-05-20 23:06:07 +00:00
2025-06-25 21:00:33 -04:00
2025-06-17 10:43:07 -04:00
2025-06-25 19:57:28 +03:00
2025-06-09 13:11:57 +02:00
2025-06-25 16:43:00 +00:00
2025-05-20 23:06:07 +00:00
2025-06-25 19:05:29 +02:00
2025-06-17 10:43:07 -04:00
2025-06-24 23:18:35 -06:00
2025-06-06 16:00:09 +00:00
2025-06-23 19:55:21 -03:00
2025-06-17 10:43:07 -04:00
2025-06-25 09:42:30 +02:00
2025-06-21 08:03:50 +02:00
2025-05-26 23:04:31 -04:00
2025-06-18 22:36:00 +00:00
2025-06-14 21:39:54 -06:00
2025-06-25 19:57:28 +03:00
2025-06-13 07:26:06 +00:00
2025-06-25 19:57:28 +03:00
2025-06-24 04:34:51 +00:00
2025-06-18 16:01:28 +05:30
2025-06-18 16:01:28 +05:30
2025-06-25 19:57:28 +03:00
2025-06-18 16:01:28 +05:30
2025-05-26 17:43:57 +00:00
2025-05-23 14:53:53 +00:00
2025-06-25 16:49:37 +00:00
2025-06-25 19:57:28 +03:00
2025-06-24 10:15:20 +03:00
2025-05-20 23:06:07 +00:00
2025-06-09 13:11:57 +02:00
2025-06-17 12:09:08 +02:00
2025-06-19 18:23:09 +05:30
2025-06-24 04:34:51 +00:00
2025-06-13 06:32:29 +00:00
2025-05-20 23:06:07 +00:00
2025-06-24 16:07:45 +00:00
2025-06-24 04:34:51 +00:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-06-18 16:01:28 +05:30
2025-05-20 23:06:07 +00:00
2025-05-16 17:35:44 +02:00
2025-06-24 16:07:45 +00:00
2025-06-09 13:11:57 +02:00
2025-06-17 14:39:45 +00:00
2025-06-24 04:34:51 +00:00
2025-06-18 22:47:48 +00:00
2025-06-19 02:27:34 -03:00
2025-06-25 19:51:33 +05:30
2025-06-24 04:34:51 +00:00
2025-06-09 13:11:57 +02:00
2025-06-23 20:53:55 -03:00
2025-05-26 18:23:41 +00:00
2025-06-18 16:01:28 +05:30
2025-06-24 04:34:51 +00:00
2025-06-18 16:01:28 +05:30
2025-06-24 04:34:51 +00:00
2025-06-18 18:47:43 -03:00
2025-05-23 19:31:25 +00:00
2025-05-30 15:26:27 +00:00
2025-06-21 11:19:23 -04:00
2025-06-13 06:32:29 +00:00
2025-06-25 13:26:41 +00:00
2025-06-24 15:20:14 -06:00
2025-06-18 21:26:12 +00:00
2025-06-09 13:11:57 +02:00
2025-05-20 23:06:07 +00:00
2025-06-18 16:01:28 +05:30
2025-06-25 19:52:15 +00:00
2025-06-09 13:11:57 +02:00
2025-06-25 19:05:29 +02:00
2025-06-24 04:34:51 +00:00
2025-06-20 21:28:48 +00:00
2025-06-06 00:49:30 -06:00