private void FileChangedOnDisk(string filePath)
        {
            var item = VsxHelper.FindProjectItemByFilePath(project, filePath);

            if (item == null || !IsItemRelevant(item))
            {
                return;
            }

            tracer.Trace("File change on disk handling queued: {0}", this, filePath);
            QueueHandlingFileOnDiskChange(filePath);
        }
        private void HandleFilesChangedOnDisk(object _)
        {
            if (filesChangedOnDisk.Count == 0)
            {
                return;
            }
            var filesChanged = filesChangedOnDisk;

            filesChangedOnDisk = new HashSet <string>();

            foreach (var filePath in filesChanged)
            {
                try
                {
                    var item = VsxHelper.FindProjectItemByFilePath(project, filePath);
                    if (item == null)
                    {
                        return;
                    }

                    // if the file is open, we have to wait until VS reloads the file content, because
                    // until it is not reloaded, the file code model might be out of sync with the new content.
                    if (item.IsOpen[EnvDTE.Constants.vsViewKindAny])
                    {
                        string contentOnDisk = VsxHelper.GetFileContent(item, loadLastSaved: true);
                        string contentInVS   = VsxHelper.GetFileContent(item, loadLastSaved: false);

                        if (!contentOnDisk.Equals(contentInVS))
                        {
                            tracer.Trace("File is open and not in sync, reschedule update: {0}", this, filePath);
                            QueueHandlingFileOnDiskChange(filePath);
                            continue;
                        }
                    }

                    tracer.Trace("File changed outside of Visual Studio: {0}", this, filePath);
                    if (IsItemRelevant(item))
                    {
                        OnFileChanged(item);
                    }
                }
                catch (Exception ex)
                {
                    tracer.Trace("Error during file change handling: {0}", this, ex);
                }
            }
        }