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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart

Issue 2537513004: Read overlay content when computing completions (issue 27887) (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.completion.contributor.dart.importuri; 5 library services.completion.contributor.dart.importuri;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core'; 8 import 'dart:core';
9 9
10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 10 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 int end = uri.end; 59 int end = uri.end;
60 if (offset > start) { 60 if (offset > start) {
61 if (offset < end) { 61 if (offset < end) {
62 // Quoted non-empty string 62 // Quoted non-empty string
63 visitSimpleStringLiteral(uri); 63 visitSimpleStringLiteral(uri);
64 } else if (offset == end) { 64 } else if (offset == end) {
65 if (end == start + 1) { 65 if (end == start + 1) {
66 // Quoted empty string 66 // Quoted empty string
67 visitSimpleStringLiteral(uri); 67 visitSimpleStringLiteral(uri);
68 } else { 68 } else {
69 String data = request.source.contents.data; 69 String data = request.sourceContents;
70 if (end == data.length) { 70 if (end == data.length) {
71 String ch = data[end - 1]; 71 String ch = data[end - 1];
72 if (ch != '"' && ch != "'") { 72 if (ch != '"' && ch != "'") {
73 // Insertion point at end of file 73 // Insertion point at end of file
74 // and missing closing quote on non-empty string 74 // and missing closing quote on non-empty string
75 visitSimpleStringLiteral(uri); 75 visitSimpleStringLiteral(uri);
76 } 76 }
77 } 77 }
78 } 78 }
79 } 79 }
80 } else if (offset == start && offset == end) { 80 } else if (offset == start && offset == end) {
81 String data = request.source.contents.data; 81 String data = request.sourceContents;
82 if (end == data.length) { 82 if (end == data.length) {
83 String ch = data[end - 1]; 83 String ch = data[end - 1];
84 if (ch == '"' || ch == "'") { 84 if (ch == '"' || ch == "'") {
85 // Insertion point at end of file 85 // Insertion point at end of file
86 // and missing closing quote on empty string 86 // and missing closing quote on empty string
87 visitSimpleStringLiteral(uri); 87 visitSimpleStringLiteral(uri);
88 } 88 }
89 } 89 }
90 } 90 }
91 } 91 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 String _extractPartialUri(SimpleStringLiteral node) { 216 String _extractPartialUri(SimpleStringLiteral node) {
217 if (request.offset < node.contentsOffset) { 217 if (request.offset < node.contentsOffset) {
218 return null; 218 return null;
219 } 219 }
220 return node.literal.lexeme.substring( 220 return node.literal.lexeme.substring(
221 node.contentsOffset - node.offset, request.offset - node.offset); 221 node.contentsOffset - node.offset, request.offset - node.offset);
222 } 222 }
223 } 223 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698