public BurstCodeInsights(
     ITextControlManager textControlManager,
     IEnumerable <IBurstBulbItemsProvider> bulbProviders)
 {
     myTextControlManager = textControlManager;
     myBulbProviders      = bulbProviders;
 }
 public UnityImplicitUsageHighlightingContributor(ISolution solution, ISettingsStore settingsStore,
                                                  ITextControlManager textControlManager)
 {
     Solution           = solution;
     TextControlManager = textControlManager;
     SettingsStore      = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
 }
Exemplo n.º 3
0
        public static ITreeNode GetTreeNodeUnderCaret(DocumentManager documentManager,
                                                      ITextControlManager textControlManager)
        {
            var textControl = textControlManager.LastFocusedTextControl.Value;

            if (textControl == null)
            {
                return(null);
            }

            var projectFile = documentManager.TryGetProjectFile(textControl.Document);

            if (projectFile == null)
            {
                return(null);
            }

            var range = new TextRange(textControl.Caret.Offset());

            var psiSourceFile = projectFile.ToSourceFile().NotNull("File is null");

            var documentRange = range.CreateDocumentRange(projectFile);
            var file          = psiSourceFile.GetPsiFile(psiSourceFile.PrimaryPsiLanguage, documentRange);

            var element = file?.FindNodeAt(documentRange);

            return(element);
        }
Exemplo n.º 4
0
 public static void HandleFailureToReference(string packageLocation, ITextControlManager textControlManager, IShellLocks shellLocks)
 {
     // TODO: Wish we didn't have to do this, either
     // If we failed to install the package, it's because something has gone wrong,
     // and we don't want the rest of the process to continue. Unfortunately, ReSharper
     // doesn't display any error messages, so we'll very hackily try and find the
     // current text editor, and display a tooltip with an error message.
     // (This replicates the experience when something else goes wrong in the context
     // actions that use ModuleReferencerService.) It's not a nice thing to do, but
     // it's safe with how ReSharper uses IModuleReferencer out of the box. If anyone
     // else uses it, and we go wrong, well, fingers crossed. We should either get
     // the tooltip as expected, multiple error messages, or no error messages. Hopefully,
     // we shouldn't see this very often, although I've probably just jinxed it now...
     //
     // Ideally, ReSharper should provide a better error mechanism as part of IModuleReferencer
     if (string.IsNullOrEmpty(packageLocation))
     {
         var textControl = textControlManager.FocusedTextControl.Value;
         if (textControl != null)
         {
             var shell = Shell.Instance;
             shellLocks.Queue("Failed to import type",
                              () => shell.Components.Tooltips().ShowAtCaret(EternalLifetime.Instance,
                                                                            "Failed to add NuGet package.",
                                                                            textControl, shellLocks,
                                                                            shell.GetComponent <IActionManager>()));
         }
     }
 }
 public NuGetModuleReferencerImpl(Lifetime lifetime, ITextControlManager textControlManager, IShellLocks shellLocks, ITooltipManager tooltipManager, IActionManager actionManager)
 {
     this.lifetime = lifetime;
     this.textControlManager = textControlManager;
     this.shellLocks = shellLocks;
     this.tooltipManager = tooltipManager;
     this.actionManager = actionManager;
 }
Exemplo n.º 6
0
 public Tutorial3Checks(ISolution solution, IEditorManager editorManager, DocumentManager documentManager,
                        ITextControlManager textControlManager)
 {
     Solution           = solution;
     EditorManager      = editorManager;
     DocumentManager    = documentManager;
     TextControlManager = textControlManager;
 }
 public BurstCodeVisionProvider(ISolution solution,
                                IApplicationWideContextBoundSettingStore store,
                                UnityCodeInsightProvider codeInsightProvider, IconHost iconHost)
 {
     mySolution            = solution;
     myTextControlManager  = mySolution.GetComponent <ITextControlManager>();
     mySettingsStore       = store;
     myCodeInsightProvider = codeInsightProvider;
     myIconHost            = iconHost;
 }
 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;
 }
Exemplo n.º 9
0
 public UnityHighlightingContributor(ISolution solution, ISettingsStore settingsStore,
                                     ITextControlManager textControlManager, SolutionAnalysisService swa,
                                     PerformanceCriticalCodeCallGraphAnalyzer performanceCriticalCodeCallGraphAnalyzer)
 {
     Swa = swa;
     PerformanceAnalyzerId = performanceCriticalCodeCallGraphAnalyzer.AnalyzerId;
     Solution           = solution;
     TextControlManager = textControlManager;
     SettingsStore      = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
 }
Exemplo n.º 10
0
 public NavigationEventGenerator([NotNull] IRSEnv env,
                                 [NotNull] IMessageBus messageBus,
                                 [NotNull] IDateUtils dateUtils,
                                 [NotNull] ITextControlManager textControlManager,
                                 [NotNull] INavigationUtils navigationUtils,
                                 [NotNull] Lifetime lifetime,
                                 [NotNull] IThreading threading) : base(env, messageBus, dateUtils, textControlManager, lifetime, threading)
 {
     _navigationUtils = navigationUtils;
 }
 public UnityCommonIconProvider(ISolution solution, UnityApi unityApi,
                                IApplicationWideContextBoundSettingStore settingsStore,
                                PerformanceCriticalContextProvider performanceContextProvider,
                                IEnumerable <IPerformanceAnalysisBulbItemsProvider> menuItemProviders)
 {
     mySolution                 = solution;
     myTextControlManager       = solution.GetComponent <ITextControlManager>();
     UnityApi                   = unityApi;
     SettingsStore              = settingsStore;
     PerformanceContextProvider = performanceContextProvider;
     myMenuItemProviders        = menuItemProviders;
 }
