public UnityDeclarationHighlightingProviderBase(ISolution solution, SolutionAnalysisService swa, CallGraphSwaExtensionProvider callGraphSwaExtensionProvider,
                                                 SettingsStore settingsStore, PerformanceCriticalCodeCallGraphAnalyzer analyzer)
 {
     Solution = solution;
     Swa      = swa;
     CallGraphSwaExtensionProvider = callGraphSwaExtensionProvider;
     Analyzer = analyzer;
     Settings = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
 }
Example #2
0
 public UnityDeclarationHighlightingProviderBase(ISolution solution, CallGraphSwaExtensionProvider callGraphSwaExtensionProvider,
                                                 SettingsStore settingsStore, PerformanceCriticalCodeCallGraphMarksProvider marksProvider, IElementIdProvider provider)
 {
     Solution = solution;
     CallGraphSwaExtensionProvider = callGraphSwaExtensionProvider;
     MarksProvider = marksProvider;
     Settings      = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
     myProvider    = provider;
 }
Example #3
0
 public UnityCommonIconProvider(ISolution solution, SolutionAnalysisService swa, CallGraphSwaExtensionProvider callGraphSwaExtensionProvider,
                                SettingsStore settingsStore, PerformanceCriticalCodeCallGraphAnalyzer analyzer, UnityApi unityApi)
 {
     Solution = solution;
     Swa      = swa;
     CallGraphSwaExtensionProvider = callGraphSwaExtensionProvider;
     Analyzer = analyzer;
     UnityApi = unityApi;
     Settings = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
 }
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution, PluginPathsProvider pluginPathsProvider,
                                   ISettingsStore settingsStore, Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker)
        {
            myComponentLifetime   = lifetime;
            myLogger              = logger;
            myDispatcher          = dispatcher;
            myLocks               = locks;
            mySolution            = solution;
            myPluginPathsProvider = pluginPathsProvider;
            myUsageStatistics     = usageStatistics;
            myHost = host;
            myBoundSettingsStore =
                settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes = new SequentialLifetimes(lifetime);
            myUnityModel       = new Property <EditorPluginModel>(lifetime, "unityModelProperty", null)
                                 .EnsureReadonly(myReadonlyToken).EnsureThisThread();

            if (!unitySolutionTracker.IsAbleToEstablishProtocolConnectionWithUnity.Value)
            {
                return;
            }

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            var solFolder = mySolution.SolutionFilePath.Directory;

            AdviseModelData(lifetime, mySolution.GetProtocolSolution());

            // todo: consider non-Unity Solution with Unity-generated projects
            var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");

            protocolInstancePath.Directory.CreateDirectory();

            var watcher = new FileSystemWatcher();

            watcher.Path         = protocolInstancePath.Directory.FullPath;
            watcher.NotifyFilter =
                NotifyFilters.LastAccess |
                NotifyFilters.LastWrite; //Watch for changes in LastAccess and LastWrite times
            watcher.Filter = protocolInstancePath.Name;

            // Add event handlers.
            watcher.Changed += OnChanged;
            watcher.Created += OnChanged;

            watcher.EnableRaisingEvents = true; // Begin watching.

            // connect on start of Rider
            CreateProtocols(protocolInstancePath);
        }
 public UnityCommonIconProvider(ISolution solution,
                                CallGraphSwaExtensionProvider callGraphSwaExtensionProvider,
                                SettingsStore settingsStore, PerformanceCriticalCodeCallGraphMarksProvider marksProvider, UnityApi unityApi,
                                IElementIdProvider provider)
 {
     Solution = solution;
     CallGraphSwaExtensionProvider = callGraphSwaExtensionProvider;
     MarksProvider = marksProvider;
     UnityApi      = unityApi;
     Settings      = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
     myProvider    = provider;
 }
 public ReflectedReferenceProviderValidator(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISettingsStore settingsStore, ISolution solution)
 {
     var providerValidator = this;
     changeManager.Changed2.Advise(lifetime, Handler(solution, providerValidator));
     settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()))
         .GetValueProperty<MvcCustomReferencesSettings, bool>(lifetime, mvcSettings => mvcSettings.Enabled)
         .Change.Advise_NoAcknowledgement(lifetime,
             () =>
             {
                 if (lifetime.IsTerminated)
                     return;
                 shellLocks.ExecuteOrQueueReadLockEx(lifetime, "ReflectedReferenceProviderValidator", () => shellLocks.ExecuteWithWriteLock(providerValidator.FireOnChanged));
             });
 }
