public RoslynDefinitionFinder(string sourceFilePath, RoslynReferencesWrapper wrapper)
        {
            if (wrapper == null)
            {
                wrapper = new RoslynReferencesWrapper();
            }

            this.SyntaxTree    = ParseFile(sourceFilePath);
            this.Compilation   = wrapper.GetCompilationFor(this.SyntaxTree);
            this.Compilation   = this.Compilation.AddSyntaxTrees(this.SyntaxTree);
            this.SemanticModel = this.Compilation.GetSemanticModel(this.SyntaxTree, true);
        }
示例#2
0
        private void LoadReferences()
        {
            // F12 Demo. Need a nicer story for identifying when to load references.
            if (this.IsF12Demo)
            {
                LoadStatus = "Building Go To Definition Compilation...";
                Draw();

                string referencesDirectory = Path.GetFullPath(Path.Combine(Options.DatabasePath, "..\\.."));

                List <string> referencePaths = new List <string>();
                referencePaths.Add(typeof(object).Assembly.Location);
                referencePaths.AddRange(Directory.GetFiles(referencesDirectory, "*.dll"));
                referencePaths.AddRange(Directory.GetFiles(referencesDirectory, "*.exe"));

                this.References = new RoslynReferencesWrapper(referencePaths);
            }
        }