Exemplo n.º 12
0
        protected NavigationEventGeneratorEventSubscriber([NotNull] IRSEnv env,
                                                          [NotNull] IMessageBus messageBus,
                                                          [NotNull] IDateUtils dateUtils,
                                                          [NotNull] ITextControlManager textControlManager,
                                                          [NotNull] Lifetime lifetime,
                                                          [NotNull] IThreading threading) : base(env, messageBus, dateUtils, threading)
        {
            _myLifetime         = lifetime;
            _textControlManager = textControlManager;

            AdviceOnAllTextControls();
            UnsubscribeOnTerminate();
        }
        public PreviewTabEditorManager(Lifetime lifetime, ProjectModelSynchronizer projectModelSynchronizer,
                                   IVsUIShellOpenDocument vsUiShellOpenDocument,
                                   VsDocumentManagerSynchronization vsDocumentManagerSynchronization,
                                   ITextControlManager textControlManager, IFrameFocusHelper frameFocusHelper,
                                   DocumentManager documentManager,
                                   DocumentTransactionManager documentTransactionManager,
                                   IThreading threading)
            : base(lifetime, projectModelSynchronizer, vsUiShellOpenDocument, vsDocumentManagerSynchronization,
             textControlManager, frameFocusHelper, documentManager)
        {
            this.documentTransactionManager = documentTransactionManager;
              this.threading = threading;

              previewTabRequests = 0;
        }
 public RiderUnityCommonIconProvider(ISolution solution,
                                     IApplicationWideContextBoundSettingStore settingsStore,
                                     UnityApi api,
                                     UnityCodeInsightProvider codeInsightProvider,
                                     UnitySolutionTracker solutionTracker,
                                     BackendUnityHost backendUnityHost,
                                     IconHost iconHost, PerformanceCriticalContextProvider contextProvider)
     : base(solution, api, settingsStore, contextProvider)
 {
     mySolution            = solution;
     myTextControlManager  = mySolution.GetComponent <ITextControlManager>();
     myCodeInsightProvider = codeInsightProvider;
     mySolutionTracker     = solutionTracker;
     myBackendUnityHost    = backendUnityHost;
     myIconHost            = iconHost;
 }
        public NodeUnderCaretDetector(Lifetime lifetime, ISolution solution, DocumentManager documentManager, ITextControlManager textControlManager, IShellLocks shellLocks)
        {
            Solution               = solution;
            _lifetime              = lifetime;
            _documentManager       = documentManager;
            _textControlManager    = textControlManager;
            _shellLocks            = shellLocks;
            NodeUnderCaret         = new Property <ITreeNode>("NodeUnderCaretDetector.NodeUnderCaret");
            NodeReferencedElements = new Property <IEnumerable <IDeclaredElement> >("NodeUnderCaretDetector.NodeReferencedElements");

            EventHandler caretMoved = (sender, args) =>
            {
                _shellLocks.QueueReadLock("NodeUnderCaretDetector.CaretMoved", Refresh);
            };

            lifetime.Bracket
            (
                () => _textControlManager.Legacy.CaretMoved += caretMoved,
                () => _textControlManager.Legacy.CaretMoved -= caretMoved
            );
        }
        public HighlightingTracker(Lifetime lifetime, ITextControlManager textControlManager,
                                   IDocumentMarkupManager markupManager, IViewable <IHighlightingChangeHandler> handlers)
        {
            textControlManager.TextControls.View(lifetime, (textControlLifetime, textControl) =>
            {
                var markupModel = markupManager.GetMarkupModel(textControl.Document);

                Action <DocumentMarkupModifiedEventArgs> onChanged = args =>
                {
                    Lifetimes.Using(l =>
                    {
                        handlers.View(l, (_, h) =>
                        {
                            h.OnHighlightingChanged(textControl.Document, args.Added, args.Removed, args.Modified);
                        });
                    });
                };

                markupModel.Changed += onChanged;
                textControlLifetime.AddAction(() => markupModel.Changed -= onChanged);
            });
        }
Exemplo n.º 17
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();
                }
            });
        }
 public Current(Lifetime lifetime, IShellLocks shellLocks, ContextManager contextManager, AsyncCommitService asyncCommitService, ISolution solution, ITextControlManager textControlManager, IPsiFiles psiFiles)
     : base(lifetime, shellLocks, contextManager, asyncCommitService, solution, textControlManager, psiFiles)
 {
 }
 public NuGetModuleReferencer(NuGetApi nuget, ITextControlManager textControlManager, IShellLocks shellLocks)
 {
     this.nuget = nuget;
     this.textControlManager = textControlManager;
     this.shellLocks         = shellLocks;
 }