| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 import 'package:analyzer/src/generated/engine.dart'; | 23 import 'package:analyzer/src/generated/engine.dart'; |
| 24 import 'package:analyzer/src/generated/source.dart'; | 24 import 'package:analyzer/src/generated/source.dart'; |
| 25 import 'package:analyzer/src/generated/sdk.dart'; | 25 import 'package:analyzer/src/generated/sdk.dart'; |
| 26 import 'package:analyzer/src/generated/source_io.dart'; | 26 import 'package:analyzer/src/generated/source_io.dart'; |
| 27 import 'package:analyzer/src/generated/java_engine.dart'; | 27 import 'package:analyzer/src/generated/java_engine.dart'; |
| 28 import 'package:analysis_server/src/services/constants.dart'; | 28 import 'package:analysis_server/src/services/constants.dart'; |
| 29 import 'package:analysis_server/src/services/correction/change.dart'; | 29 import 'package:analysis_server/src/services/correction/change.dart'; |
| 30 import 'package:analysis_server/src/services/index/index.dart'; | 30 import 'package:analysis_server/src/services/index/index.dart'; |
| 31 import 'package:analysis_server/src/services/search/search_engine.dart'; | 31 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 32 import 'package:analyzer/src/generated/element.dart'; | 32 import 'package:analyzer/src/generated/element.dart'; |
| 33 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 33 | 34 |
| 34 | 35 |
| 35 class ServerContextManager extends ContextManager { | 36 class ServerContextManager extends ContextManager { |
| 36 final AnalysisServer analysisServer; | 37 final AnalysisServer analysisServer; |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * The default options used to create new analysis contexts. | 40 * The default options used to create new analysis contexts. |
| 40 */ | 41 */ |
| 41 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 42 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 42 | 43 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 * offset. | 675 * offset. |
| 675 * | 676 * |
| 676 * May be empty, but not `null`. | 677 * May be empty, but not `null`. |
| 677 */ | 678 */ |
| 678 List<Element> getElementsAtOffset(String path, int offset) { | 679 List<Element> getElementsAtOffset(String path, int offset) { |
| 679 List<CompilationUnit> units = getResolvedCompilationUnits(path); | 680 List<CompilationUnit> units = getResolvedCompilationUnits(path); |
| 680 List<Element> elements = <Element>[]; | 681 List<Element> elements = <Element>[]; |
| 681 for (CompilationUnit unit in units) { | 682 for (CompilationUnit unit in units) { |
| 682 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); | 683 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); |
| 683 Element element = ElementLocator.locateWithOffset(node, offset); | 684 Element element = ElementLocator.locateWithOffset(node, offset); |
| 685 if (node is SimpleIdentifier && element is PrefixElement) { |
| 686 element = getImportElement(node); |
| 687 } |
| 684 if (element != null) { | 688 if (element != null) { |
| 685 elements.add(element); | 689 elements.add(element); |
| 686 } | 690 } |
| 687 } | 691 } |
| 688 return elements; | 692 return elements; |
| 689 } | 693 } |
| 690 | 694 |
| 691 /** | 695 /** |
| 692 * Returns a [Future] completing when [file] has been completely analyzed, in | 696 * Returns a [Future] completing when [file] has been completely analyzed, in |
| 693 * particular, all its errors have been computed. | 697 * particular, all its errors have been computed. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 /** | 836 /** |
| 833 * An enumeration of the services provided by the server domain. | 837 * An enumeration of the services provided by the server domain. |
| 834 */ | 838 */ |
| 835 class ServerService extends Enum2<ServerService> { | 839 class ServerService extends Enum2<ServerService> { |
| 836 static const ServerService STATUS = const ServerService('STATUS', 0); | 840 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 837 | 841 |
| 838 static const List<ServerService> VALUES = const [STATUS]; | 842 static const List<ServerService> VALUES = const [STATUS]; |
| 839 | 843 |
| 840 const ServerService(String name, int ordinal) : super(name, ordinal); | 844 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 841 } | 845 } |
| OLD | NEW |