示例#1
0
        public UnityReferencesTracker(
            Lifetime lifetime,
            IEnumerable <IUnityReferenceChangeHandler> handlers,
            ISolution solution,
            ISolutionLoadTasksScheduler scheduler,
            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects,
            ILogger logger)
        {
            myAllProjectLifetimes = new Dictionary <IProject, Lifetime>();
            myUnityProjects       = new HashSet <IProject>();

            myHandlers = handlers.ToList();
            myLifetime = lifetime;
            myLogger   = logger;
            mySolution = solution;
            myModuleReferenceResolveSync = moduleReferenceResolveSync;
            myChangeManager = changeManager;
            myProjects      = projects;

            // At PreparePsiModules, we know what references we have, so we know if we're a Unity project. This is where
            // we'll initialise our custom PSI module. We have to initialise our PSI module before Done, or the
            // PersistentIndexManager will clean out the "orphaned" external (YAML) files and we'll have to reparse all
            // files on every startup
            scheduler.EnqueueTask(new SolutionLoadTask("Preparing Unity project", SolutionLoadTaskKinds.PreparePsiModules,
                                                       OnSolutionPreparePsiModules));
        }
        public UnityReferencesTracker(
            Lifetime lifetime,

            IEnumerable <IHandler> handlers,
            ISolution solution,

            ISolutionLoadTasksScheduler scheduler,
            IShellLocks shellLocks,

            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects,
            ILogger logger
            )
        {
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            myHandlers   = handlers.ToList();
            myLifetime   = lifetime;
            myLogger     = logger;
            mySolution   = solution;
            myShellLocks = shellLocks;
            myModuleReferenceResolveSync = moduleReferenceResolveSync;
            myChangeManager = changeManager;
            myProjects      = projects;

            scheduler.EnqueueTask(new SolutionLoadTask("Checking for Unity projects", SolutionLoadTaskKinds.Done, Register));
        }
示例#3
0
        public ProjectReferenceChangeTracker(
            Lifetime lifetime,
            ISolution solution,
            ModuleReferenceResolveSync moduleReferenceResolveSync,
            ChangeManager changeManager,
            IViewableProjectsCollection projects)
        {
            myHandlers         = new ConcurrentBag <Action <Lifetime, IProject> >();
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            mySolution         = solution;
            myChangeManager    = changeManager;
            myProjectLifetimes = new Dictionary <IProject, Lifetime>();

            myChangeManager.RegisterChangeProvider(lifetime, this);
            myChangeManager.AddDependency(lifetime, this, moduleReferenceResolveSync);

            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                myProjectLifetimes.Add(project, projectLifetime);

                if (!project.IsUnityProject())
                {
                    return;
                }

                Handle(project);
            });
        }
示例#4
0
        public PerProjectSettings(Lifetime lifetime, ISolution solution, ChangeManager changeManager,
                                  ModuleReferenceResolveSync moduleReferenceResolveSync,
                                  IViewableProjectsCollection projects,
                                  ISettingsSchema settingsSchema,
                                  SettingsStorageProvidersCollection settingsStorageProviders, IShellLocks locks,
                                  ILogger logger, InternKeyPathComponent interned,
                                  UnityProjectFileCacheProvider unityProjectFileCache)
        {
            mySolution                 = solution;
            myChangeManager            = changeManager;
            mySettingsSchema           = settingsSchema;
            mySettingsStorageProviders = settingsStorageProviders;
            myLocks    = locks;
            myLogger   = logger;
            myInterned = interned;
            myUnityProjectFileCache = unityProjectFileCache;
            myProjectMountPoints    = new Dictionary <IProject, SettingsStorageMountPoint>();
            myProjectLifetimes      = new Dictionary <IProject, Lifetime>();

            changeManager.RegisterChangeProvider(lifetime, this);
            changeManager.AddDependency(lifetime, this, moduleReferenceResolveSync);

            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                myProjectLifetimes.Add(project, projectLifetime);

                if (!project.IsUnityProject())
                {
                    return;
                }

                InitialiseProjectSettings(project);
            });
        }
示例#5
0
        public PerProjectSettings(Lifetime lifetime, IViewableProjectsCollection projects,
                                  ISettingsSchema settingsSchema,
                                  SettingsStorageProvidersCollection settingsStorageProviders, IShellLocks locks,
                                  ILogger logger, InternKeyPathComponent interned,
                                  LangVersionCacheProvider langVersionCache)
        {
            this.settingsSchema = settingsSchema;
            this.logger         = logger;
            myLangVersionCache  = langVersionCache;
            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                if (!project.IsUnityProject())
                {
                    return;
                }

                var mountPoint = CreateMountPoint(projectLifetime, project, settingsStorageProviders, locks, logger, interned);
                InitialiseSettingValues(project, mountPoint);

                // Just to make things more interesting, the langversion cache isn't
                // necessarily updated by the time we get called, so wire up a callback
                myLangVersionCache.RegisterDataChangedCallback(projectLifetime, project.ProjectFileLocation,
                                                               () => InitialiseSettingValues(project, mountPoint));
            });
        }
        public PerProjectSettings(Lifetime lifetime, IViewableProjectsCollection projects,
                                  ISettingsSchema settingsSchema,
                                  SettingsStorageProvidersCollection settingsStorageProviders, IShellLocks locks,
                                  ILogger logger, InternKeyPathComponent interned)
        {
            this.settingsSchema = settingsSchema;
            this.logger         = logger;
            projects.Projects.View(lifetime, (projectLifetime, project) =>
            {
                if (!project.HasFlavour <UnityProjectFlavor>())
                {
                    return;
                }

                var mountPoint = CreateMountPoint(projectLifetime, project, settingsStorageProviders, locks, logger, interned);
                InitNamespaceProviderSettings(mountPoint);
                InitLanguageLevelSettings(mountPoint);
            });
        }