Example #7
0
		public TestCache(Lifetime lifetime, ISolution solution, IUnitTestingSettingsAccessor settingsAccessor,
			IShellLocks shellLocks, IPsiConfiguration psiConfiguration, ISettingsStore settingsStore,
			KarmaTestProvider testProvider, JasmineElementFactory jasmineFactory,
			IPersistentIndexManager persistentIndexManager, IJavaScriptDependencyManager javaScriptDependencyManager)
		{
			_lifetime = lifetime;
			_solution = solution;
			_settingsAccessor = settingsAccessor;
			_shellLocks = shellLocks;
			_psiConfiguration = psiConfiguration;
			_testProvider = testProvider;
			myJasmineFactory = jasmineFactory;
			_persistentIndexManager = persistentIndexManager;
			_javaScriptDependencyManager = javaScriptDependencyManager;
			_settingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()), BindToContextFlags.Normal);
			_settingsStore.Changed.Advise(lifetime, OnSettingsChange);
			Active = new Property<bool>(lifetime, "KarmaTestCache", true);
		}
        public UnityRefresher(IShellLocks locks, Lifetime lifetime, ISolution solution,
                              UnityEditorProtocol editorProtocol, ISettingsStore settingsStore,
                              ILogger logger)
        {
            myLocks          = locks;
            myLifetime       = lifetime;
            mySolution       = solution;
            myEditorProtocol = editorProtocol;
            myLogger         = logger;

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myBoundSettingsStore =
                settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
        }
Example #9
0
        public UnrealPluginInstaller(Lifetime lifetime, ILogger logger, UnrealPluginDetector pluginDetector,
                                     PluginPathsProvider pathsProvider, ISolution solution, ISettingsStore settingsStore, UnrealHost unrealHost,
                                     NotificationsModel notificationsModel, RiderBackgroundTaskHost backgroundTaskHost)
        {
            Lifetime             = lifetime;
            myLogger             = logger;
            myPathsProvider      = pathsProvider;
            mySolution           = solution;
            myUnrealHost         = unrealHost;
            myNotificationsModel = notificationsModel;
            myBackgroundTaskHost = backgroundTaskHost;
            myBoundSettingsStore =
                settingsStore.BindToContextLive(Lifetime, ContextRange.Smart(solution.ToDataContext()));
            myPluginDetector = pluginDetector;

            myPluginDetector.InstallInfoProperty.Change.Advise_NewNotNull(Lifetime, installInfo =>
            {
                mySolution.Locks.ExecuteOrQueueReadLockEx(Lifetime,
                                                          "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                          () => { HandleAutoUpdatePlugin(installInfo.New); });
            });
            BindToInstallationSettingChange();
            BindToNotificationFixAction();
        }
Example #10
0
        private static TestLinkerSettings GetSettings(ISolution solution)
        {
            var settingsStore             = solution.GetComponent <ISettingsStore>();
            var settingsOptimization      = solution.GetComponent <ISettingsOptimization>();
            var contextBoundSettingsStore = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));

            return(contextBoundSettingsStore.GetKey <TestLinkerSettings>(settingsOptimization));
        }
