public static void ReportGeneralError(IIdeScope ideScope, string message, Exception exception)
        {
            ideScope.Logger.LogException(ideScope.MonitoringService, exception, message);
            var errorMessage = $"**{message}**{ReportErrorDialogViewModel.GENERAL_ERROR_SUFFIX}";

            ReportError(ideScope, errorMessage, exception.ToString());
        }
        public static string GetExtensionFolder(this IIdeScope ideScope)
        {
            var extensionFolder = Path.GetDirectoryName(typeof(ProjectSystemExtensions).Assembly.GetLocalCodeBase());

            Debug.Assert(extensionFolder != null);
            return(extensionFolder ?? ideScope.FileSystem.Directory.GetCurrentDirectory());
        }
        private static void ReportError(this IIdeScope ideScope, string message, string errorDetails)
        {
            var hash = Math.Abs(errorDetails.GetHashCode()).ToString();

            if (HiddenErrors.Contains(hash))
            {
                ideScope.Logger.LogVerbose($"Error hidden: {hash}");
                return;
            }

            message = message + ReportErrorDialogViewModel.ERROR_SUFFIX_TEMPLATE.Replace("{logFilePath}", DeveroomFileLogger.GetLogFile());

            var errorInfo = $"Error hash: {hash}{Environment.NewLine}{errorDetails}";

            var viewModel = new ReportErrorDialogViewModel
            {
                Message   = message,
                ErrorInfo = errorInfo,
                CopyErrorToClipboardCommand = vm =>
                {
                    ideScope.Logger.LogVerbose($"Copy to clipboard: {vm.ErrorInfo}");
                    ideScope.Actions.SetClipboardText(vm.ErrorInfo);
                }
            };

            ideScope.WindowManager.ShowDialog(viewModel);

            if (viewModel.DoNotShowThisErrorAgain)
            {
                HiddenErrors.Add(hash);
            }
        }
Beispiel #4
0
 public DeveroomCompletionSource(ITextBuffer buffer, ITagAggregator <DeveroomTag> tagAggregator, IIdeScope ideScope)
     : base("Deveroom", buffer)
 {
     _tagAggregator = tagAggregator;
     _ideScope      = ideScope;
     _project       = ideScope.GetProject(buffer);
 }
Beispiel #5
0
 public VsProjectScope(string id, Project project, IIdeScope ideScope, IVsPackageInstallerServices vsPackageInstallerServices)
 {
     _project = project;
     _vsPackageInstallerServices = vsPackageInstallerServices;
     IdeScope      = ideScope;
     ProjectFolder = VsUtils.GetProjectFolder(project);
     ProjectName   = project.Name;
     Debug.Assert(ProjectFolder != null, "VsxHelper.IsSolutionProject ensures a not-null ProjectFolder");
 }
Beispiel #6
0
        public StubProjectScope(string projectFolder, string outputAssemblyPath,
                                IIdeScope ideScope, IEnumerable <NuGetPackageReference> packageReferences, string targetFramework)
        {
            ProjectFolder      = projectFolder;
            IdeScope           = ideScope;
            OutputAssemblyPath = Path.GetFullPath(Path.Combine(ProjectFolder, outputAssemblyPath));
            _packageReferences = new List <NuGetPackageReference>(packageReferences);

            TargetFrameworkMoniker = VisualStudio.ProjectSystem.TargetFrameworkMoniker
                                     .CreateFromShortName(targetFramework).Value;
        }
 public AsyncContextMenu(ContextMenu contextMenu, IIdeScope ideScope, ContextMenuManager contextMenuManager)
 {
     _contextMenu             = contextMenu;
     _ideScope                = ideScope;
     _contextMenuManager      = contextMenuManager;
     _cancellationTokenSource = new CancellationTokenSource();
     _contextMenu.Closed     += OnMenuClosed;
     _headerMenuItem          = contextMenu.Items[0] as MenuItem;
     Debug.Assert(_headerMenuItem != null);
     _contextMenuManager.SetMenuItemIcon(_headerMenuItem, "Hourglass");
 }
        private void InitializeWithDiscoveryService(IIdeScope ideScope, IProjectScope project)
        {
            var projectSettings = _projectSettingsProvider?.GetProjectSettings();

            if (projectSettings != null && projectSettings.IsSpecFlowLibProject)
            {
                // this is the first feature file in the project
                var updatedProjectSettings = _projectSettingsProvider.CheckProjectSettings();
                if (updatedProjectSettings.IsSpecFlowTestProject)
                {
                    _discoveryService?.CheckBindingRegistry();
                }
            }

            ideScope.Logger.LogVerbose($"Creating DeveroomTagger (project: {project}, SpecFlow: {projectSettings?.GetSpecFlowVersionLabel() ?? "n/a"})");
            ideScope.MonitoringService.MonitorOpenFeatureFile(projectSettings);
        }
        public StubProjectScope(string projectFolder, string outputAssemblyPath,
                                IIdeScope ideScope, IEnumerable <NuGetPackageReference> packageReferences, string targetFramework)
        {
            ProjectFolder      = projectFolder;
            IdeScope           = ideScope;
            OutputAssemblyPath = Path.GetFullPath(Path.Combine(ProjectFolder, outputAssemblyPath));
            _packageReferences = new List <NuGetPackageReference>(packageReferences);

            if (targetFramework.StartsWith("netcoreapp"))
            {
                TargetFrameworkMoniker = $".NETCoreApp,Version=v{targetFramework.Substring("netcoreapp".Length)}";
            }
            else if (targetFramework.StartsWith("net"))
            {
                TargetFrameworkMoniker = $".NETFramework,Version=v{targetFramework[3]}.{targetFramework[4]}.{targetFramework[5]}";
            }
        }
        public DeveroomTagger(ITextBuffer buffer, IIdeScope ideScope, bool immediateParsing)
        {
            _buffer   = buffer;
            _ideScope = ideScope;
            var project = ideScope.GetProject(buffer);

            _deveroomConfigurationProvider = ideScope.GetDeveroomConfigurationProvider(project);
            _projectSettingsProvider       = project?.GetProjectSettingsProvider();
            _discoveryService = project?.GetDiscoveryService();

            InitializeWithDiscoveryService(ideScope, project);

            _deveroomTagParser = new DeveroomTagParser(ideScope.Logger, ideScope.MonitoringService);
            _actionThrottler   = new ActionThrottler(() =>
            {
                if (ideScope.IsSolutionLoaded)
                {
                    ReCalculate(buffer.CurrentSnapshot);
                }
                else
                {
                    _actionThrottler.TriggerAction(forceDelayed: true);
                }
            });

            if (immediateParsing)
            {
                _tagsCache.Invalidate();
            }
            else
            {
                _tagsCache.ReCalculate(() => new TagsCache()); //empty valid result
                _actionThrottler.TriggerAction(forceDelayed: true);
            }

            SubscribeToEvents();
        }
 public CompleteCommand(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, ICompletionBroker completionBroker, IMonitoringService monitoringService) : base(ideScope, aggregatorFactory, completionBroker, monitoringService)
 {
 }
 protected DeveroomEditorTypeCharCommandBase(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, IMonitoringService monitoringService) : base(ideScope, aggregatorFactory, monitoringService)
 {
 }
