private void Initialize() { specFlowProjectConfiguration = LoadConfiguration(); gherkinDialectServices = new GherkinDialectServices(specFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage); appConfigTracker = new VsProjectFileTracker(project, "App.config", dteWithEvents, visualStudioTracer); appConfigTracker.FileChanged += AppConfigTrackerOnFileChanged; appConfigTracker.FileOutOfScope += AppConfigTrackerOnFileOutOfScope; var enableAnalysis = integrationOptionsProvider.GetOptions().EnableAnalysis; if (enableAnalysis) { featureFilesTracker = new ProjectFeatureFilesTracker(this); featureFilesTracker.Ready += FeatureFilesTrackerOnReady; bindingFilesTracker = new BindingFilesTracker(this); stepSuggestionProvider = new VsStepSuggestionProvider(this); bindingMatchService = new BindingMatchService(stepSuggestionProvider); } initialized = true; if (enableAnalysis) { stepSuggestionProvider.Initialize(); bindingFilesTracker.Initialize(); featureFilesTracker.Initialize(); bindingFilesTracker.Run(); featureFilesTracker.Run(); } }
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); } } }
public RegularExpressionScanner(CultureInfo defaultLanguage) { var dialectServices = new GherkinDialectServices(defaultLanguage); GherkinDialect gherkinDialect = dialectServices.GetDefaultDialect(); patternTable = gherkinDialect.GetKeywords().ToList().ConvertAll(x => new Regex(Regex.Escape(x))).ToArray(); }
public NoProjectScope(GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer) { GherkinTextBufferParser = new GherkinTextBufferParser(this, visualStudioTracer); GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer); SpecFlowProjectConfiguration = new SpecFlowProjectConfiguration(); GherkinDialectServices = new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage); Classifications = classifications; }
public NoProjectScope(GherkinFileEditorClassifications classifications, IVisualStudioTracer visualStudioTracer, IIntegrationOptionsProvider integrationOptionsProvider) { GherkinTextBufferParser = new GherkinTextBufferParser(this, visualStudioTracer); GherkinProcessingScheduler = new GherkinProcessingScheduler(visualStudioTracer, false); SpecFlowConfiguration = ConfigurationLoader.GetDefault(); GherkinDialectServices = new GherkinDialectServices(SpecFlowConfiguration.FeatureLanguage); Classifications = classifications; IntegrationOptionsProvider = integrationOptionsProvider; Tracer = visualStudioTracer; }
private void Initialize() { tracer.Trace("Initializing...", "VsProjectScope"); try { specFlowProjectConfiguration = LoadConfiguration(); gherkinDialectServices = new GherkinDialectServices(specFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage); appConfigTracker = new VsProjectFileTracker(project, "App.config", dteWithEvents, tracer); appConfigTracker.FileChanged += AppConfigTrackerOnFileChanged; appConfigTracker.FileOutOfScope += AppConfigTrackerOnFileOutOfScope; var enableAnalysis = integrationOptionsProvider.GetOptions().EnableAnalysis; if (enableAnalysis) { featureFilesTracker = new ProjectFeatureFilesTracker(this); featureFilesTracker.Ready += FeatureFilesTrackerOnReady; bindingFilesTracker = new BindingFilesTracker(this); stepSuggestionProvider = new VsStepSuggestionProvider(this); stepSuggestionProvider.Ready += StepSuggestionProviderOnReady; stepDefinitionMatchService = new StepDefinitionMatchServiceWithOnlySimpleTypeConverter(stepSuggestionProvider, m_objectContainer, m_runtimeConfiguration); } tracer.Trace("Initialized", "VsProjectScope"); initialized = true; if (enableAnalysis) { tracer.Trace("Starting analysis services...", "VsProjectScope"); stepSuggestionProvider.Initialize(); bindingFilesTracker.Initialize(); featureFilesTracker.Initialize(); LoadStepMap(); bindingFilesTracker.Run(); featureFilesTracker.Run(); dteWithEvents.OnBuildDone += BuildEventsOnOnBuildDone; tracer.Trace("Analysis services started", "VsProjectScope"); } else { tracer.Trace("Analysis services disabled", "VsProjectScope"); } } catch (Exception exception) { tracer.Trace("Exception: " + exception, "VsProjectScope"); } }
private void Initialize() { _tracer.Trace("Initializing...", VsProjectScopeTraceCategory); try { _specFlowConfiguration = LoadSpecFlowConfiguration(); _gherkinDialectServices = new GherkinDialectServices(_specFlowConfiguration.FeatureLanguage); InitializeConfigTrackers(); bool enableAnalysis = _integrationOptionsProvider.GetOptions().EnableAnalysis; if (enableAnalysis) { _featureFilesTracker = new ProjectFeatureFilesTracker(this); _featureFilesTracker.Ready += FeatureFilesTrackerOnReady; _bindingFilesTracker = new BindingFilesTracker(this); _stepSuggestionProvider = new VsStepSuggestionProvider(this); _stepSuggestionProvider.Ready += StepSuggestionProviderOnReady; _stepDefinitionMatchService = new StepDefinitionMatchServiceWithOnlySimpleTypeConverter(_stepSuggestionProvider); } _tracer.Trace("Initialized", VsProjectScopeTraceCategory); _initialized = true; if (enableAnalysis) { _tracer.Trace("Starting analysis services...", VsProjectScopeTraceCategory); _stepSuggestionProvider.Initialize(); _bindingFilesTracker.Initialize(); _featureFilesTracker.Initialize(); LoadStepMap(); _bindingFilesTracker.Run(); _featureFilesTracker.Run(); _dteWithEvents.OnBuildDone += BuildEventsOnOnBuildDone; _tracer.Trace("Analysis services started", VsProjectScopeTraceCategory); } else { _tracer.Trace("Analysis services disabled", VsProjectScopeTraceCategory); } } catch (Exception exception) { _tracer.Trace("Exception: " + exception, VsProjectScopeTraceCategory); } }
public string GetFeatureText(Feature feature, CultureInfo defaultLanguage = null) { defaultLanguage = defaultLanguage ?? new CultureInfo("en-US"); var dialectServices = new GherkinDialectServices(defaultLanguage); var dialect = dialectServices.GetGherkinDialect(feature); var result = new StringBuilder(); AppendHeader(defaultLanguage, dialect, result); AppendTags(result, feature.Tags); AppendFeatureLine(feature, result); AppendLine(result); if (feature.Background != null) { AppendBackgroundLine(feature.Background, result); AppendSteps(feature.Background.Steps, result); AppendLine(result); } foreach (var scenario in feature.Scenarios) { var outline = scenario as ScenarioOutline; bool isOutline = outline != null; AppendTags(result, scenario.Tags); AppendScenarioLine(result, scenario, dialect, isOutline); AppendSteps(scenario.Steps, result); AppendLine(result); if (isOutline) { foreach (var exampleSet in outline.Examples.ExampleSets) { AppendTags(result, exampleSet.Tags); AppendExampleSetLine(result, dialect, exampleSet); AppendTable(result, exampleSet.Table, indent); AppendLine(result); } } AppendLine(result); } return(result.ToString()); }
private void AppConfigTrackerOnFileChanged(ProjectItem appConfigItem) { var newConfig = LoadConfiguration(); if (newConfig.Equals(SpecFlowProjectConfiguration)) { return; } bool dialectServicesChanged = !newConfig.GeneratorConfiguration.FeatureLanguage.Equals(GherkinDialectServices.DefaultLanguage); specFlowProjectConfiguration = newConfig; OnSpecFlowProjectConfigurationChanged(); if (dialectServicesChanged) { gherkinDialectServices = new GherkinDialectServices(SpecFlowProjectConfiguration.GeneratorConfiguration.FeatureLanguage); OnGherkinDialectServicesChanged(); } }
public void Comment(string commentText, GherkinBufferSpan commentSpan) { if (GherkinDialectServices.IsLanguageLine(commentText)) { return; } var position = GetFilePosition(commentSpan.StartPosition); string trimmedComment = commentText.TrimStart(' ', '#', '\t'); position.Column += commentText.Length - trimmedComment.Length; trimmedComment = trimmedComment.Trim(); if (trimmedComment.Length == 0) { return; } featureBuilder.AddComment(trimmedComment, position); }