private void ReCalculate(ITextSnapshot fileSnapshot) { var recalculated = _tagsCache.ReCalculate((() => { var configuration = _deveroomConfigurationProvider.GetConfiguration(); var bindingRegistry = _discoveryService?.GetBindingRegistry(); var bindingRegistryVersion = bindingRegistry?.Version; var currentTagsCache = _tagsCache.Value; if (currentTagsCache != null && currentTagsCache.SnapshotVersion == fileSnapshot.Version.VersionNumber && currentTagsCache.BindingRegistryVersion == bindingRegistryVersion && currentTagsCache.ConfigurationChangeTime == configuration.ConfigurationChangeTime) { return(currentTagsCache); } var deveroomTags = ReParse(fileSnapshot, bindingRegistry, configuration); MonitorParse(deveroomTags); return(new TagsCache(fileSnapshot, bindingRegistryVersion, configuration.ConfigurationChangeTime, deveroomTags)); })); if (recalculated) { RaiseTagsChanged(fileSnapshot); } }