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