Commit Graph

29 Commits

Author SHA1 Message Date
Daniil Kalinin
2983980cbd PY-17193, PY-10709 enable Use parentheses instead of backslashes for breaking lines option by default
Change tests according to the new default value

GitOrigin-RevId: 79a09911127532fadcc4a4d37a454887d46effa9
2023-07-07 13:26:55 +00:00
Daniil Kalinin
d5de282edd PY-17193, PY-10709 Don't use \ for line continuation by default
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
2023-06-14 19:11:31 +00:00
Mikhail Golubev
ccf574bad9 PY-48009 Support formatting of PEP-634 match statements
GitOrigin-RevId: d4755af5ca19efef70db6c4a043135182bc0da04
2021-07-20 08:46:15 +00:00
Mikhail Golubev
9247e2eb84 PY-49080 Don't add backslashes to line breaks in patterns containing brackets
GitOrigin-RevId: 43d718f9e470355d92c7bd518fee5991185703f1
2021-06-17 20:08:02 +00:00
Mikhail Golubev
98d196aec6 PY-48009 Add automatic indent inside match statements
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
2021-05-24 10:28:35 +00:00
Mikhail Golubev
dbf49edb14 PY-10972 Recursively detect the alignment owner for the new block on enter
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.
2018-04-04 19:29:49 +03:00
Mikhail Golubev
0e9810168a PY-10972 Properly align elements of expressions without closing bracket on enter
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.
2018-04-03 18:45:43 +03:00
Mikhail Golubev
f26af18f70 PY-27178 Parenthesised expression parsing doesn't hang at the end of file
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.
2017-11-30 19:49:29 +03:00
Mikhail Golubev
b70a2112cc PY-15240 Surround "self" with spaces if code style settings require it 2017-10-02 13:58:42 +03:00
Mikhail Golubev
609bcefea3 PY-21269 PY-21289 Add test cases for two related issues fixed by PY-26131 2017-10-02 13:58:42 +03:00
Mikhail Golubev
ead37e8492 PY-21697 Handle sequences like '\\''' in multiline strings in Python lexer
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.
2016-12-20 12:53:10 +03:00
Mikhail Golubev
6809e81440 PY-18486 Don't auto close quotes that start docstring, so PythonEnterHandler could complete it 2016-03-29 17:13:10 +03:00
Valentina Kiryushkina
b6566572f7 PY-1779 Add autoclosing for triple quotes 2015-12-09 20:22:33 +03:00
Mikhail Golubev
cef43b47f6 PY-15332 Omit tags and sections for return values in docstrings for __init__ method 2015-12-04 16:03:31 +03:00
Mikhail Golubev
40733b0fd4 PY-17183 Heuristically determine when incomplete docstring captures another declaration
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.
2015-10-25 15:49:43 +03:00
Mikhail Golubev
a955f6c927 PY-16765 For sections inside Google code style docstring use indentation configured for Python
PyFunctionBuilder and PyDocstringGenerator require a PSI element to
use proper formatting and style for generated docstring.
2015-09-23 18:42:17 +03:00
Mikhail Golubev
d0b7dee163 PY-16765 Automatically add indentation after section header in Google code style docstrings 2015-09-07 20:01:05 +03:00
Mikhail Golubev
4653df951e PY-16828 Insert docstring stub on enter even if opening quotes have e.g. unicode prefix
Also I removed PythonDocCommentUtil and moved its only method to PythonEnterHandler
2015-09-07 16:07:25 +03:00
Mikhail Golubev
4bae7ca3c3 PY-16656 Add test cases. Issue was fixed when enter and space handlers started to use PyDocstringGenerator 2015-09-02 14:35:42 +03:00
Mikhail Golubev
865be5f5ca Add missing tests for insertion of docstring stubs on typing enter or space 2015-09-02 14:35:05 +03:00
Dennis Ushakov
8f2e8395b8 crlf 2011-01-17 15:49:46 +03:00
Dmitry Jemerov
838a58f733 avoid inserting duplicate colon when adding 'self' (PY-2652) 2011-01-14 19:34:46 +01:00
Dmitry Cheryasov
b04729ef36 PY-1767: auto-add a correct first parameter to a method + tests. 2010-11-30 18:37:10 +02:00
Dmitry Jemerov
1f1dc55588 missed testdata 2010-07-15 18:57:21 +04:00
Dmitry Jemerov
c2d6646138 Python backspace unindent works correctly when tabs are used (PY-1270) 2010-07-15 18:57:20 +04:00
Dmitry Jemerov
ee323fe9d3 if line comment prefix is followed by a single space, uncomment line action deletes that space (PY-980) 2010-05-13 22:37:58 +04:00
Oleg Shpynov
1ea77268f3 PY-853
Back space action should respect indentation settings in non empty lines
2010-04-19 13:24:34 +04:00
Dmitry Cheryasov
351fd7c91d Test for auto-unindent of 'else' and freinds. Only typing (no completion). 2010-03-06 07:14:18 +02:00
Dmitry Jemerov
94a6f92037 missing testdata file 2010-01-27 22:35:54 +03:00