Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart

Issue 2478963002: Completion with the new analysis driver. (Closed)
Patch Set: Fixes for review comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5f782973971ba6e9a3512e34f2b8fdd93a0eb09b 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;
+ 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;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698