Adds a new option which allows to parenthesise call chains, import statements, string literals and binary expressions instead of using backslashes when splitting them to multiline by pressing Enter
Tests for PY-17193, PY-10709
Merge-request: IJ-MR-98747
Merged-by: Daniil Kalinin <Daniil.Kalinin@jetbrains.com>
GitOrigin-RevId: 964f6c997e1e106a3d1b82d24e46947cc83fb2c6
Namely, for their case clauses and inner comments.
Right now, each of them is indented on its own, as a separate formatting block.
It's still not entirely clear whether we should have a dedicated indented
container element for case clauses, similar to PyStatementList for statements.
It might simplify the formatter and some editing actions, but cause confusion
between the two container elements.
GitOrigin-RevId: 69184d2f8f78e2e113e8f40a310bb13ac0b5e71a
by properly implementing Block.isIncomplete() for collection literals,
comprehensions and parenthesized expressions instead of hand-written
search for the preceding expression lacking the closing bracket.
instead of using artificially built indentation. It also covers all
collection literals, comprehensions and glued string literals in
parentheses most of which were overlooked in the previous implementation.
Normally, it shouldn't happen, since Python lexer is supposed to put the
special STATEMENT_BREAK token right at the end of file, but apparently
it may not be the case during editing of an injected fragment.
Previously, they would get matched as '\ followed by \', and then,
two remaining quotes. Therefore the literal was considered unterminated
by the lexer. It, in turn, broke multiple assertions in
PyStringLiteralLexer because it used to find different string's end than
PythonHighlightingLexer and rendered the whole editor unresponsive.
To do so I search for the line inside a docstring that starts with
either "def " or "class " and has indentation less than that of opening
docstring quotes.