Example #11
0
        public UnityYamlSupport(Lifetime lifetime, YamlSupport yamlSupport, ISolution solution, ISettingsStore settingsStore)
        {
            var settings = settingsStore.BindToContextLive(lifetime,
                                                           ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()));

            IsUnityYamlParsingEnabled = settings.GetValueProperty(lifetime, (UnitySettings key) => key.IsYamlParsingEnabled);

            if (!yamlSupport.IsParsingEnabled.Value)
            {
                IsUnityYamlParsingEnabled.Value = false;
            }

            IsUnityYamlParsingEnabled.Change.Advise(lifetime, v =>
            {
                if (v.HasNew && v.New)
                {
                    yamlSupport.IsParsingEnabled.Value = true;
                    if (v.HasOld)
                    {
                        settings.SetValue((UnitySettings key) => key.ShouldApplyYamlHugeFileHeuristic, false);
                    }
                }
            });
        }
        protected static void EnableImplicitNullability(
            [NotNull] ISolution sampleSolution,
            bool enableInputParameters        = true,
            bool enableRefParameters          = true,
            bool enableOutParametersAndResult = true)
        {
            // We need to change the settings here by code, because the settings stored in the .DotSettings files aren't
            // evaluated (see https://resharper-support.jetbrains.com/hc/en-us/community/posts/206628865).
            // Note that the settings changes are cleaned in UseSampleSolution() => no reset mechanism necessary.

            var solutionSettings = sampleSolution.GetComponent <SettingsStore>()
                                   .BindToContextTransient(ContextRange.ManuallyRestrictWritesToOneContext(sampleSolution.ToDataContext()));

            // Fixate default values:
            Assert.That(solutionSettings.GetValue((ImplicitNullabilitySettings s) => s.Enabled), Is.False);
            Assert.That(solutionSettings.GetValue((ImplicitNullabilitySettings s) => s.EnableInputParameters), Is.True);
            Assert.That(solutionSettings.GetValue((ImplicitNullabilitySettings s) => s.EnableRefParameters), Is.True);
            Assert.That(solutionSettings.GetValue((ImplicitNullabilitySettings s) => s.EnableOutParametersAndResult), Is.True);

            solutionSettings.SetValue((ImplicitNullabilitySettings s) => s.Enabled, true);
            solutionSettings.SetValue((ImplicitNullabilitySettings s) => s.EnableInputParameters, enableInputParameters);
            solutionSettings.SetValue((ImplicitNullabilitySettings s) => s.EnableRefParameters, enableRefParameters);
            solutionSettings.SetValue((ImplicitNullabilitySettings s) => s.EnableOutParametersAndResult, enableOutParametersAndResult);
        }
Example #13
0
        public UnityRefresher(IShellLocks locks, Lifetime lifetime, ISolution solution, UnityEditorProtocol pluginProtocolController, ISettingsStore settingsStore)
        {
            myLocks    = locks;
            myLifetime = lifetime;
            mySolution = solution;
            myPluginProtocolController = pluginProtocolController;

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));

            myPluginProtocolController.Refresh.Advise(lifetime, Refresh);
        }
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime      = lifetime;
            myLogger        = logger;
            mySolution      = solution;
            myShellLocks    = shellLocks;
            myDetector      = detector;
            myNotifications = notifications;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);
        }
Example #15
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            ApplicationPackages applicationPackages,
            ApplicationPackagesLocallyInstalled applicationPackagesLocallyInstalled,
            IEnumerable <ApplicationPackageArtifact> packages, IDeployedPackagesExpandLocationResolver resolver)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime            = lifetime;
            myLogger              = logger;
            mySolution            = solution;
            myShellLocks          = shellLocks;
            myDetector            = detector;
            myNotifications       = notifications;
            myApplicationPackages = applicationPackages;
            myApplicationPackagesLocallyInstalled = applicationPackagesLocallyInstalled;
            myPackages = packages;
            myResolver = resolver;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);
        }
