diff --git a/python/python-psi-impl/src/com/jetbrains/python/editor/PyEditorHandlerConfig.java b/python/python-psi-impl/src/com/jetbrains/python/editor/PyEditorHandlerConfig.java index 063deaf005a2..54412c4a71c9 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/editor/PyEditorHandlerConfig.java +++ b/python/python-psi-impl/src/com/jetbrains/python/editor/PyEditorHandlerConfig.java @@ -15,7 +15,11 @@ public final class PyEditorHandlerConfig { PyDictLiteralExpression.class, PyParenthesizedExpression.class, PyArgumentList.class, - PyParameterList.class + PyParameterList.class, + PyGroupPattern.class, + PySequencePattern.class, + PyMappingPattern.class, + PyPatternArgumentList.class, }; static final Class[] WRAPPABLE_CLASSES = new Class[]{ PsiComment.class, @@ -31,6 +35,10 @@ public final class PyEditorHandlerConfig { PyDecoratorList.class, PySliceExpression.class, PySubscriptionExpression.class, - PyGeneratorExpression.class + PyGeneratorExpression.class, + PyGroupPattern.class, + PySequencePattern.class, + PyMappingPattern.class, + PyPatternArgumentList.class, }; } diff --git a/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.after.py b/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.after.py new file mode 100644 index 000000000000..c796965e9c10 --- /dev/null +++ b/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.after.py @@ -0,0 +1,4 @@ +match x: + case 'foo' \ + 'bar': + pass \ No newline at end of file diff --git a/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.py b/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.py new file mode 100644 index 000000000000..6a13036d0158 --- /dev/null +++ b/python/testData/editing/backslashOnEnterInTopLevelStringLiteralPattern.py @@ -0,0 +1,3 @@ +match x: + case 'foobar': + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInClassPattern.after.py b/python/testData/editing/noBackslashOnEnterInClassPattern.after.py new file mode 100644 index 000000000000..57c5aea0e53d --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInClassPattern.after.py @@ -0,0 +1,5 @@ +match x: + case Class( + + ): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInClassPattern.py b/python/testData/editing/noBackslashOnEnterInClassPattern.py new file mode 100644 index 000000000000..7471ac13c0b2 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInClassPattern.py @@ -0,0 +1,3 @@ +match x: + case Class(): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInGroupPattern.after.py b/python/testData/editing/noBackslashOnEnterInGroupPattern.after.py new file mode 100644 index 000000000000..b75f2589205b --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInGroupPattern.after.py @@ -0,0 +1,4 @@ +match x: + case (42 + ): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInGroupPattern.py b/python/testData/editing/noBackslashOnEnterInGroupPattern.py new file mode 100644 index 000000000000..ddfae696d54c --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInGroupPattern.py @@ -0,0 +1,3 @@ +match x: + case (42): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInMappingPattern.after.py b/python/testData/editing/noBackslashOnEnterInMappingPattern.after.py new file mode 100644 index 000000000000..60d829fb4c1c --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInMappingPattern.after.py @@ -0,0 +1,4 @@ +match x: + case {'foo': 1, + 'bar': 2} + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInMappingPattern.py b/python/testData/editing/noBackslashOnEnterInMappingPattern.py new file mode 100644 index 000000000000..2854d7d97413 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInMappingPattern.py @@ -0,0 +1,3 @@ +match x: + case {'foo': 1, 'bar': 2} + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInSequencePattern.after.py b/python/testData/editing/noBackslashOnEnterInSequencePattern.after.py new file mode 100644 index 000000000000..57d334128a0b --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInSequencePattern.after.py @@ -0,0 +1,4 @@ +match x: + case [1, + 2]: + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInSequencePattern.py b/python/testData/editing/noBackslashOnEnterInSequencePattern.py new file mode 100644 index 000000000000..626ffb36fd64 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInSequencePattern.py @@ -0,0 +1,3 @@ +match x: + case [1, 2]: + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.after.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.after.py new file mode 100644 index 000000000000..b2f21df5b8ce --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.after.py @@ -0,0 +1,4 @@ +match x: + case Class('foo' + 'bar'): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.py new file mode 100644 index 000000000000..39d090e41cda --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideClassPattern.py @@ -0,0 +1,3 @@ +match x: + case Class('foobar'): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.after.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.after.py new file mode 100644 index 000000000000..781e64128678 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.after.py @@ -0,0 +1,4 @@ +match x: + case ('foo' + 'bar'): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.py new file mode 100644 index 000000000000..2442b37400dd --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideGroupPattern.py @@ -0,0 +1,3 @@ +match x: + case ('foobar'): + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.after.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.after.py new file mode 100644 index 000000000000..00403dc816ee --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.after.py @@ -0,0 +1,4 @@ +match x: + case {'foo' + 'bar': 1}: + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.py new file mode 100644 index 000000000000..d598b21b0ee4 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideMappingPattern.py @@ -0,0 +1,3 @@ +match x: + case {'foobar': 1}: + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.after.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.after.py new file mode 100644 index 000000000000..6ecf34147ea6 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.after.py @@ -0,0 +1,4 @@ +match x: + case ['foo' + 'bar']: + pass \ No newline at end of file diff --git a/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.py b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.py new file mode 100644 index 000000000000..7eb2c4e35752 --- /dev/null +++ b/python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.py @@ -0,0 +1,3 @@ +match x: + case ['foobar']: + pass \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyEditingTest.java b/python/testSrc/com/jetbrains/python/PyEditingTest.java index 304f44344757..6c7c4afde035 100644 --- a/python/testSrc/com/jetbrains/python/PyEditingTest.java +++ b/python/testSrc/com/jetbrains/python/PyEditingTest.java @@ -852,6 +852,51 @@ public class PyEditingTest extends PyTestCase { doTypingTest('\n'); } + // PY-49080 + public void testNoBackslashOnEnterInGroupPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInClassPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInSequencePattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInMappingPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInStringLiteralInsideGroupPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInStringLiteralInsideClassPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInStringLiteralInsideSequencePattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testNoBackslashOnEnterInStringLiteralInsideMappingPattern() { + doTypingTest('\n'); + } + + // PY-49080 + public void testBackslashOnEnterInTopLevelStringLiteralPattern() { + doTypingTest('\n'); + } + @NotNull private PyCodeStyleSettings getPythonCodeStyleSettings() { return getCodeStyleSettings().getCustomSettings(PyCodeStyleSettings.class);