Chromium Code Reviews| Index: pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart |
| diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart |
| index c69d8063eb6c16435409e78a5a0442752851f13b..59898cd776ae651192c86df21afb500f8cee91e0 100644 |
| --- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart |
| +++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart |
| @@ -209,23 +209,22 @@ class _LocalVisitor extends LocalDeclarationVisitor { |
| // If user typed identifier starting with '_' |
| // then do not suppress the relevance of private members |
| - var contents = request.context.getContents(request.source); |
| - if (contents != null) { |
| - String data = contents.data; |
| - int offset = request.offset; |
| - if (data != null && 0 < offset && offset <= data.length) { |
| - bool isIdentifierChar(int index) { |
| - int code = data.codeUnitAt(index); |
| - return isLetterOrDigit(code) || code == CHAR_UNDERSCORE; |
| - } |
| + var data = request.result != null |
| + ? request.result.content |
| + : request.context.getContents(request.source).data; |
|
Paul Berry
2016/11/06 13:25:36
To preserve null safety, this needs to be "?.data"
scheglov
2016/11/06 18:45:33
Done.
|
| + int offset = request.offset; |
| + if (data != null && 0 < offset && offset <= data.length) { |
| + bool isIdentifierChar(int index) { |
| + int code = data.codeUnitAt(index); |
| + return isLetterOrDigit(code) || code == CHAR_UNDERSCORE; |
| + } |
| - if (isIdentifierChar(offset - 1)) { |
| - while (offset > 0 && isIdentifierChar(offset - 1)) { |
| - --offset; |
| - } |
| - if (data.codeUnitAt(offset) == CHAR_UNDERSCORE) { |
| - privateMemberRelevance = null; |
| - } |
| + if (isIdentifierChar(offset - 1)) { |
| + while (offset > 0 && isIdentifierChar(offset - 1)) { |
| + --offset; |
| + } |
| + if (data.codeUnitAt(offset) == CHAR_UNDERSCORE) { |
| + privateMemberRelevance = null; |
| } |
| } |
| } |