Beispiel #1
0
 public RoslynSyntaxClassificationServiceFactory(AbstractLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace,
                                                 ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
 {
     _roslynLspClientServiceFactory  = roslynLspClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLspClientServiceFactory));
     _remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace ?? throw new ArgumentNullException(nameof(remoteLanguageServiceWorkspace));
     _classificationTypeMap          = classificationTypeMap ?? throw new ArgumentNullException(nameof(classificationTypeMap));
     _threadingContext = threadingContext ?? throw new ArgumentNullException(nameof(threadingContext));
 }
 protected AbstractExtractInterfaceCommandHandler(IThreadingContext threadingContext)
 {
     this._threadingContext = threadingContext;
 }
 public RoslynSyntaxClassificationService(AbstractLspClientServiceFactory roslynLspClientServiceFactory, RemoteLanguageServiceWorkspace remoteLanguageServiceWorkspace, ISyntaxClassificationService originalService,
                                          ClassificationTypeMap classificationTypeMap, IExperimentationService experimentationService, IThreadingContext threadingContext)
 {
     _roslynLspClientServiceFactory  = roslynLspClientServiceFactory;
     _remoteLanguageServiceWorkspace = remoteLanguageServiceWorkspace;
     _originalService        = originalService;
     _classificationTypeMap  = classificationTypeMap;
     _experimentationService = experimentationService;
     _threadingContext       = threadingContext;
 }
Beispiel #4
0
 protected AbstractChangeSignatureCommandHandler(IThreadingContext threadingContext)
 => _threadingContext = threadingContext;
Beispiel #5
0
 internal CommitManager(ITextView textView, RecentItemsManager recentItemsManager, IThreadingContext threadingContext) : base(threadingContext)
 {
     _recentItemsManager = recentItemsManager;
     _textView           = textView;
 }
Beispiel #6
0
 public SizeToFitHelper(IThreadingContext threadingContext, IWpfDifferenceViewer diffViewer, double minWidth)
     : base(threadingContext)
 {
     _diffViewer = diffViewer;
     _minWidth   = minWidth;
 }
Beispiel #7
0
 public DocumentProvider(IThreadingContext threadingContext) : base(threadingContext)
 {
 }
 public VisualStudioAddSolutionItemService(
     IThreadingContext threadingContext)
 {
     _threadingContext   = threadingContext;
     _fileChangeTrackers = new ConcurrentDictionary <string, FileChangeTracker>(StringComparer.OrdinalIgnoreCase);
 }
Beispiel #9
0
 public RoslynFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext)
 {
 }
Beispiel #10
0
 public VisualStudioFrameworkAssemblyPathResolverFactory(IThreadingContext threadingContext, SVsServiceProvider serviceProvider)
 {
     _threadingContext = threadingContext;
     _serviceProvider  = serviceProvider;
 }
Beispiel #11
0
 public Service(IThreadingContext threadingContext, VisualStudioWorkspace workspace, IServiceProvider serviceProvider)
     : base(threadingContext, assertIsForeground: false)
 {
     _workspace       = workspace;
     _serviceProvider = serviceProvider;
 }
 public VisualStudioProjectTracker(Workspace workspace, VisualStudioProjectFactory projectFactory, IThreadingContext threadingContext)
 {
     _workspace       = workspace;
     _projectFactory  = projectFactory;
     ThreadingContext = threadingContext;
     DocumentProvider = new DocumentProvider();
 }
 public ThreadingContextTaskSchedulerProvider(IThreadingContext threadingContext)
 {
     CurrentContextScheduler = threadingContext.HasMainThread
         ? new JoinableTaskFactoryTaskScheduler(threadingContext.JoinableTaskFactory)
         : TaskScheduler.Default;
 }
Beispiel #14
0
 public RenameHandler(IThreadingContext threadingContext)
 {
     _threadingContext = threadingContext;
 }
 internal CompletionSource(ITextView textView, Lazy <IStreamingFindUsagesPresenter> streamingPresenter, IThreadingContext threadingContext)
     : base(threadingContext)
 {
     _textView           = textView;
     _streamingPresenter = streamingPresenter;
     _isDebuggerTextView = textView is IDebuggerTextView;
     _roles = textView.Roles.ToImmutableHashSet();
 }
Beispiel #16
0
 public CSharpFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext)
 {
 }
Beispiel #17
0
        public static Task SizeToFitAsync(this IWpfDifferenceViewer diffViewer, IThreadingContext threadingContext, double minWidth = 400.0, CancellationToken cancellationToken = default)
        {
            var helper = new SizeToFitHelper(threadingContext, diffViewer, minWidth);

            return(helper.SizeToFitAsync(cancellationToken));
        }
