Esempio n. 1
0
 private void PythonProjectReferenceNode_ProjectLoaded(object sender, ProjectEventArgs e) {
     if (ProjectMgr.IsClosing) {
         return;
     }
     InitializeFileChangeListener();
     AddAnalyzedAssembly(((PythonProjectNode)ProjectMgr).GetAnalyzer()).DoNotWait();
     ProjectMgr.OnInvalidateItems(Parent);
 }
Esempio n. 2
0
 private void OnProjectRenamed(object sender, ProjectEventArgs e) {
     OnProjectUnloaded(this, e);
     OnProjectLoaded(this, e);
 }
Esempio n. 3
0
        private void OnProjectUnloaded(object sender, ProjectEventArgs e) {
            if (e.Project != null) {
                string root = null;
                try {
                    root = e.Project.GetProjectHome();
                } catch (Exception ex) {
                    if (EqtTrace.IsVerboseEnabled) {
                        EqtTrace.Warning("TestContainerDiscoverer: Failed to get project home {0}", ex);
                    }
                    // If we fail to get ProjectHome, we still want to track the
                    // project. We just won't get the benefits of merging
                    // watchers into a single recursive watcher.
                }

                ProjectInfo projectInfo;
                string projectPath;
                if (e.Project.TryGetProjectPath(out projectPath) &&
                    _knownProjects.TryGetValue(projectPath, out projectInfo)) {
                    _knownProjects.Remove(projectPath);

                    projectInfo.Detach();

                    foreach (var p in e.Project.GetProjectItemPaths()) {
                        if (string.IsNullOrEmpty(root) || !CommonUtils.IsSubpathOf(root, p)) {
                            _testFilesUpdateWatcher.RemoveWatch(p);
                        }
                        _fileRootMap.Remove(p);
                    }
                    if (!string.IsNullOrEmpty(root)) {
                        _testFilesUpdateWatcher.RemoveWatch(root);
                    }
                }
            }

            OnTestContainersChanged(e.Project);
        }
Esempio n. 4
0
        private void OnProjectLoaded(object sender, ProjectEventArgs e) {
            if (e.Project != null) {
                string root = null;
                try {
                    root = e.Project.GetProjectHome();
                } catch (Exception ex) {
                    if (EqtTrace.IsVerboseEnabled) {
                        EqtTrace.Warning("TestContainerDiscoverer: Failed to get project home {0}", ex);
                    }
                    // If we fail to get ProjectHome, we still want to track the
                    // project. We just won't get the benefits of merging
                    // watchers into a single recursive watcher.
                }

                string path;
                if (e.Project.TryGetProjectPath(out path) &&
                    !_knownProjects.ContainsKey(path)) {
                    var dteProject = ((IVsHierarchy)e.Project).GetProject();
                    var interpFact = (MSBuildProjectInterpreterFactoryProvider)dteProject.Properties.Item("InterpreterFactoryProvider").Value;

                    var projectInfo = new ProjectInfo(
                        e.Project,
                        this,
                        interpFact
                    );

                    _knownProjects.Add(path, projectInfo);

                    foreach (var p in e.Project.GetProjectItemPaths()) {
                        if (!string.IsNullOrEmpty(root) && CommonUtils.IsSubpathOf(root, p)) {
                            _testFilesUpdateWatcher.AddDirectoryWatch(root);
                            _fileRootMap[p] = root;
                        } else {
                            _testFilesUpdateWatcher.AddWatch(p);
                        }
                    }
                }
            }

            OnTestContainersChanged(e.Project);
        }
Esempio n. 5
0
        private void OnProjectUnloaded(object sender, ProjectEventArgs e) {
            if (e.Project != null) {
                var provider = e.Project as IPythonProjectProvider;
                ProjectInfo events;
                if (provider != null && _projectInfo.TryGetValue(provider.Project, out events)) {
                    var analyzer = provider.Project.Analyzer;

                    provider.Project.ProjectAnalyzerChanged -= events.ProjectAnalyzerChanged;
                    analyzer.AnalysisComplete -= events.AnalysisComplete;

                    _projectInfo.Remove(provider.Project);
                }
            }

            TestContainersUpdated?.Invoke(this, EventArgs.Empty);
        }        
Esempio n. 6
0
        private void OnProjectLoaded(object sender, ProjectEventArgs e) {
            if (e.Project != null) {
                var provider = e.Project as IPythonProjectProvider;
                if (provider != null) {
                    var analyzer = provider.Project.Analyzer;
                    var projectInfo = new ProjectInfo(this, provider.Project);
                    _projectInfo[provider.Project] = projectInfo;

                    foreach (var file in analyzer.Files) {
                        projectInfo.AnalysisComplete(this, new AnalysisCompleteEventArgs(file));
                    }
                }
            }

            TestContainersUpdated?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 7
0
 private void EventListener_ProjectLoaded(object sender, ProjectEventArgs e) {
     Guid proj;
     if (ErrorHandler.Succeeded(((IVsHierarchy)e.Project).GetGuidProperty(
         (uint)VSConstants.VSITEMID.Root,
         (int)__VSHPROPID.VSHPROPID_ProjectIDGuid,
         out proj
     )) && ReferencedProjectGuid == proj) {
         Invalidate();
     }
 }
 private void PythonProjectReferenceNode_ProjectLoaded(object sender, ProjectEventArgs e) {
     InitializeFileChangeListener();
     AddAnalyzedAssembly(((PythonProjectNode)ProjectMgr).GetInterpreter() as IPythonInterpreterWithProjectReferences).DoNotWait();
     ProjectMgr.OnInvalidateItems(Parent);
 }
 private void ProjectChanged(object sender, ProjectEventArgs e) {
     EvaluatorsChanged?.Invoke(this, EventArgs.Empty);
 }
 private void Solution_ProjectUnloading(object sender, ProjectEventArgs e) {
     var project = e.Project.GetPythonProject();
     if (project != null) {
         ProjectUnloaded(project.Interpreters);
     }
 }