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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 501843002: Send RenameFeedback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index a0d287975b0d5ccd451b39aa65f56a76a03ec1ff..d85f8933641069443087a7b4d496cfd17dea03c3 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -669,16 +669,40 @@ class AnalysisServer {
}
/**
- * Returns [Element]s of the Dart file with the given [path], at the given
- * offset.
+ * Returns [AstNode]s at the given [offset] of the given [file].
*
* May be empty, but not `null`.
*/
- List<Element> getElementsAtOffset(String path, int offset) {
- List<CompilationUnit> units = getResolvedCompilationUnits(path);
- List<Element> elements = <Element>[];
+ List<AstNode> getNodesAtOffset(String file, int offset) {
+ List<CompilationUnit> units = getResolvedCompilationUnits(file);
+ List<AstNode> nodes = <AstNode>[];
for (CompilationUnit unit in units) {
AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
+ if (node != null) {
+ nodes.add(node);
+ }
+ }
+ return nodes;
+ }
+
+ /**
+ * Returns [Element]s at the given [offset] of the given [file].
+ *
+ * May be empty if not resolved, but not `null`.
+ */
+ List<Element> getElementsAtOffset(String file, int offset) {
+ List<AstNode> nodes = getNodesAtOffset(file, offset);
+ return getElementsOfNodes(nodes, offset);
+ }
+
+ /**
+ * Returns [Element]s of the given [nodes].
+ *
+ * May be empty if not resolved, but not `null`.
+ */
+ List<Element> getElementsOfNodes(List<AstNode> nodes, int offset) {
+ List<Element> elements = <Element>[];
+ for (AstNode node in nodes) {
Element element = ElementLocator.locateWithOffset(node, offset);
if (node is SimpleIdentifier && element is PrefixElement) {
element = getImportElement(node);
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698