mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-32918 Handle enter in f-string right before the closing quote
in the context where we don't need to insert additional backslashes.
This commit is contained in:
@@ -135,7 +135,8 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter {
|
||||
if (stringElement != null && (!stringElement.isFormatted() ||
|
||||
nodeType == PyTokenTypes.FSTRING_TEXT ||
|
||||
// Caret should be right before the opening brace of an f-string fragment
|
||||
nodeType == PyTokenTypes.FSTRING_FRAGMENT_START)) {
|
||||
nodeType == PyTokenTypes.FSTRING_FRAGMENT_START ||
|
||||
nodeType == PyTokenTypes.FSTRING_END)) {
|
||||
if (stringElement.isTripleQuoted() || nodeType == PyTokenTypes.DOCSTRING) {
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,12 @@ public class PyEditingTest extends PyTestCase {
|
||||
" f'{42}bar'");
|
||||
}
|
||||
|
||||
// PY-32918
|
||||
public void testEnterInFStringRightBeforeClosingQuote() {
|
||||
doTestEnter("(f'foo{42}bar<caret>')", "(f'foo{42}bar'\n" +
|
||||
" f'')");
|
||||
}
|
||||
|
||||
public void testOvertypeFromInside() {
|
||||
assertEquals("''", doTestTyping("''", 1, '\''));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user