Beispiel #18
0
 public VisualBasicFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext)
 {
 }
Beispiel #19
0
 public AbstractLiveShareHandlerOnMainThreadShim(IEnumerable <Lazy <IRequestHandler, IRequestHandlerMetadata> > requestHandlers, string methodName, IThreadingContext threadingContext) : base(requestHandlers, methodName)
 {
     _threadingContext = threadingContext;
 }
Beispiel #20
0
 public TypeScriptFindAllReferencesHandler(IThreadingContext threadingContext) : base(threadingContext)
 {
 }
 public HACK_AbstractCreateServicesOnUiThread(IThreadingContext threadingContext, IServiceProvider serviceProvider, string languageName)
     : base(threadingContext)
 {
     _componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
     _languageName   = languageName;
 }
Beispiel #22
0
 internal CompletionSource(ITextView textView, IThreadingContext threadingContext) : base(threadingContext)
 {
     _textView           = textView;
     _isDebuggerTextView = textView is IDebuggerTextView;
     _roles = textView.Roles.ToImmutableHashSet();
 }
Beispiel #23
0
        public AbstractLegacyProject(
            string projectSystemName,
            IVsHierarchy hierarchy,
            string language,
            IServiceProvider serviceProvider,
            IThreadingContext threadingContext,
            string externalErrorReportingPrefix,
            HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt,
            ICommandLineParserService commandLineParserServiceOpt)
            : base(threadingContext)
        {
            Contract.ThrowIfNull(hierarchy);

            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

            Workspace = componentModel.GetService <VisualStudioWorkspace>();

            var projectFilePath = hierarchy.TryGetProjectFilePath();

            if (projectFilePath != null && !File.Exists(projectFilePath))
            {
                projectFilePath = null;
            }

            if (projectFilePath != null)
            {
                _projectDirectory = Path.GetDirectoryName(projectFilePath);
            }

            var projectFactory = componentModel.GetService <VisualStudioProjectFactory>();

            VisualStudioProject = projectFactory.CreateAndAddToWorkspace(
                projectSystemName,
                language,
                new VisualStudioProjectCreationInfo
            {
                // The workspace requires an assembly name so we can make compilations. We'll use
                // projectSystemName because they'll have a better one eventually.
                AssemblyName = projectSystemName,
                FilePath     = projectFilePath,
                Hierarchy    = hierarchy,
                ProjectGuid  = GetProjectIDGuid(hierarchy),
            });

            ((VisualStudioWorkspaceImpl)Workspace).AddProjectRuleSetFileToInternalMaps(
                VisualStudioProject,
                () => VisualStudioProjectOptionsProcessor.EffectiveRuleSetFilePath);

            // Right now VB doesn't have the concept of "default namespace". But we conjure one in workspace
            // by assigning the value of the project's root namespace to it. So various feature can choose to
            // use it for their own purpose.
            // In the future, we might consider officially exposing "default namespace" for VB project
            // (e.g. through a <defaultnamespace> msbuild property)
            VisualStudioProject.DefaultNamespace = GetRootNamespacePropertyValue(hierarchy);

            Hierarchy = hierarchy;
            ConnectHierarchyEvents();
            RefreshBinOutputPath();

            // TODO: remove this terrible hack, which is working around shims throwing in not-good ways
            try
            {
                _externalErrorReporter  = new ProjectExternalErrorReporter(VisualStudioProject.Id, externalErrorReportingPrefix, (VisualStudioWorkspaceImpl)Workspace);
                _editAndContinueProject = new VsENCRebuildableProjectImpl(Workspace, VisualStudioProject, serviceProvider);
            }
            catch (Exception)
            {
            }

            _batchScopeCreator = componentModel.GetService <SolutionEventsBatchScopeCreator>();
            _batchScopeCreator.StartTrackingProject(VisualStudioProject, Hierarchy);
        }
 public CommitManagerProvider(IThreadingContext threadingContext, RecentItemsManager recentItemsManager)
 {
     _threadingContext   = threadingContext;
     _recentItemsManager = recentItemsManager;
 }
Beispiel #25
0
 public KeybindingResetDetector(IThreadingContext threadingContext, VisualStudioWorkspace workspace, SVsServiceProvider serviceProvider)
     : base(threadingContext)
 {
     _workspace       = workspace;
     _serviceProvider = serviceProvider;
 }
 public VisualStudioProjectTelemetryService(VisualStudioWorkspaceImpl workspace, IThreadingContext threadingContext) : base(threadingContext)
     => _workspace = workspace;
Beispiel #27
0
 public ActiveStatementTaggerProvider(
     IThreadingContext threadingContext,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, listenerProvider.GetListener(FeatureAttribute.Classification))
 {
 }
 public PreviewPaneService(IThreadingContext threadingContext, SVsServiceProvider serviceProvider)
     : base(threadingContext)
 {
     _uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
 }
