Index: pkg/analysis_server/lib/src/context_manager.dart |
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart |
index 8bbadccbfe05d26f957784f79d4fb3257ccb1f6e..5f4460ca3e5f6f8e2f437c4b729bdc4b67ed126c 100644 |
--- a/pkg/analysis_server/lib/src/context_manager.dart |
+++ b/pkg/analysis_server/lib/src/context_manager.dart |
@@ -279,6 +279,17 @@ abstract class ContextManager { |
List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot); |
/** |
+ * Return the [AnalysisDriver] for the "innermost" context whose associated |
+ * folder is or contains the given path. ("innermost" refers to the nesting |
+ * of contexts, so if there is a context for path /foo and a context for |
+ * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is |
+ * the context for /foo/bar.) |
+ * |
+ * If no driver contains the given path, `null` is returned. |
+ */ |
+ AnalysisDriver getDriverFor(String path); |
+ |
+ /** |
* Return the [AnalysisContext] for the "innermost" context whose associated |
* folder is or contains the given path. ("innermost" refers to the nesting |
* of contexts, so if there is a context for path /foo and a context for |
@@ -583,6 +594,11 @@ class ContextManagerImpl implements ContextManager { |
bool definesEmbeddedLibs(Map map) => map[_EMBEDDED_LIB_MAP_KEY] != null; |
@override |
+ AnalysisDriver getDriverFor(String path) { |
+ return _getInnermostContextInfoFor(path)?.analysisDriver; |
+ } |
+ |
+ @override |
AnalysisContext getContextFor(String path) { |
return _getInnermostContextInfoFor(path)?.context; |
} |