Example #16
0
        public UnityYamlSupport(Lifetime lifetime, YamlSupport yamlSupport, SolutionCaches solutionCaches, ISolution solution, ISettingsStore settingsStore)
        {
            var settings = settingsStore.BindToContextLive(lifetime,
                                                           ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()));

            IsUnityYamlParsingEnabled = settings.GetValueProperty(lifetime, (UnitySettings key) => key.IsYamlParsingEnabled);

            if (!yamlSupport.IsParsingEnabled.Value)
            {
                IsUnityYamlParsingEnabled.Value = false;
            }

            IsUnityYamlParsingEnabled.Change.Advise(lifetime, v =>
            {
                if (v.HasNew && v.New)
                {
                    yamlSupport.IsParsingEnabled.Value = true;
                    if (v.HasOld)
                    {
                        solutionCaches.PersistentProperties[UnityYamlDisableStrategy.SolutionCachesId] = false.ToString();
                    }
                }
            });
        }
        public UnrealPluginInstaller(Lifetime lifetime, ILogger logger, UnrealPluginDetector pluginDetector,
                                     PluginPathsProvider pathsProvider, ISolution solution, ISettingsStore settingsStore,
                                     IShellLocks shellLocks, UnrealHost unrealHost)
        {
            myLifetime           = lifetime;
            myLogger             = logger;
            myPathsProvider      = pathsProvider;
            myShellLocks         = shellLocks;
            myUnrealHost         = unrealHost;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myPluginDetector     = pluginDetector;

            myPluginDetector.InstallInfoProperty.Change.Advise_NewNotNull(myLifetime, installInfo =>
            {
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                      () =>
                {
                    var unrealPluginInstallInfo = installInfo.New;
                    if (unrealPluginInstallInfo.EnginePlugin.IsPluginAvailable)
                    {
                        // TODO: add install plugin to Engine
                    }
                    ;

                    if (!myBoundSettingsStore.GetValue((UnrealLinkSettings s) => s.InstallRiderLinkPlugin))
                    {
                        foreach (var installDescription in unrealPluginInstallInfo.ProjectPlugins)
                        {
                            if (installDescription.IsPluginAvailable == false ||
                                installDescription.PluginVersion != myPathsProvider.CurrentPluginVersion)
                            {
                                myUnrealHost.PerformModelAction(model => model.OnEditorModelOutOfSync());
                            }
                        }

                        return;
                    }

                    InstallPluginIfRequired(unrealPluginInstallInfo);
                });
            });
            BindToInstallationSettingChange();
            BindToNotificationFixAction();
        }
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution,
                                   ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker, IThreading threading,
                                   UnityVersion unityVersion, NotificationsModel notificationsModel,
                                   IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myComponentLifetime  = lifetime;
            myLogger             = logger;
            myDispatcher         = dispatcher;
            myLocks              = locks;
            mySolution           = solution;
            myUsageStatistics    = usageStatistics;
            myThreading          = threading;
            myUnityVersion       = unityVersion;
            myNotificationsModel = notificationsModel;
            myHostProductInfo    = hostProductInfo;
            myHost = host;
            myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes   = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionDirectory;
                AdviseModelData(lifetime);

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnChangeAction);
                // connect on start of Rider
                CreateProtocols(protocolInstancePath);
            });
        }
 public UnitySettingsSynchronizer(
     Lifetime lifetime,
     ISolution solution,
     UnityHost host,
     ISettingsStore settingsStore)
 {
     myLifetime   = lifetime;
     myHost       = host;
     myBoundStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
 }
 public GenerateUnityEventFunctionsBuilder(ISolution solution, ISettingsStore settingsStore, UnityApi unityApi)
 {
     mySolution = solution;
     myUnityApi = unityApi;
     mySettings = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
 }
 public SolutionWideWritableContextBoundSettingsStore(Lifetime lifetime, ISolution solution,
                                                      ISettingsStore settingsStore)
 {
     BoundSettingsStore = settingsStore.BindToContextLive(lifetime,
                                                          ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()));
 }
 public UnitySettingsSynchronizer(Lifetime lifetime, ISolution solution, UnityHost host,
                                  ISettingsStore settingsStore)
 {
     var boundStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
     var entry = boundStore.Schema.GetScalarEntry((UnitySettings s) => s.EnableShaderLabHippieCompletion);
     boundStore.GetValueProperty<bool>(lifetime, entry, null).Change.Advise(lifetime, args =>
     {
         if (args.HasNew)
             host.PerformModelAction(rd => rd.EnableShaderLabHippieCompletion.Value = args.New);
     });
 }
        protected override Action <ITextControl> ExecutePsiTransaction(
            [NotNull] ISolution solution,
            [NotNull] IProgressIndicator progress)
        {
            // Fetch settings
            var lifetime      = solution.GetLifetime();
            var settings      = solution.GetSettingsStore().SettingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            var stylerOptions = StylerOptionsFactory.FromSettings(
                settings,
                solution,
                _dataProvider.Project,
                _actionAppliesTo == ActionAppliesTo.File
                    ? _dataProvider.SourceFile as IPsiSourceFileWithLocation // Traverse config chain from file path
                    : null                                                   // Traverse config chain from project path
                );

            // Bail out early if needed
            if (stylerOptions.SuppressProcessing)
            {
                return(null);
            }

            // Perform styling
            var styler = new StylerService(stylerOptions);

            var psiSourceFiles =
                _actionAppliesTo == ActionAppliesTo.File ? _dataProvider.Document.GetPsiSourceFiles(solution).AsIReadOnlyList()
                    : _actionAppliesTo == ActionAppliesTo.Project ? _dataProvider.Project.GetAllProjectFiles(it => it.LanguageType.Is <XamlProjectFileType>()).SelectMany(file => file.ToSourceFiles().AsIReadOnlyList())
                        : _dataProvider.Solution.GetAllProjects().SelectMany(project => project.GetAllProjectFiles(it => it.LanguageType.Is <XamlProjectFileType>()).SelectMany(file => file.ToSourceFiles().AsIReadOnlyList()));

            foreach (var prjItem in psiSourceFiles)
            {
                foreach (var file in prjItem.GetPsiFiles <XamlLanguage>())
                {
                    var sourceFile = file.GetSourceFile();
                    if (sourceFile?.Document != null)
                    {
                        var oldText = sourceFile.Document.GetText();
                        var newText = styler.StyleDocument(oldText).Replace("\r\n", "\n");
                        file.ReParse(new TreeTextRange(new TreeOffset(0), new TreeOffset(oldText.Length)), newText);
                    }
                }
            }

            return(null);
        }
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            NotificationsModel notifications,
            ISettingsStore settingsStore,
            PluginPathsProvider pluginPathsProvider,
            UnityVersion unityVersion,
            UnityHost unityHost,
            UnitySolutionTracker unitySolutionTracker,
            UnityRefresher refresher)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime             = lifetime;
            myLogger               = logger;
            mySolution             = solution;
            myShellLocks           = shellLocks;
            myDetector             = detector;
            myNotifications        = notifications;
            myPluginPathsProvider  = pluginPathsProvider;
            myUnityVersion         = unityVersion;
            myUnitySolutionTracker = unitySolutionTracker;
            myRefresher            = refresher;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);

            unityHost.PerformModelAction(rdUnityModel =>
            {
                rdUnityModel.InstallEditorPlugin.AdviseNotNull(lifetime, x =>
                {
                    myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.InstallEditorPlugin", () =>
                    {
                        var installationInfo = myDetector.GetInstallationInfo(myCurrentVersion);
                        QueueInstall(installationInfo, true);
                    });
                });
            });

            unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args =>
            {
                if (!args)
                {
                    return;
                }
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "IsAbleToEstablishProtocolConnectionWithUnity", InstallPluginIfRequired);
                BindToInstallationSettingChange();
            });
        }
