mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:59:47 +00:00
Issue 33034. Fix statement completion with missing condition right parenthesis.
Bug: https://github.com/dart-lang/sdk/issues/33034 Change-Id: I87a47e5ddc41596b4bcd0c07d250a7afb00546ef Reviewed-on: https://dart-review.googlesource.com/53680 Reviewed-by: Steve Messick <messick@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
3fd2d5fb05
commit
9d10a6ad4a
|
@ -804,6 +804,9 @@ class StatementCompletionProcessor {
|
|||
if (_isSyntheticExpression(statement.condition)) {
|
||||
exitPosition = _newPosition(statement.leftParenthesis.offset + 1);
|
||||
sb = new SourceBuilder(file, statement.rightParenthesis.offset + 1);
|
||||
} else if (statement.rightParenthesis.isSynthetic) {
|
||||
sb = new SourceBuilder(file, statement.condition.end);
|
||||
sb.append(')');
|
||||
} else {
|
||||
int afterParen = statement.rightParenthesis.offset + 1;
|
||||
if (utils
|
||||
|
|
|
@ -1235,6 +1235,27 @@ main() {
|
|||
(s) => _after(s, ' '));
|
||||
}
|
||||
|
||||
test_withCondition_noRightParenthesis() async {
|
||||
await _prepareCompletion(
|
||||
'if (true',
|
||||
'''
|
||||
main() {
|
||||
if (true
|
||||
}
|
||||
''',
|
||||
atEnd: true);
|
||||
_assertHasChange(
|
||||
'Complete if-statement',
|
||||
'''
|
||||
main() {
|
||||
if (true) {
|
||||
////
|
||||
}
|
||||
}
|
||||
''',
|
||||
(s) => _after(s, ' '));
|
||||
}
|
||||
|
||||
test_withElse() async {
|
||||
await _prepareCompletion(
|
||||
'else',
|
||||
|
|
Loading…
Reference in a new issue