public SourceDocument(SyntaxNode sourceRoot, SemanticModel semanticModel) { NamespaceFinder finder = new NamespaceFinder(); finder.Visit(sourceRoot); if (finder.Namespace != null) { _sourceItems = SourceItem.CreateNestedItems(finder.Namespace.Members, semanticModel); _usings = finder.Usings; _namespace = finder.Namespace; } }
private Declarations GetImportIntellisenseDeclarations(string line) { NamespaceFinder availableNamespaces = new NamespaceFinder(); // get any namespace already written (i.e. "Boo.Lang.") string namespaceContinuation = line.Trim(); namespaceContinuation = namespaceContinuation.Remove(0, ImportKeyword.Length).Trim(); // get project references for the project that the current file is in ProjectHierarchy projects = new ProjectHierarchy(service); VSProject project = projects.GetContainingProject(fileName); IList<ProjectReference> references = projects.GetReferences(project); return new BooDeclarations(availableNamespaces.QueryNamespacesFromReferences(references, namespaceContinuation)); }
public void SetData(Solution solution) { _finder = new NamespaceFinder(solution); }