mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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.
This commit is contained in:
@@ -305,7 +305,8 @@ public class ExpressionParsing extends Parsing {
|
||||
else {
|
||||
final PsiBuilder.Marker err = myBuilder.mark();
|
||||
boolean empty = true;
|
||||
while (myBuilder.getTokenType() != PyTokenTypes.RPAR &&
|
||||
while (!myBuilder.eof() &&
|
||||
myBuilder.getTokenType() != PyTokenTypes.RPAR &&
|
||||
myBuilder.getTokenType() != PyTokenTypes.LINE_BREAK &&
|
||||
myBuilder.getTokenType() != PyTokenTypes.STATEMENT_BREAK) {
|
||||
myBuilder.advanceLexer();
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo(bar):
|
||||
# type: (foo.
|
||||
@@ -0,0 +1,2 @@
|
||||
def foo(bar):
|
||||
# type: (foo<caret>
|
||||
@@ -591,4 +591,9 @@ public class PyEditingTest extends PyTestCase {
|
||||
" return bar, 'so' \\\n" +
|
||||
" 'me'");
|
||||
}
|
||||
|
||||
// PY-27178
|
||||
public void testIncompleteFunctionTypeComment() {
|
||||
doTypingTest('.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user