Esempio n. 1
0
        private void AppConfigTrackerOnFileChanged(ProjectItem appConfigItem)
        {
            var newConfig = DteProjectReader.LoadSpecFlowConfigurationFromDteProject(project) ?? new SpecFlowProjectConfiguration();

            if (newConfig.Equals(SpecFlowProjectConfiguration))
            {
                return;
            }

            bool dialectServicesChanged = !newConfig.GeneratorConfiguration.FeatureLanguage.Equals(GherkinDialectServices.DefaultLanguage);

            SpecFlowProjectConfiguration = newConfig;
            this.visualStudioTracer.Trace("SpecFlow configuration changed", "VsProjectScope");
            if (SpecFlowProjectConfigurationChanged != null)
            {
                SpecFlowProjectConfigurationChanged(this, EventArgs.Empty);
            }

            if (dialectServicesChanged)
            {
                GherkinDialectServices = new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage);
                this.visualStudioTracer.Trace("default language changed", "VsProjectScope");
                if (GherkinDialectServicesChanged != null)
                {
                    GherkinDialectServicesChanged(this, EventArgs.Empty);
                }
            }
        }
Esempio n. 2
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)
        {
            SpecFlowProject specFlowProject = DteProjectReader.LoadSpecFlowProjectFromDteProject(CurrentProject);

            scanner = new RegularExpressionScanner(specFlowProject.Configuration.GeneratorConfiguration.FeatureLanguage);

            return(scanner);
        }
Esempio n. 3
0
        internal VsProjectScope(Project project, DteWithEvents dteWithEvents, GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer)
        {
            Classifications         = classifications;
            this.project            = project;
            this.visualStudioTracer = visualStudioTracer;
            //TODO: register for file changes, etc.

            parser   = new GherkinTextBufferParser(this, visualStudioTracer);
            analyzer = new GherkinScopeAnalyzer(this, visualStudioTracer);
            GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer);

            specFlowProjectConfigurationReference = new SynchInitializedInstance <SpecFlowProjectConfiguration>(() =>
                                                                                                                DteProjectReader.LoadSpecFlowConfigurationFromDteProject(project) ?? new SpecFlowProjectConfiguration());
            gherkinDialectServicesReference = new SynchInitializedInstance <GherkinDialectServices>(() =>
                                                                                                    new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage));

            appConfigTracker              = new VsProjectFileTracker(project, "App.config", dteWithEvents, visualStudioTracer);
            appConfigTracker.FileChanged += AppConfigTrackerOnFileChanged;
        }
Esempio n. 4
0
 private SpecFlowProjectConfiguration LoadConfiguration()
 {
     return(DteProjectReader.LoadSpecFlowConfigurationFromDteProject(project) ?? new SpecFlowProjectConfiguration());
 }