Example #25
0
        public UnityYamlDisableStrategy(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, UnityYamlSupport unityYamlSupport)
        {
            myUnityYamlSupport = unityYamlSupport;
            var boundStore = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()));

            myShouldRunHeuristic = boundStore.GetValueProperty(lifetime, (UnitySettings s) => s.ShouldApplyYamlHugeFileHeuristic);
        }
Example #26
0
        public NameSuffixLinkedTypesProvider(ISolution solution, ISettingsStore settingsStore, ISettingsOptimization settingsOptimization)
        {
            var contextBoundSettingsStore = settingsStore.BindToContextTransient(ContextRange.Smart(solution.ToDataContext()));
            var settings = contextBoundSettingsStore.GetKey <TestLinkerSettings>(settingsOptimization);

            _namingStyle    = settings.NamingStyle;
            _namingSuffixes = settings.NamingSuffixes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                              .Select(x => Pair.Of(x, x.Length))
                              .ToList();
        }
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution,
                                   ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker, IThreading threading,
                                   UnityVersion unityVersion, NotificationsModel notificationsModel,
                                   IHostProductInfo hostProductInfo)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myComponentLifetime  = lifetime;
            myLogger             = logger;
            myDispatcher         = dispatcher;
            myLocks              = locks;
            mySolution           = solution;
            myUsageStatistics    = usageStatistics;
            myThreading          = threading;
            myUnityVersion       = unityVersion;
            myNotificationsModel = notificationsModel;
            myHostProductInfo    = hostProductInfo;
            myHost = host;
            myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes   = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionDirectory;
                AdviseModelData(lifetime);

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                protocolInstancePath.Directory.CreateDirectory();

                var watcher          = new FileSystemWatcher();
                watcher.Path         = protocolInstancePath.Directory.FullPath;
                watcher.NotifyFilter = NotifyFilters.LastWrite; //Watch for changes in LastWrite times
                watcher.Filter       = protocolInstancePath.Name;

                // Add event handlers.
                watcher.Changed += OnChanged;
                watcher.Created += OnChanged;

                lf.Bracket(() => { }, () =>
                {
                    watcher.Dispose();
                });

                watcher.EnableRaisingEvents = true; // Begin watching.
                // connect on start of Rider
                CreateProtocols(protocolInstancePath);
            });
        }
