コード例 #1
0
        public Configuration GetProjectConfiguration(ImmutableArray <AdditionalText> additionalFiles)
        {
            lock (ProjectConfigsLock)
            {
                foreach (var file in additionalFiles)
                {
                    if (ProjectConfigs.TryGetValue(file.Path, out var projectConfiguration))
                    {
                        return(projectConfiguration);
                    }
                }

                var projectConfig = ConfigurationReader.GetProjectConfiguration(additionalFiles, out var configPath);
                if (projectConfig == null)
                {
                    return(GetBuiltInAndUserConfiguration());
                }

                var mergedConfig = new Configuration(GetBuiltInAndUserConfiguration());
                mergedConfig.MergeWith(projectConfig);
                mergedConfig.PrepareForQueries();
                ProjectConfigs[configPath] = mergedConfig;
                return(mergedConfig);
            }
        }
コード例 #2
0
        private Configuration GetBuiltInAndUserConfiguration(bool refreshUserConfig = false)
        {
            lock (ConfigurationLock)
            {
                if (refreshUserConfig == false && CachedBuiltInAndUserConfiguration != null)
                {
                    return(CachedBuiltInAndUserConfiguration);
                }

                if (CachedBuiltInAndUserConfiguration == null)
                {
                    CachedBuiltInConfiguration = ConfigurationReader.GetBuiltinConfiguration();
                }

                CachedBuiltInAndUserConfiguration = new Configuration(CachedBuiltInConfiguration);

                var userConfig = ConfigurationReader.GetUserConfiguration();
                if (userConfig != null)
                {
                    CachedBuiltInAndUserConfiguration.MergeWith(userConfig);
                }

                CachedBuiltInAndUserConfiguration.PrepareForQueries();
                return(CachedBuiltInAndUserConfiguration);
            }
        }
コード例 #3
0
        public Configuration GetBuiltInAndUserConfiguration()
        {
            var configuration = new Configuration(CachedBuiltInConfiguration.Value);

            var userConfig = Reader.GetUserConfiguration();

            if (userConfig != null)
            {
                configuration.MergeWith(userConfig);
            }

            configuration.PrepareForQueries();
            return(configuration);
        }
コード例 #4
0
        public Configuration GetProjectConfiguration(ImmutableArray <AdditionalText> additionalFiles)
        {
            var projectConfig = Reader.GetProjectConfiguration(additionalFiles, out var configPath);

            if (projectConfig == null)
            {
                return(GetBuiltInAndUserConfiguration());
            }

            var mergedConfig = new Configuration(GetBuiltInAndUserConfiguration());

            mergedConfig.MergeWith(projectConfig);
            mergedConfig.PrepareForQueries();
            return(mergedConfig);
        }
コード例 #5
0
        public Configuration GetUpdatedProjectConfiguration(ImmutableArray <AdditionalText> additionalFiles)
        {
            lock (ProjectConfigsLock)
            {
                var projectConfig = ConfigurationReader.GetProjectConfiguration(additionalFiles, out var configPath);
                if (projectConfig == null)
                {
                    return(GetBuiltInAndUserConfiguration(refreshUserConfig: true));
                }

                var mergedConfig = new Configuration(GetBuiltInAndUserConfiguration(refreshUserConfig: true));
                mergedConfig.MergeWith(projectConfig);
                mergedConfig.PrepareForQueries();
                ProjectConfigs[configPath] = mergedConfig;
                return(mergedConfig);
            }
        }