Exemple #1
0
        /// <summary>
        /// Create and return instantiation of a parser represented by RegularExpressionScanner object.
        /// </summary>
        /// <param name="buffer">An <see cref="IVsTextLines"/> represents lines of source to parse.</param>
        /// <returns>Returns a RegularExpressionScanner object</returns>
        public override IScanner GetScanner(IVsTextLines buffer)
        {
            var configurationReader = new Vs2008SpecFlowConfigurationReader(CurrentProject, NullIdeTracer.Instance);
            var configurationHolder = configurationReader.ReadConfiguration();
            var config = new GeneratorConfigurationProvider().LoadConfiguration(configurationHolder) ??
                         new SpecFlowProjectConfiguration();

            scanner = new RegularExpressionScanner(config.GeneratorConfiguration.FeatureLanguage);

            return scanner;
        }
        private GeneratorConfiguration GenGeneratorConfig()
        {
            try
            {
                //TODO: have a "project context" where the actual confic can be read without re-loading/parsing it.
                var configurationHolder = configurationReader.ReadConfiguration();
                var config = new GeneratorConfigurationProvider().LoadConfiguration(configurationHolder);
                if (config == null)
                    return new GeneratorConfiguration();

                return config.GeneratorConfiguration;
            }
            catch (Exception exception)
            {
                tracer.Trace("Config load error: " + exception, "VsGeneratorInfoProvider");
                return new GeneratorConfiguration();
            }
        }
Exemple #3
0
        private SpecFlowProjectConfiguration LoadConfiguration()
        {
            ISpecFlowConfigurationReader configurationReader = new VsSpecFlowConfigurationReader(project, tracer); //TODO: load through DI
            IGeneratorConfigurationProvider configurationLoader = new GeneratorConfigurationProvider(); //TODO: load through DI

            try
            {
                return configurationLoader.LoadConfiguration(configurationReader.ReadConfiguration());
            }
            catch(Exception exception)
            {
                tracer.Trace("Configuration loading error: " + exception, "VsProjectScope");
                return new SpecFlowProjectConfiguration();
            }
        }