mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-29 20:11:13 +01:00
6ae83b4740
Closes #36491 This issue is caused by the Python language configuration treating compound statements (such as for loops and if statements) that end with an inline comment as not requiring an increased indent. Release Notes: - python: Correctly indent lines starting the blocks (for, finally, if, else, try) that have trailing comments.
38 lines
2.3 KiB
TOML
38 lines
2.3 KiB
TOML
name = "Python"
|
|
grammar = "python"
|
|
path_suffixes = ["py", "pyi", "mpy"]
|
|
first_line_pattern = '^#!.*\bpython[0-9.]*\b'
|
|
line_comments = ["# "]
|
|
autoclose_before = ";:.,=}])>"
|
|
brackets = [
|
|
{ start = "f\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "f'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "b\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "b'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "u\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "u'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "r\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "r'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "rb\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "rb'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "t\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "t'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
|
{ start = "\"\"\"", end = "\"\"\"", close = true, newline = false, not_in = ["string"] },
|
|
{ start = "'''", end = "'''", close = true, newline = false, not_in = ["string"] },
|
|
{ start = "{", end = "}", close = true, newline = true },
|
|
{ start = "[", end = "]", close = true, newline = true },
|
|
{ start = "(", end = ")", close = true, newline = true },
|
|
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
|
|
{ start = "'", end = "'", close = true, newline = false, not_in = ["string"] },
|
|
]
|
|
|
|
auto_indent_using_last_non_empty_line = false
|
|
debuggers = ["Debugpy"]
|
|
increase_indent_pattern = "^[^#].*:\\s*(#.*)?$"
|
|
decrease_indent_patterns = [
|
|
{ pattern = "^\\s*elif\\b.*:\\s*(#.*)?", valid_after = ["if", "elif"] },
|
|
{ pattern = "^\\s*else\\b.*:\\s*(#.*)?", valid_after = ["if", "elif", "for", "while", "except"] },
|
|
{ pattern = "^\\s*except\\b.*:\\s*(#.*)?", valid_after = ["try", "except"] },
|
|
{ pattern = "^\\s*finally\\b.*:\\s*(#.*)?", valid_after = ["try", "except", "else"] },
|
|
]
|