protected void ShowLocations(IList <FileLocationInfo> locations, FileLocationInfo currentLocation, string caption, bool bindToPsi) { var lifetimeDefinition = Lifetimes.Define(lifetime); if (!Enumerable.Any(locations)) { agent.ShowBalloon(lifetimeDefinition.Lifetime, caption, string.Format("There are no {0}.", caption.ToLowerInvariant()), null, new[] { "OK" }, false, balloonLifetime => { agent.ButtonClicked.Advise(balloonLifetime, _ => lifetimeDefinition.Terminate()); }); return; } var options = new List <BalloonOption>(); foreach (var locationInfo in locations.Distinct().Where(l => l.ProjectFile.IsValid() || l.FileSystemPath != null)) { var descriptor = new SimpleMenuItem(); var occurence = GetOccurence(locationInfo, bindToPsi); if (occurence != null) { presentationManager.DescribeOccurence(descriptor, occurence, null); var enabled = locationInfo != currentLocation; options.Add(new BalloonOption(descriptor.Text + string.Format(" ({0})", descriptor.ShortcutText), false, enabled, locationInfo)); } } agent.ShowBalloon(lifetimeDefinition.Lifetime, caption, string.Empty, options, new[] { "Done" }, true, balloonLifetime => { agent.BalloonOptionClicked.Advise(balloonLifetime, o => { lifetimeDefinition.Terminate(); var locationInfo = o as FileLocationInfo; if (locationInfo == null) { return; } shellLocks.ExecuteOrQueueReadLock("GotoRecentFiles", () => { using (ReadLockCookie.Create()) { PsiFiles.CommitAllDocuments(); var occurence = GetOccurence(locationInfo, bindToPsi); if (occurence != null) { occurence.Navigate(solution, popupWindowContext.Source, true); } } }); }); agent.ButtonClicked.Advise(balloonLifetime, _ => lifetimeDefinition.Terminate()); }); }
private void RunBackgroundActivity() { myShellLocks.Dispatcher.AssertAccess(); using (ReadLockCookie.Create()) { Assertion.Assert(myCurrentBackgroundActivityLifetime.IsAlive, "myCurrentBackgroundActivityLifetime.IsAlive"); if (HasDirtyFiles()) { var filesToDelete = new SynchronizedList <IPsiSourceFile>(myDeferredHelperCache.FilesToDrop.Take(BATCH_SIZE)); var filesToAdd = new SynchronizedList <IPsiSourceFile>(myDeferredHelperCache.FilesToProcess.Take(BATCH_SIZE)); var calculatedData = new ConcurrentDictionary <IPsiSourceFile, (long, Dictionary <IDeferredCache, object>)>(); ScheduleBackgroundProcess(filesToDelete, filesToAdd, calculatedData); } else { myCurrentBackgroundActivityLifetimeDefinition.Terminate(); myCurrentBackgroundActivityLifetimeDefinition = null; myCompletedOnce.Value = true; myIsProcessing = false; myLogger.Verbose("Finish processing files in deferred caches"); mySolution.GetComponent <IDaemon>().Invalidate(); } } }
protected override void DoTest(IProject testProject) { testProject.GetSolution().GetPsiServices().Files.CommitAllDocuments(); using (ITextControl textControl = OpenTextControl(testProject)) { var document = textControl.Document; var psiSourceFile = document.GetPsiSourceFile(Solution); Assert.IsNotNull(psiSourceFile, "sourceFile == null"); using (ReadLockCookie.Create()) { var highlightingFinder = new IdentifierHighlightingFinder(psiSourceFile, new DocumentRange(document, new TextRange(textControl.Caret.Offset()))); highlightingFinder.DoHighlighting(DaemonProcessKind.VISIBLE_DOCUMENT); var highlightingInfo = highlightingFinder.HighlightingInfo; Assertion.AssertNotNull(highlightingInfo, "Highlighting not found"); var markupModel = Solution.GetComponent <IDocumentMarkupManager>().GetMarkupModel(document); var highlighterTooltipProvider = DaemonUtil.GetHighlighterTooltipProvider(highlightingInfo.Highlighting, Solution); #if RIDER var attributeId = HighlightingSettingsManager.Instance.GetAttributeId(highlightingInfo.Highlighting, psiSourceFile, Solution).NotNull(); #else var attributeId = HighlightingSettingsManager.Instance.GetAttributeId(highlightingInfo.Highlighting, psiSourceFile).NotNull(); #endif var highlighter = markupModel.AddHighlighter("test", highlightingInfo.Range.TextRange, AreaType.EXACT_RANGE, 0, attributeId, new ErrorStripeAttributes(), highlighterTooltipProvider, null); ExecuteWithGold(writer => writer.WriteLine(highlighter.ToolTip)); } } }
public override object Load([NotNull] IProgressIndicator progress, bool enablePersistence) { base.Load(progress, enablePersistence); // Map is loaded on class instantiation progress.CurrentItemText = "Loading T4 file include caches"; var result = new Dictionary <IPsiSourceFile, T4ReversedFileDependencyData>(); var stopWatch = new Stopwatch(); stopWatch.Start(); foreach (var(sourceFile, data) in Map) { // This lock is intentionally taken per-file to avoid too long blocking. Just in case. using (ReadLockCookie.Create()) { var includes = new JetHashSet <IPsiSourceFile>( data.Includes.Select(include => PsiFileSelector.FindMostSuitableFile(include, sourceFile)) ); UpdateIncluders(result, sourceFile, includes, JetHashSet <IPsiSourceFile> .Empty); } } stopWatch.Stop(); Logger.Verbose("Loading T4 cache took {0} ms", stopWatch.ElapsedMilliseconds); return(result); }
private void RequestCurrentContext(Lifetime lt, IPsiSourceFile sourceFile, Rd.Tasks.RdTask <ShaderContextDataBase> task) { var currentRoot = myShaderContextCache.GetPreferredRootFile(new CppFileLocation(sourceFile)); if (!currentRoot.IsValid()) { task.Set(new AutoShaderContextData()); return; } mySolution.Locks.Tasks.StartNew(lt, Scheduling.FreeThreaded, () => { using (ReadLockCookie.Create()) { var possibleRoots = myCppGlobalSymbolCache.IncludesGraphCache.CollectPossibleRootsForFile(new CppFileLocation(sourceFile)).ToList(); if (possibleRoots.Contains(currentRoot)) { mySolution.Locks.ExecuteOrQueueReadLockEx(lt, "SetCurrentContext", () => { task.Set(GetContextDataFor(currentRoot)); }); } else { mySolution.Locks.ExecuteOrQueueEx(lt, "SetCurrentContext", () => { task.Set(new AutoShaderContextData()); }); } } }); }
public CppFileLocation GetPreferredRootFile(CppFileLocation currentFile) { using (ReadLockCookie.Create()) { var sourceFile = currentFile.GetRandomSourceFile(mySolution); if (myShaderContext.TryGetFromCache(sourceFile.GetLocation(), out var result)) { var path = myManager.TryGetProjectFile(result.Document)?.Location; if (path != null) { var location = new CppFileLocation(new FileSystemPathWithRange(path, result.Range)); if (!myLocationTracker.Exists(location)) { myLogger.Trace( $"Reset context for {sourceFile.GetPersistentIdForLogging()}, because inject is not registered"); myShaderContext.RemoveFromCache(sourceFile.GetLocation()); return(CppFileLocation.EMPTY); } return(location); } } } return(CppFileLocation.EMPTY); }
public void OnClick(CodeInsightsHighlighting highlighting, ISolution solution) { var rules = new List <IDataRule>(); rules.AddRule("Solution", ProjectModelDataConstants.SOLUTION, solution); var declaredElement = highlighting.DeclaredElement; rules.AddRule("DeclaredElement", PsiDataConstants.DECLARED_ELEMENTS_FROM_ALL_CONTEXTS, new[] { declaredElement }); using (ReadLockCookie.Create()) { if (!declaredElement.IsValid()) { return; } rules.AddRule("DocumentEditorContext", DocumentModelDataConstants.EDITOR_CONTEXT, new DocumentEditorContext(highlighting.Range)); rules.AddRule("PopupWindowSourceOverride", UIDataConstants.PopupWindowContextSource, new PopupWindowContextSource(lt => new RiderEditorOffsetPopupWindowContext(highlighting.Range.StartOffset.Offset))); rules.AddRule("DontNavigateImmediatelyToSingleUsage", NavigationSettings.DONT_NAVIGATE_IMMEDIATELY_TO_SINGLE_USAGE, new object()); var ctx = myContexts.CreateWithDataRules(Lifetime.Eternal, rules); var def = myActionManager.Defs.GetActionDef <GoToUnityUsagesAction>(); def.EvaluateAndExecute(myActionManager, ctx); } }
public override IUnitTestElement Map(Test test) { using (ReadLockCookie.Create()) { var assemblyPath = _project?.GetOutputFilePath(_targetFrameworkId); var typeName = GetType(test); var fieldName = GetField(test); var subject = GetTraits(test, "Subject").FirstOrDefault(); var tags = GetTraits(test, "Tag"); var behaviorField = GetTraits(test, "BehaviorField").FirstOrDefault(); var behaviorType = GetTraits(test, "BehaviorType").FirstOrDefault(); var type = new ClrTypeName(typeName); var context = _factory.GetOrCreateContext(_project, type, assemblyPath, subject, tags.ToArray(), false); if (!string.IsNullOrEmpty(behaviorField) && !string.IsNullOrEmpty(behaviorType)) { var behavior = _factory.GetOrCreateBehavior(_project, context, type, behaviorField, false); return(_factory.GetOrCreateBehaviorSpecification(_project, behavior, new ClrTypeName(behaviorType), fieldName, false)); } return(_factory.GetOrCreateContextSpecification(_project, context, type, fieldName, false)); } }
protected override void AfterCommitSync(ISet <IPsiSourceFile> indirectDependencies) { using var cookie = ReadLockCookie.Create(); foreach (var sourceFile in indirectDependencies) { var projectFile = sourceFile.ToProjectFile(); if (projectFile == null) { continue; } if (RootTemplateKindProvider.IsRootPreprocessedTemplate(sourceFile)) { if (projectFile.IsFlaggedAsPreprocessed()) { continue; } projectFile.FlagAsPreprocessed(); UpdateFile(sourceFile); } else { if (!projectFile.IsFlaggedAsPreprocessed()) { continue; } projectFile.FlagAsExecutable(); UpdateFile(sourceFile); } } }
public override RdUsageGroup CreateModel(IOccurrence occurrence, IOccurrenceBrowserDescriptor descriptor) { using (CompilationContextCookie.GetExplicitUniversalContextIfNotSet()) { if (occurrence is UnityAssetOccurrence assetOccurrence && !assetOccurrence.SourceFile.GetLocation().IsAsset()) { using (ReadLockCookie.Create()) { var solution = occurrence.GetSolution(); var processor = solution.GetComponent <AssetHierarchyProcessor>(); var consumer = new UnityScenePathGameObjectConsumer(); processor.ProcessSceneHierarchyFromComponentToRoot(assetOccurrence.OwningElementLocation, consumer, true, true); string name = "..."; if (consumer.NameParts.Count > 0) { name = string.Join("\\", consumer.NameParts); } return(CreateModel(name)); } } } return(EmptyModel()); }
public UnrealLinkResolver(ISolution solution, ILogger logger, ICppUE4SolutionDetector unrealEngineSolutionDetector) { _solution = solution; _logger = logger; _unrealEngineSolutionDetector = unrealEngineSolutionDetector; var solutionDirectory = _solution.SolutionDirectory; _ue4SourcesPath = new Lazy <VirtualFileSystemPath>(() => { using (ReadLockCookie.Create()) { return(unrealEngineSolutionDetector.UE4SourcesPath); } }); _possiblePaths = new Lazy <List <VirtualFileSystemPath> >(() => new List <VirtualFileSystemPath> { _ue4SourcesPath.Value, _ue4SourcesPath.Value.Parent, _ue4SourcesPath.Value / "Content", _ue4SourcesPath.Value / "Content" / "Editor", _ue4SourcesPath.Value / "Content" / "Editor" / "Slate", // FSlateStyleSet::ContentRootDir _ue4SourcesPath.Value / "Plugins", solutionDirectory, solutionDirectory / "Content", solutionDirectory / "Plugins" }); }
public override string ToString() { using (ReadLockCookie.Create()) { using (CompilationContextCookie.GetExplicitUniversalContextIfNotSet()) { var de = DeclaredElementPointer.FindDeclaredElement(); if (de == null) { return("INVALID"); } if (IsRelatedToScriptableObject()) { var value = InspectorVariableUsage.Value.GetFullPresentation(GetSolution(), DeclaredElementPointer.FindDeclaredElement(), true); return($"{de.ShortName} = {value}"); } else { var value = InspectorVariableUsage.Value.GetPresentation(GetSolution(), DeclaredElementPointer.FindDeclaredElement(), true); return($"{de.ShortName} = {value}"); } } } }
public override IEnumerable <QuickFixTreeNodeDocumentRange> GetTreeNodeDocumentRanges(IFile file) { using (ReadLockCookie.Create()) { var explicitLineContinuations = file.ThisAndDescendants() .OfType <ITokenNode>() .ToEnumerable() .Where(node => node.GetTokenType() == VBTokenType.LINE_CONTINUATION) .ToList(); foreach (var lineContinuation in explicitLineContinuations) { var previousToken = lineContinuation.GetPreviousMeaningfulToken(); var nextToken = lineContinuation.GetNextMeaningfulToken(); if (previousToken == null || nextToken == null) { continue; } var canUseImplicitLineContinuation = VBImplicitLineContinuationHelper.CanUseImplicitLineContinuationBetween(previousToken, nextToken); if (!canUseImplicitLineContinuation) { continue; } var documentRange = lineContinuation.GetDocumentRange(); yield return(new QuickFixTreeNodeDocumentRange(lineContinuation, documentRange)); } } }
public void Explore(IProject project, IMetadataAssembly assembly, IUnitTestElementsObserver observer, CancellationToken cancellationToken) { // TODO: ILMerge / embedded reference //if (!referencedAssemblies.Any(x => x.StartsWith("TestFx"))) var frameworkPrefix = typeof(IRootRunner).Assembly.GetName().Name; var referencedAssemblies = assembly.ReferencedAssembliesNames.Select(x => x.Name); if (!referencedAssemblies.Any(x => x.StartsWith(frameworkPrefix))) { return; } using (ReadLockCookie.Create()) { var testAssembly = assembly.ToTestAssembly(project, notInterrupted: () => !cancellationToken.IsCancellationRequested); if (testAssembly == null) { return; } var testElements = testAssembly.TestMetadatas.Select(_testElementFactory.GetOrCreateClassTestElementRecursively); var allTestElements = testElements.SelectMany(x => x.DescendantsAndSelf(y => y.Children)).ToList(); foreach (var testElement in allTestElements) { observer.OnUnitTestElement(testElement); observer.OnUnitTestElementChanged(testElement); } observer.OnCompleted(); } }
public void OnClick() { using (ReadLockCookie.Create()) { NavigateTo(registrationInfo.Registration.RegistrationElement); } }
public void Explore(IProject project, IMetadataAssembly assembly, Action <IUnitTestElement> consumer, Func <bool> notInterrupted) { // TODO: ILMerge / embedded reference //if (!referencedAssemblies.Any(x => x.StartsWith("TestFx"))) var frameworkPrefix = typeof(IRootRunner).Assembly.GetName().Name; var referencedAssemblies = assembly.ReferencedAssembliesNames.Select(x => x.Name); if (!referencedAssemblies.Any(x => x.StartsWith(frameworkPrefix))) { return; } using (ReadLockCookie.Create()) { var testAssembly = assembly.ToTestAssembly(project, notInterrupted); if (testAssembly == null) { return; } var testElements = testAssembly.TestMetadatas.Select(_testElementFactory.GetOrCreateClassTestElementRecursively); var allTestElements = testElements.SelectMany(x => x.DescendantsAndSelf(y => y.Children)).ToList(); Debug.Assert(allTestElements.Count > 0, "No tests found."); allTestElements.ForEach(consumer); } }
public override IEnumerable <QuickFixTreeNodeDocumentRange> GetTreeNodeDocumentRanges(IFile file) { using (ReadLockCookie.Create()) { foreach (var binaryExpression in file.ThisAndDescendants().OfType <IVBBinaryExpression>()) { if (!(binaryExpression is ILogicalAndExpression || binaryExpression is ILogicalOrExpression)) { continue; } if (binaryExpression.LeftExpr == null || binaryExpression.RightExpr == null) { continue; } if (!binaryExpression.LeftExpr.Type().IsBool() || !binaryExpression.RightExpr.Type().IsBool()) { continue; } var logicalOperator = binaryExpression.Children <ITokenNode>() .FirstOrDefault(node => node.GetTokenType() == VBTokenType.OR_KEYWORD || node.GetTokenType() == VBTokenType.AND_KEYWORD); if (logicalOperator == null) { continue; } var documentRange = logicalOperator.GetDocumentRange(); yield return(new QuickFixTreeNodeDocumentRange(logicalOperator, documentRange)); } } }
public void CreateRequestToUnity([NotNull] IDeclaredElement declaredElement, IPsiSourceFile selectedSourceFile, string selectAnchor, bool focusUnity) { var finder = mySolution.GetPsiServices().AsyncFinder; var consumer = new UnityUsagesFinderConsumer(myUnitySceneDataLocalCache, mySolutionDirectoryPath); var selectRequest = (selectedSourceFile == null || selectAnchor == null) ? null : CreateRequest(mySolutionDirectoryPath, myUnitySceneDataLocalCache, selectAnchor, selectedSourceFile, false); var lifetimeDef = myLifetime.CreateNested(); var pi = new ProgressIndicator(myLifetime); if (myBackgroundTaskHost != null) { var task = RiderBackgroundTaskBuilder.Create() .WithTitle("Finding usages in Unity for: " + declaredElement.ShortName) .AsIndeterminate() .AsCancelable(() => { pi.Cancel(); }) .Build(); myBackgroundTaskHost.AddNewTask(lifetimeDef.Lifetime, task); } myLocks.Tasks.StartNew(myLifetime, Scheduling.MainGuard, () => { using (ReadLockCookie.Create()) { finder.FindAsync(new[] { declaredElement }, myYamlSearchDomain, consumer, SearchPattern.FIND_USAGES, pi, FinderSearchRoot.Empty, new UnityUsagesAsyncFinderCallback(lifetimeDef, myLifetime, consumer, myUnityHost, myEditorProtocol, myLocks, declaredElement.ShortName, selectRequest, focusUnity)); } }); }
public bool IsSupported(IProject project, TargetFrameworkId targetFrameworkId) { using (ReadLockCookie.Create()) { return(ReferencedAssembliesService.IsProjectReferencingAssemblyByName(project, targetFrameworkId, MSpecReferenceName, out AssemblyNameInfo _)); } }
public static List <HighlightingInfo> HighlightingsFromStackTraces( [NotNull] IPersistentIndexManager persistentIndexManager, IDocument thisDocument, IEnumerable <IEnumerable <Statement> > stackTraces) { var highlightings = stackTraces.Select(stackTrace => stackTrace.ToList()) .Select(stackTrace => { var frame = stackTrace.Last(); var range = LocationToDocumentRange(persistentIndexManager, frame.Location); if (!range.IsValid()) { return(null); } if (range.Document.Equals(thisDocument)) { using (ReadLockCookie.Create()) { return(CreateHighlightingInfo(persistentIndexManager, range, stackTrace)); } } return(null); }) .WhereNotNull(); return(highlightings.ToList()); }
public void ExploreAssembly( IProject project, IMetadataAssembly metadataAssembly, UnitTestElementConsumer consumer, ManualResetEvent exitEvent) { using (ReadLockCookie.Create()) { if (project.GetModuleReferences().All(module => module.Name != "Fixie")) { return; } foreach (var metadataTypeInfo in GetExportedTypes(metadataAssembly.GetTypes())) { bool isTestClass = ExploreType(project, metadataAssembly, consumer, metadataTypeInfo); if (isTestClass) { foreach (var metadataMethod in metadataTypeInfo.GetMethods()) { ExploreMethod(project, metadataAssembly, consumer, metadataMethod); } } } } }
private bool EvalTestPartPredicate(IDeclaredElement element, Predicate <TestPart> predicate) { #if RESHARPER_45_OR_NEWER using (ReadLockCookie.Create()) #endif { if (!element.IsValid()) { return(false); } try { PsiReflectionPolicy reflectionPolicy = new PsiReflectionPolicy(element.GetManager()); ICodeElementInfo elementInfo = reflectionPolicy.Wrap(element); if (elementInfo == null) { return(false); } ITestDriver driver = CreateTestDriver(); IList <TestPart> testParts = driver.GetTestParts(reflectionPolicy, elementInfo); return(GenericCollectionUtils.Exists(testParts, predicate)); } catch (Exception ex) { HandleEmbeddedProcessCancelledException(ex); throw; } } }
private void FindTextual( [NotNull] string searchText, [NotNull] ISolution solution, [NotNull] List <IOccurence> consumer, [NotNull] CheckForInterrupt checkCanceled) { #if RESHARPER8 using (var pool = new MultiCoreFibersPool(GoToWordPoolName, myShellLocks, myConfigurations)) using (var fibers = pool.Create("Files scan for textual occurances")) #elif RESHARPER81 || RESHARPER9 using (var fibers = myTaskHost.CreateBarrier( myLifetime, checkCanceled, sync: false, takeReadLock: false)) #endif { foreach (var psiSourceFile in GetAllSolutionFiles(solution)) { if (IsFilteredFile(psiSourceFile)) { continue; } var sourceFile = psiSourceFile; fibers.EnqueueJob(() => { using (ReadLockCookie.Create()) { SearchInFile(searchText, sourceFile, consumer, checkCanceled); } }); if (checkCanceled()) { return; } } } }
private void FindTextual([NotNull] string searchText, [NotNull] ISolution solution, [NotNull] List <IOccurence> consumer, [NotNull] Func <bool> checkCanceled) { using (var fibers = myTaskHost.CreateBarrier(myLifetime, checkCanceled, sync: false, takeReadLock: false)) { foreach (var psiSourceFile in GetAllSolutionFiles(solution)) { if (IsFilteredFile(psiSourceFile)) { continue; } var sourceFile = psiSourceFile; fibers.EnqueueJob(() => { using (ReadLockCookie.Create()) { SearchInFile(searchText, sourceFile, consumer, checkCanceled); } }); if (checkCanceled()) { return; } } } }
private List <HandlerCompletionItem> DetermineHandlers(ISolution solution) { var handlers = new List <HandlerCompletionItem>(); using (ReadLockCookie.Create()) { var projects = solution.GetAllProjects(); foreach (var project in projects) { if (!LambdaFinder.IsLambdaProjectType(project)) { continue; } var psiModules = project.GetPsiModules(); foreach (var psiModule in psiModules) { using (CompilationContextCookie.OverrideOrCreate(psiModule.GetContextFromModule())) { var scope = _symbolCache.GetSymbolScope(psiModule, false, true); var namespaces = scope.GlobalNamespace.GetNestedNamespaces(scope); foreach (var @namespace in namespaces) { ProcessNamespace(@namespace, scope, handlers); } } } } } return(handlers); }
public AssemblyExplorer(MSpecUnitTestProvider provider, #if RESHARPER_61 IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, #endif IMetadataAssembly assembly, IProject project, UnitTestElementConsumer consumer) { _assembly = assembly; _consumer = consumer; using (ReadLockCookie.Create()) { var projectEnvoy = new ProjectModelElementEnvoy(project); var cache = new ContextCache(); #if RESHARPER_61 _contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, _assembly.Location.FullPath, cache); _contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); _behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache); _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy); #else #if RESHARPER_6 _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location.FullPath, cache); #else _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location, cache); #endif _contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache); _behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache); _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy); #endif } }
// Omitting CommitAllDocuments causes races between caches and assembly resolver protected virtual void CreateOrUpdateData([NotNull] IT4File t4File) { Locks.ExecuteOrQueueEx("T4 assembly reference invalidation", () => { using var cookie = ReadLockCookie.Create(); PsiFiles.ExecuteAfterCommitAllDocuments(() => DoInvalidateAssemblies(t4File)); }); }
public void Execute(IDataContext context, DelegateExecute nextExecute) { using (ReadLockCookie.Create()) { PsiFiles.CommitAllDocuments(); ShowLocations(Tracker.EditLocations, Tracker.CurrentEdit, "Recent Edits", true); } }
// todo: rewrite private static void SetShowInFindResultsAction( [NotNull] GotoWordIndexController controller, [NotNull] LifetimeDefinition definition, [NotNull] IShellLocks shellLocks, [NotNull] UITaskExecutor taskExecutor) { controller.FuncEtcItemExecute.Value = () => shellLocks.ExecuteOrQueueReadLock("ShowInFindResults", () => { var filterString = controller.Model.FilterText.Value; if (string.IsNullOrEmpty(filterString)) { return; } definition.Terminate(); GotoWordBrowserDescriptor descriptor = null; if (taskExecutor.FreeThreaded.ExecuteTask( "Show Files In Find Results", TaskCancelable.Yes, progress => { progress.TaskName = "Collecting words matching '" + filterString + "'"; progress.Start(1); var occurrences = new List <IOccurence>(); using (ReadLockCookie.Create()) { controller.ConsumePresentableItems( filterString, -1, itemsConsumer: (items, behavior) => { foreach (var item in items) { occurrences.Add(item.Occurence); } }); } if (occurrences.Count > 0 && !progress.IsCanceled) { descriptor = new GotoWordBrowserDescriptor( controller.Solution, filterString, occurrences); } progress.Stop(); })) { if (descriptor != null) { FindResultsBrowser.ShowResults(descriptor); } } else { if (descriptor != null) { descriptor.LifetimeDefinition.Terminate(); } } }); }
private List <ChunkHashMap <IPsiSourceFile, List <ITodoItem> > > FetchAllTodoItems() #endif { using (_primaryTodoManager.Lock()) using (ReadLockCookie.Create()) { return(_primaryTodoManager.AllItems.ToList()); } }