public RiderUnityImplicitUsageHighlightingContributor(ISolution solution, ITextControlManager textControlManager,
                                                       UnityCodeInsightFieldUsageProvider fieldUsageProvider, UnityCodeInsightProvider codeInsightProvider,
                                                       ISettingsStore settingsStore, ConnectionTracker connectionTracker, IconHost iconHost = null)
     : base(solution, settingsStore, textControlManager)
 {
     myFieldUsageProvider  = fieldUsageProvider;
     myCodeInsightProvider = codeInsightProvider;
     myConnectionTracker   = connectionTracker;
     myIconHost            = iconHost;
 }
Ejemplo n.º 2
0
        public RiderUnityHighlightingContributor(Lifetime lifetime, ISolution solution, ITextControlManager textControlManager,
                                                 UnityCodeInsightFieldUsageProvider fieldUsageProvider, UnityCodeInsightProvider codeInsightProvider,
                                                 ISettingsStore settingsStore, ConnectionTracker connectionTracker, SolutionAnalysisService swa, IShellLocks locks,
                                                 PerformanceCriticalCodeCallGraphAnalyzer analyzer, UnitySolutionTracker solutionTracker, UnityApi unityApi,
                                                 UnityEventHandlerReferenceCache handlerReferenceCache, IconHost iconHost = null)
            : base(solution, settingsStore, textControlManager, swa, analyzer)
        {
            myFieldUsageProvider    = fieldUsageProvider;
            myCodeInsightProvider   = codeInsightProvider;
            myConnectionTracker     = connectionTracker;
            mySolutionTracker       = solutionTracker;
            myUnityApi              = unityApi;
            myHandlerReferenceCache = handlerReferenceCache;
            myIconHost              = iconHost;
            var invalidateDaemonResultGroupingEvent = locks.GroupingEvents.CreateEvent(lifetime,
                                                                                       "UnityHiglightingContributor::InvalidateDaemonResults", TimeSpan.FromSeconds(5), Rgc.Guarded,
                                                                                       () =>
            {
                solution.GetComponent <IDaemon>().Invalidate();
            });

            myConnectionTracker.State.Change.Advise_HasNew(lifetime, value =>
            {
                var old  = value.HasOld ? value.Old : UnityEditorState.Disconnected;
                var @new = value.New;

                // disconnect -> ??? -> disconnect is rarely case, we do not check it
                // connected -> ??? -> connected is the most important case
                if (old != UnityEditorState.Disconnected && @new != UnityEditorState.Disconnected)
                {
                    invalidateDaemonResultGroupingEvent.CancelIncoming();
                }
                else if (old == UnityEditorState.Disconnected && @new != UnityEditorState.Disconnected ||
                         @new == UnityEditorState.Disconnected && old != UnityEditorState.Disconnected)
                {
                    invalidateDaemonResultGroupingEvent.FireIncoming();
                }
            });
        }