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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | 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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 CompilationUnit unit = context.getResolvedCompilationUnit2(unitSource, lib rarySource); 662 CompilationUnit unit = context.getResolvedCompilationUnit2(unitSource, lib rarySource);
663 if (unit != null) { 663 if (unit != null) {
664 units.add(unit); 664 units.add(unit);
665 } 665 }
666 } 666 }
667 // done 667 // done
668 return units; 668 return units;
669 } 669 }
670 670
671 /** 671 /**
672 * Returns [Element]s of the Dart file with the given [path], at the given 672 * Returns [AstNode]s at the given [offset] of the given [file].
673 * offset.
674 * 673 *
675 * May be empty, but not `null`. 674 * May be empty, but not `null`.
676 */ 675 */
677 List<Element> getElementsAtOffset(String path, int offset) { 676 List<AstNode> getNodesAtOffset(String file, int offset) {
678 List<CompilationUnit> units = getResolvedCompilationUnits(path); 677 List<CompilationUnit> units = getResolvedCompilationUnits(file);
679 List<Element> elements = <Element>[]; 678 List<AstNode> nodes = <AstNode>[];
680 for (CompilationUnit unit in units) { 679 for (CompilationUnit unit in units) {
681 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); 680 AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
681 if (node != null) {
682 nodes.add(node);
683 }
684 }
685 return nodes;
686 }
687
688 /**
689 * Returns [Element]s at the given [offset] of the given [file].
690 *
691 * May be empty if not resolved, but not `null`.
692 */
693 List<Element> getElementsAtOffset(String file, int offset) {
694 List<AstNode> nodes = getNodesAtOffset(file, offset);
695 return getElementsOfNodes(nodes, offset);
696 }
697
698 /**
699 * Returns [Element]s of the given [nodes].
700 *
701 * May be empty if not resolved, but not `null`.
702 */
703 List<Element> getElementsOfNodes(List<AstNode> nodes, int offset) {
704 List<Element> elements = <Element>[];
705 for (AstNode node in nodes) {
682 Element element = ElementLocator.locateWithOffset(node, offset); 706 Element element = ElementLocator.locateWithOffset(node, offset);
683 if (node is SimpleIdentifier && element is PrefixElement) { 707 if (node is SimpleIdentifier && element is PrefixElement) {
684 element = getImportElement(node); 708 element = getImportElement(node);
685 } 709 }
686 if (element != null) { 710 if (element != null) {
687 elements.add(element); 711 elements.add(element);
688 } 712 }
689 } 713 }
690 return elements; 714 return elements;
691 } 715 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 stackTraceString = 'null stackTrace'; 827 stackTraceString = 'null stackTrace';
804 } 828 }
805 // send the notification 829 // send the notification
806 channel.sendNotification(new ServerErrorParams(true, exceptionString, 830 channel.sendNotification(new ServerErrorParams(true, exceptionString,
807 stackTraceString).toNotification()); 831 stackTraceString).toNotification());
808 } 832 }
809 } 833 }
810 834
811 835
812 typedef void OptionUpdater(AnalysisOptionsImpl options); 836 typedef void OptionUpdater(AnalysisOptionsImpl options);
OLDNEW
« 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