Beispiel #13
0
 public void MonitorOpenProjectSystem(string vsVersion, IIdeScope ideScope)
 {
     Monitor(new object[] { vsVersion });
 }
 public static void ReportInitError(IIdeScope ideScope, Exception exception)
 {
     ideScope.Logger.LogException(ideScope.MonitoringService, exception, "Initialization error");
     ReportError(ideScope, ReportErrorDialogViewModel.INIT_ERROR, exception.ToString());
 }
 public ProjectSystemDeveroomConfigurationProvider(IIdeScope ideScope)
 {
     _configuration = new DeveroomConfiguration(); //TODO: Load solution-level config
 }
Beispiel #16
0
 public DeveroomUrlTagger(ITextBuffer buffer, ITagAggregator <DeveroomTag> tagAggregator, IIdeScope ideScope)
     : base(buffer, tagAggregator)
 {
     _ideScope     = ideScope;
     _projectScope = ideScope.GetProject(buffer);
 }
Beispiel #17
0
 public InMemoryStubProjectScope(IIdeScope ideScope)
 {
     IdeScope = ideScope;
     Properties.AddProperty(typeof(IDeveroomConfigurationProvider), new StubDeveroomConfigurationProvider(DeveroomConfiguration));
     ((StubIdeScope)ideScope).ProjectScopes.Add(this);
 }
Beispiel #18
0
 protected CompletionCommandBase(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, ICompletionBroker completionBroker, IMonitoringService monitoringService) : base(ideScope, aggregatorFactory, monitoringService)
 {
     _completionBroker = completionBroker;
 }
Beispiel #19
0
 public StubIdeActions(IIdeScope ideScope)
 {
     _ideScope = ideScope;
 }
        public static DeveroomConfiguration GetDeveroomConfiguration(this IIdeScope ideScope, IProjectScope projectScope)
        {
            var provider = ideScope.GetDeveroomConfigurationProvider(projectScope);

            return(provider.GetConfiguration());
        }
 public void MonitorOpenProjectSystem(string vsVersion, IIdeScope ideScope)
 {
 }
 public FindStepDefinitionCommand(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, IMonitoringService monitoringService) : base(ideScope, aggregatorFactory, monitoringService)
 {
     _stepDefinitionUsageFinder = new StepDefinitionUsageFinder(ideScope.FileSystem, ideScope.Logger, ideScope.MonitoringService);
 }
Beispiel #23
0
 public DeveroomCompletionSourceProvider(IBufferTagAggregatorFactoryService aggregatorFactory, IIdeScope ideScope)
 {
     _aggregatorFactory = aggregatorFactory;
     _ideScope          = ideScope;
 }
Beispiel #24
0
 public AutoFormatTableCommand(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, IMonitoringService monitoringService) : base(ideScope, aggregatorFactory, monitoringService)
 {
 }
 public DefineStepsCommand(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, IMonitoringService monitoringService) :
     base(ideScope, aggregatorFactory, monitoringService)
 {
 }
 public static IDeveroomConfigurationProvider GetDeveroomConfigurationProvider(this IIdeScope ideScope, IProjectScope projectScope)
 {
     if (projectScope != null)
     {
         return(projectScope.GetDeveroomConfigurationProvider());
     }
     return(new ProjectSystemDeveroomConfigurationProvider(ideScope));
 }
Beispiel #27
0
 public DeveroomUrlTaggerProvider(IBufferTagAggregatorFactoryService aggregatorFactory, IIdeScope ideScope)
 {
     _aggregatorFactory = aggregatorFactory;
     _ideScope          = ideScope;
 }
 protected DeveroomEditorCommandBase(IIdeScope ideScope, IBufferTagAggregatorFactoryService aggregatorFactory, IMonitoringService monitoringService)
 {
     IdeScope          = ideScope;
     AggregatorFactory = aggregatorFactory;
     MonitoringService = monitoringService;
 }
 public SpecFlowVsCompatibilityService(IIdeScope ideScope)
 {
     _ideScope = ideScope;
 }
 public DeveroomTaggerProvider(IIdeScope ideScope, SpecFlowVsCompatibilityService compatibilityService)
 {
     _ideScope             = ideScope;
     _compatibilityService = compatibilityService;
 }