Beispiel #29
0
 public CSharpLspEditorClassificationFactoryService(CSharpLspClientServiceFactory csharpLspClientServiceFactory,
                                                    ClassificationTypeMap classificationTypeMap, IThreadingContext threadingContext)
     : base(csharpLspClientServiceFactory, classificationTypeMap, threadingContext)
 {
 }
        public AbstractLegacyProject(
            string projectSystemName,
            IVsHierarchy hierarchy,
            string language,
            bool isVsIntellisenseProject,
            IServiceProvider serviceProvider,
            IThreadingContext threadingContext,
            string externalErrorReportingPrefix)
            : base(threadingContext, assertIsForeground: true)
        {
            Contract.ThrowIfNull(hierarchy);

            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

            Workspace = componentModel.GetService <VisualStudioWorkspace>();
            var workspaceImpl = (VisualStudioWorkspaceImpl)Workspace;

            var projectFilePath = hierarchy.TryGetProjectFilePath();

            if (projectFilePath != null && !File.Exists(projectFilePath))
            {
                projectFilePath = null;
            }

            if (projectFilePath != null)
            {
                _projectDirectory = Path.GetDirectoryName(projectFilePath);
            }

            if (isVsIntellisenseProject)
            {
                // IVsIntellisenseProjects are usually used for contained language cases, which means these projects don't have any real
                // output path that we should consider. Since those point to the same IVsHierarchy as another project, we end up with two projects
                // with the same output path, which potentially breaks conversion of metadata references to project references. However they're
                // also used for database projects and a few other cases where there there isn't a "primary" IVsHierarchy.
                // As a heuristic here we'll ignore the output path if we already have another project tied to the IVsHierarchy.
                foreach (var projectId in Workspace.CurrentSolution.ProjectIds)
                {
                    if (Workspace.GetHierarchy(projectId) == hierarchy)
                    {
                        _ignoreOutputPath = true;
                        break;
                    }
                }
            }

            var projectFactory = componentModel.GetService <VisualStudioProjectFactory>();

            VisualStudioProject = threadingContext.JoinableTaskFactory.Run(() => projectFactory.CreateAndAddToWorkspaceAsync(
                                                                               projectSystemName,
                                                                               language,
                                                                               new VisualStudioProjectCreationInfo
            {
                // The workspace requires an assembly name so we can make compilations. We'll use
                // projectSystemName because they'll have a better one eventually.
                AssemblyName = projectSystemName,
                FilePath     = projectFilePath,
                Hierarchy    = hierarchy,
                ProjectGuid  = GetProjectIDGuid(hierarchy),
            },
                                                                               CancellationToken.None));

            workspaceImpl.AddProjectRuleSetFileToInternalMaps(
                VisualStudioProject,
                () => VisualStudioProjectOptionsProcessor.EffectiveRuleSetFilePath);

            // Right now VB doesn't have the concept of "default namespace". But we conjure one in workspace
            // by assigning the value of the project's root namespace to it. So various feature can choose to
            // use it for their own purpose.
            // In the future, we might consider officially exposing "default namespace" for VB project
            // (e.g. through a <defaultnamespace> msbuild property)
            VisualStudioProject.DefaultNamespace = GetRootNamespacePropertyValue(hierarchy);

            if (TryGetPropertyValue(hierarchy, AdditionalPropertyNames.MaxSupportedLangVersion, out var maxLangVer))
            {
                VisualStudioProject.MaxLangVersion = maxLangVer;
            }

            if (TryGetBoolPropertyValue(hierarchy, AdditionalPropertyNames.RunAnalyzers, out var runAnayzers))
            {
                VisualStudioProject.RunAnalyzers = runAnayzers;
            }

            if (TryGetBoolPropertyValue(hierarchy, AdditionalPropertyNames.RunAnalyzersDuringLiveAnalysis, out var runAnayzersDuringLiveAnalysis))
            {
                VisualStudioProject.RunAnalyzersDuringLiveAnalysis = runAnayzersDuringLiveAnalysis;
            }

            Hierarchy = hierarchy;
            ConnectHierarchyEvents();
            RefreshBinOutputPath();

            workspaceImpl.SubscribeExternalErrorDiagnosticUpdateSourceToSolutionBuildEvents();

            _externalErrorReporter = new ProjectExternalErrorReporter(VisualStudioProject.Id, externalErrorReportingPrefix, language, workspaceImpl);
            _batchScopeCreator     = componentModel.GetService <SolutionEventsBatchScopeCreator>();
            _batchScopeCreator.StartTrackingProject(VisualStudioProject, Hierarchy);
        }