Example #28
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            ProjectReferenceChangeTracker changeTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime           = lifetime;
            myLogger             = logger;
            mySolution           = solution;
            myShellLocks         = shellLocks;
            myDetector           = detector;
            myNotifications      = notifications;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));

            BindToInstallationSettingChange();

            changeTracker.RegisterProjectChangeHandler(InstallPluginIfRequired);
        }
        public AwsSettingsHost(Lifetime lifetime, [NotNull] ISolution solution, [NotNull] ISettingsStore settingsStore)
        {
            var model = solution.GetProtocolSolution().GetAwsSettingModel();

            var contextBoundSettingsStoreLive = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));

            model.ShowLambdaGutterMarks.Advise(lifetime, isEnabled =>
            {
                var entry = settingsStore.Schema.GetScalarEntry((LambdaGutterMarkSettings s) => s.Enabled);
                contextBoundSettingsStoreLive.SetValue(entry, isEnabled, null);
                solution.GetComponent <DaemonImpl>().Invalidate();
            });
        }
Example #30
0
 public TestCache(Lifetime lifetime, ISolution solution, IUnitTestingSettingsAccessor settingsAccessor,
                  IShellLocks shellLocks, IPsiConfiguration psiConfiguration, ISettingsStore settingsStore,
                  KarmaTestProvider testProvider, JasmineElementFactory jasmineFactory,
                  IPersistentIndexManager persistentIndexManager, IJavaScriptDependencyManager javaScriptDependencyManager)
 {
     _lifetime                    = lifetime;
     _solution                    = solution;
     _settingsAccessor            = settingsAccessor;
     _shellLocks                  = shellLocks;
     _psiConfiguration            = psiConfiguration;
     _testProvider                = testProvider;
     myJasmineFactory             = jasmineFactory;
     _persistentIndexManager      = persistentIndexManager;
     _javaScriptDependencyManager = javaScriptDependencyManager;
     _settingsStore               = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()), BindToContextFlags.Normal);
     _settingsStore.Changed.Advise(lifetime, OnSettingsChange);
     Active = new Property <bool>(lifetime, "KarmaTestCache", true);
 }
 public UnityHlslAllErrorsPredicate(Lifetime lifetime, ISolution solution, UnitySolutionTracker unitySolutionTracker, ISettingsStore settingsStore)
 {
     myUnitySolutionTracker = unitySolutionTracker;
     mySuppressShaderErrors = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()))
                              .GetValueProperty(lifetime, (UnitySettings key) => key.SuppressShaderErrorHighlighting);
     mySuppressShaderErrorsInRenderPipeline = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()))
                                              .GetValueProperty(lifetime, (UnitySettings key) => key.SuppressShaderErrorHighlightingInRenderPipelinePackages);
 }
        public PrefabImportCache(Lifetime lifetime, ISolution solution, ISettingsStore store, MetaFileGuidCache metaFileGuidCache, UnityExternalFilesModuleFactory unityExternalFilesModuleFactory, IShellLocks shellLocks)
        {
            myMetaFileGuidCache = metaFileGuidCache;
            myShellLocks        = shellLocks;
            metaFileGuidCache.GuidChanged.Advise(lifetime, e =>
            {
                myShellLocks.AssertWriteAccessAllowed();
                var set = new HashSet <Guid>();
                if (e.oldGuid != null)
                {
                    InvalidateImportCache(e.oldGuid.Value, set);
                }

                if (e.newGuid != null)
                {
                    InvalidateImportCache(e.newGuid.Value, set);
                }
            });

            myUnityExternalFilesPsiModule = unityExternalFilesModuleFactory.PsiModule;

            var boundSettingsStoreLive = store.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));

            myCacheEnabled = boundSettingsStoreLive.GetValueProperty(lifetime, (UnitySettings key) => key.IsPrefabCacheEnabled);
        }