protected override void OnAssemblyReferenceChangedOnDisk(object sender, FileChangedOnDiskEventArgs e) {
            base.OnAssemblyReferenceChangedOnDisk(sender, e);

            ReferenceChangedOnDisk(e)
                .HandleAllExceptions(ProjectMgr.Site, GetType())
                .DoNotWait();
        }
        private void FileChangedOnDisk(object sender, FileChangedOnDiskEventArgs e) {
            var interp = ((PythonProjectNode)ProjectMgr).GetInterpreter() as IPythonInterpreterWithProjectReferences;
            // remove the reference to whatever we are currently observing
            RemoveAnalyzedAssembly(interp);

            if ((e.FileChangeFlag & (VisualStudio.Shell.Interop._VSFILECHANGEFLAGS.VSFILECHG_Add | VisualStudio.Shell.Interop._VSFILECHANGEFLAGS.VSFILECHG_Time | VisualStudio.Shell.Interop._VSFILECHANGEFLAGS.VSFILECHG_Size)) != 0) {
                // kick off the analysis of the new assembly...
                AddAnalyzedAssembly(interp).DoNotWait();
            }
        }
 private async Task ReferenceChangedOnDisk(FileChangedOnDiskEventArgs e) {
     var analyzer = ((PythonProjectNode)ProjectMgr).GetAnalyzer();
     if (analyzer != null && PathUtils.IsSamePath(e.FileName, Url)) {
         if ((e.FileChangeFlag & (_VSFILECHANGEFLAGS.VSFILECHG_Attr | _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Add)) != 0) {
             // file was modified, unload and reload the extension module from our database.
             await analyzer.RemoveReferenceAsync(new ProjectAssemblyReference(AssemblyName, Url));
             await AnalyzeReferenceAsync(analyzer);
         } else if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) != 0) {
             // file was deleted, unload from our extension database
             await analyzer.RemoveReferenceAsync(new ProjectAssemblyReference(AssemblyName, Url));
         }
     }
 }
        protected override void OnAssemblyReferenceChangedOnDisk(object sender, FileChangedOnDiskEventArgs e) {
            base.OnAssemblyReferenceChangedOnDisk(sender, e);

            var analyzer = ((PythonProjectNode)ProjectMgr).GetAnalyzer();
            if (analyzer != null && CommonUtils.IsSamePath(e.FileName, Url)) {
                if ((e.FileChangeFlag & (_VSFILECHANGEFLAGS.VSFILECHG_Attr | _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Add)) != 0) {
                    // file was modified, unload and reload the extension module from our database.
                    analyzer.RemoveReference(new ProjectAssemblyReference(AssemblyName, Url));

                    AnalyzeReference(analyzer.Interpreter as IPythonInterpreterWithProjectReferences);
                } else if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) != 0) {
                    // file was deleted, unload from our extension database
                    analyzer.RemoveReference(new ProjectAssemblyReference(AssemblyName, Url));
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Event callback. Called when one of the assembly file is changed.
        /// </summary>
        /// <param name="sender">The FileChangeManager object.</param>
        /// <param name="e">Event args containing the file name that was updated.</param>
        protected virtual void OnAssemblyReferenceChangedOnDisk(object sender, FileChangedOnDiskEventArgs e)
        {
            Debug.Assert(e != null, "No event args specified for the FileChangedOnDisk event");
            if (e == null)
            {
                return;
            }

            // We only care about file deletes, so check for one before enumerating references.
            if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) == 0)
            {
                return;
            }

            if (CommonUtils.IsSamePath(e.FileName, this.assemblyPath))
            {
                this.ProjectMgr.OnInvalidateItems(this.Parent);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Event callback. Called when one of the assembly file is changed.
        /// </summary>
        /// <param name="sender">The FileChangeManager object.</param>
        /// <param name="e">Event args containing the file name that was updated.</param>
        protected virtual void OnAssemblyReferenceChangedOnDisk(object sender, FileChangedOnDiskEventArgs e)
        {
            Debug.Assert(e != null, "No event args specified for the FileChangedOnDisk event");
            if (e == null) {
                return;
            }

            // We only care about file deletes, so check for one before enumerating references.
            if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) == 0) {
                return;
            }

            if (CommonUtils.IsSamePath(e.FileName, this.assemblyPath)) {
                ProjectMgr.OnInvalidateItems(this.Parent);
            }
        }
        /// <summary>
        /// Event callback. Called when one of the extension files are changed.
        /// </summary>
        /// <param name="sender">The FileChangeManager object.</param>
        /// <param name="e">Event args containing the file name that was updated.</param>
        private void OnExtensionChangedOnDisk(object sender, FileChangedOnDiskEventArgs e) {
            Debug.Assert(e != null, "No event args specified for the FileChangedOnDisk event");
            if (e == null) {
                return;
            }

            var interp = ((PythonProjectNode)ProjectMgr).GetInterpreter() as IPythonInterpreterWithProjectReferences;
            if (interp != null && CommonUtils.IsSamePath(e.FileName, _filename)) {
                if ((e.FileChangeFlag & (_VSFILECHANGEFLAGS.VSFILECHG_Attr | _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Add)) != 0) {
                    // file was modified, unload and reload the extension module from our database.
                    interp.RemoveReference(new ProjectReference(_filename, ProjectReferenceKind.ExtensionModule));

                    AnalyzeReference(interp);
                } else if ((e.FileChangeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) != 0) {
                    // file was deleted, unload from our extension database
                    interp.RemoveReference(new ProjectReference(_filename, ProjectReferenceKind.ExtensionModule));
                    ProjectMgr.OnInvalidateItems(Parent);
                }
            }
        }