Esempio n. 1
0
        public RazorCompletionEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            RazorCompletionFactsService completionFactsService,
            TagHelperCompletionService tagHelperCompletionService,
            TagHelperDescriptionFactory tagHelperDescriptionFactory,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentResolver == null)
            {
                throw new ArgumentNullException(nameof(documentResolver));
            }

            if (completionFactsService == null)
            {
                throw new ArgumentNullException(nameof(completionFactsService));
            }

            if (tagHelperCompletionService == null)
            {
                throw new ArgumentNullException(nameof(tagHelperCompletionService));
            }

            if (tagHelperDescriptionFactory == null)
            {
                throw new ArgumentNullException(nameof(tagHelperDescriptionFactory));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher        = foregroundDispatcher;
            _documentResolver            = documentResolver;
            _completionFactsService      = completionFactsService;
            _tagHelperCompletionService  = tagHelperCompletionService;
            _tagHelperDescriptionFactory = tagHelperDescriptionFactory;
            _logger = loggerFactory.CreateLogger <RazorCompletionEndpoint>();
        }
Esempio n. 2
0
        public RazorLanguageEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            DocumentVersionCache documentVersionCache,
            RazorDocumentMappingService documentMappingService,
            RazorFormattingService razorFormattingService,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentResolver == null)
            {
                throw new ArgumentNullException(nameof(documentResolver));
            }

            if (documentVersionCache == null)
            {
                throw new ArgumentNullException(nameof(documentVersionCache));
            }

            if (documentMappingService == null)
            {
                throw new ArgumentNullException(nameof(documentMappingService));
            }

            if (razorFormattingService == null)
            {
                throw new ArgumentNullException(nameof(razorFormattingService));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher   = foregroundDispatcher;
            _documentResolver       = documentResolver;
            _documentVersionCache   = documentVersionCache;
            _documentMappingService = documentMappingService;
            _razorFormattingService = razorFormattingService;
            _logger = loggerFactory.CreateLogger <RazorLanguageEndpoint>();
        }
        public BackgroundDocumentGenerator(
            ForegroundDispatcher foregroundDispatcher,
            IEnumerable <DocumentProcessedListener> documentProcessedListeners)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentProcessedListeners == null)
            {
                throw new ArgumentNullException(nameof(documentProcessedListeners));
            }

            _foregroundDispatcher       = foregroundDispatcher;
            _documentProcessedListeners = documentProcessedListeners;
            _work = new Dictionary <string, DocumentSnapshot>(StringComparer.Ordinal);
        }
        public ProjectConfigurationStateSynchronizer(
            ForegroundDispatcher foregroundDispatcher,
            RazorProjectService projectService)
        {
            if (foregroundDispatcher is null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (projectService is null)
            {
                throw new ArgumentNullException(nameof(projectService));
            }

            _foregroundDispatcher      = foregroundDispatcher;
            _projectService            = projectService;
            _configurationToProjectMap = new Dictionary <string, string>(FilePathComparer.Instance);
        }
        public static TestProjectSnapshotManager Create(ForegroundDispatcher dispatcher)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            var services = AdhocServices.Create(
                workspaceServices: new[]
            {
                new DefaultProjectSnapshotProjectEngineFactory(new FallbackProjectEngineFactory(), ProjectEngineFactories.Factories)
            },
                razorLanguageServices: Enumerable.Empty <ILanguageService>());
            var workspace          = new AdhocWorkspace(services);
            var testProjectManager = new TestProjectSnapshotManager(dispatcher, workspace);

            return(testProjectManager);
        }
Esempio n. 6
0
        public DefaultCSharpPublisher(
            ForegroundDispatcher foregroundDispatcher,
            Lazy <ILanguageServer> server)
        {
            if (foregroundDispatcher is null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (server is null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _server = server;
            _publishedSourceText = new Dictionary <string, SourceText>(FilePathComparer.Instance);
        }
        public VisualStudioMacFileChangeTracker(
            string filePath,
            ForegroundDispatcher foregroundDispatcher)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath));
            }

            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            FilePath              = filePath;
            _normalizedFilePath   = NormalizePath(FilePath);
            _foregroundDispatcher = foregroundDispatcher;
        }
        public DefaultGeneratedDocumentPublisher(
            ForegroundDispatcher foregroundDispatcher,
            Lazy <ILanguageServer> server)
        {
            if (foregroundDispatcher is null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (server is null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _server = server;
            _publishedCSharpData = new Dictionary <string, PublishData>(FilePathComparer.Instance);
            _publishedHtmlData   = new Dictionary <string, PublishData>(FilePathComparer.Instance);
        }
        public CodeActionEndpoint(
            RazorDocumentMappingService documentMappingService,
            IEnumerable <RazorCodeActionProvider> razorCodeActionProviders,
            IEnumerable <CSharpCodeActionProvider> csharpCodeActionProviders,
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            ClientNotifierServiceBase languageServer,
            LanguageServerFeatureOptions languageServerFeatureOptions)
        {
            _documentMappingService       = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService));
            _razorCodeActionProviders     = razorCodeActionProviders ?? throw new ArgumentNullException(nameof(razorCodeActionProviders));
            _csharpCodeActionProviders    = csharpCodeActionProviders ?? throw new ArgumentNullException(nameof(csharpCodeActionProviders));
            _foregroundDispatcher         = foregroundDispatcher ?? throw new ArgumentNullException(nameof(foregroundDispatcher));
            _documentResolver             = documentResolver ?? throw new ArgumentNullException(nameof(documentResolver));
            _languageServer               = languageServer ?? throw new ArgumentNullException(nameof(languageServer));
            _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions));

            _allAvailableCodeActionNames = GetAllAvailableCodeActionNames();
        }
Esempio n. 10
0
        public RazorTextViewConnectionListener(
            RazorEditorFactoryService editorFactoryService,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (editorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(editorFactoryService));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _editorFactoryService = editorFactoryService;
            _workspace            = workspace;

            _foregroundDispatcher = workspace.Services.GetRequiredService <ForegroundDispatcher>();
        }
Esempio n. 11
0
        public DefaultVisualStudioDocumentTrackerFactory(
            TextBufferProjectService projectService,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (projectService == null)
            {
                throw new ArgumentNullException(nameof(projectService));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _projectService = projectService;
            _workspace      = workspace;

            _foregroundDispatcher = workspace.Services.GetRequiredService <ForegroundDispatcher>();
            _projectManager       = workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService <ProjectSnapshotManager>();
        }
Esempio n. 12
0
        public void HandleDocumentRenamed(string fromFilePath, string toFilePath, ITextBuffer textBuffer)
        {
            ForegroundDispatcher.AssertForegroundThread();

            if (string.Equals(fromFilePath, toFilePath, FilePathComparison.Instance))
            {
                return;
            }

            lock (_lock)
            {
                // Treat a rename as a close + reopen.
                //
                // Due to ordering issues, we could see a partial rename. This is why we need to pass the new
                // file path here.
                DocumentClosed(fromFilePath);
            }

            DocumentOpened(toFilePath, textBuffer);
        }
Esempio n. 13
0
        public DefaultVisualStudioRazorParser(
            ForegroundDispatcher dispatcher,
            VisualStudioDocumentTracker documentTracker,
            ProjectSnapshotProjectEngineFactory projectEngineFactory,
            ErrorReporter errorReporter,
            VisualStudioCompletionBroker completionBroker)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            if (documentTracker == null)
            {
                throw new ArgumentNullException(nameof(documentTracker));
            }

            if (projectEngineFactory == null)
            {
                throw new ArgumentNullException(nameof(projectEngineFactory));
            }

            if (errorReporter == null)
            {
                throw new ArgumentNullException(nameof(errorReporter));
            }

            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            _dispatcher           = dispatcher;
            _projectEngineFactory = projectEngineFactory;
            _errorReporter        = errorReporter;
            _completionBroker     = completionBroker;
            _documentTracker      = documentTracker;
            _codeDocumentRequests = new List <CodeDocumentRequest>();

            _documentTracker.ContextChanged += DocumentTracker_ContextChanged;
        }
Esempio n. 14
0
        public VisualStudioFileChangeTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher, SVsServiceProvider serviceProvider, JoinableTaskContext joinableTaskContext)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (joinableTaskContext is null)
            {
                throw new ArgumentNullException(nameof(joinableTaskContext));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _joinableTaskContext  = joinableTaskContext;
            _fileChangeService    = serviceProvider.GetService(typeof(SVsFileChangeEx)) as IVsAsyncFileChangeEx;
        }
        protected override async Task OnProjectChangedAsync()
        {
            ForegroundDispatcher.AssertBackgroundThread();

            await ExecuteWithLockAsync(async() =>
            {
                var projectProperties = DotNetProject.MSBuildProject.EvaluatedProperties;
                var projectItems      = DotNetProject.MSBuildProject.EvaluatedItems;

                if (TryGetConfiguration(projectProperties, projectItems, out var configuration))
                {
                    var hostProject = new HostProject(DotNetProject.FileName.FullPath, configuration);
                    await UpdateHostProjectUnsafeAsync(hostProject).ConfigureAwait(false);
                }
                else
                {
                    // Ok we can't find a configuration. Let's assume this project isn't using Razor then.
                    await UpdateHostProjectUnsafeAsync(null).ConfigureAwait(false);
                }
            });
        }
        public EditorDocumentManagerBase(
            ForegroundDispatcher foregroundDispatcher,
            FileChangeTrackerFactory fileChangeTrackerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (fileChangeTrackerFactory == null)
            {
                throw new ArgumentNullException(nameof(fileChangeTrackerFactory));
            }

            _foregroundDispatcher     = foregroundDispatcher;
            _fileChangeTrackerFactory = fileChangeTrackerFactory;

            _documents           = new Dictionary <DocumentKey, EditorDocument>();
            _documentsByFilePath = new Dictionary <string, List <DocumentKey> >(FilePathComparer.Instance);
            _lock = new object();
        }
        public DefaultVisualStudioRazorParserFactory(
            ICompletionBroker completionBroker,
            [Import(typeof(VisualStudioWorkspace))] Workspace workspace)
        {
            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _completionBroker = completionBroker;
            _dispatcher       = workspace.Services.GetRequiredService <ForegroundDispatcher>();
            _errorReporter    = workspace.Services.GetRequiredService <ErrorReporter>();
            var razorLanguageServices = workspace.Services.GetLanguageServices(RazorLanguage.Name);

            _templateEngineFactoryService = razorLanguageServices.GetRequiredService <TemplateEngineFactoryService>();
        }
        public VisualStudioRazorParser(ForegroundDispatcher dispatcher, ITextBuffer buffer, RazorTemplateEngine templateEngine, string filePath, ICompletionBroker completionBroker)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            if (templateEngine == null)
            {
                throw new ArgumentNullException(nameof(templateEngine));
            }

            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath));
            }

            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            _dispatcher           = dispatcher;
            TemplateEngine        = templateEngine;
            FilePath              = filePath;
            _textBuffer           = buffer;
            _completionBroker     = completionBroker;
            _textBuffer.Changed  += TextBuffer_OnChanged;
            _parser               = new BackgroundParser(templateEngine, filePath);
            _idleTimer            = new Timer(IdleDelay);
            _idleTimer.Elapsed   += Onidle;
            _parser.ResultsReady += OnResultsReady;

            _parser.Start();
        }
Esempio n. 19
0
        public DefaultProjectSnapshotManager(
            ForegroundDispatcher foregroundDispatcher,
            ErrorReporter errorReporter,
            IEnumerable <ProjectSnapshotChangeTrigger> triggers,
            Workspace workspace)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (errorReporter == null)
            {
                throw new ArgumentNullException(nameof(errorReporter));
            }

            if (triggers == null)
            {
                throw new ArgumentNullException(nameof(triggers));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _errorReporter        = errorReporter;
            _triggers             = triggers.OrderByDescending(trigger => trigger.InitializePriority).ToArray();
            Workspace             = workspace;

            _projects         = new Dictionary <string, Entry>(FilePathComparer.Instance);
            _openDocuments    = new HashSet <string>(FilePathComparer.Instance);
            _notificationWork = new Queue <ProjectChangeEventArgs>();

            for (var i = 0; i < _triggers.Length; i++)
            {
                _triggers[i].Initialize(this);
            }
        }
Esempio n. 20
0
        public DefaultVisualStudioRazorParser(
            ForegroundDispatcher dispatcher,
            VisualStudioDocumentTracker documentTracker,
            RazorTemplateEngineFactoryService templateEngineFactory,
            ErrorReporter errorReporter,
            VisualStudioCompletionBroker completionBroker)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            if (documentTracker == null)
            {
                throw new ArgumentNullException(nameof(documentTracker));
            }

            if (templateEngineFactory == null)
            {
                throw new ArgumentNullException(nameof(templateEngineFactory));
            }

            if (errorReporter == null)
            {
                throw new ArgumentNullException(nameof(errorReporter));
            }

            if (completionBroker == null)
            {
                throw new ArgumentNullException(nameof(completionBroker));
            }

            _dispatcher            = dispatcher;
            _templateEngineFactory = templateEngineFactory;
            _errorReporter         = errorReporter;
            _completionBroker      = completionBroker;
            _documentTracker       = documentTracker;

            _documentTracker.ContextChanged += DocumentTracker_ContextChanged;
        }
        public BackgroundDocumentGenerator(
            ForegroundDispatcher foregroundDispatcher,
            DocumentVersionCache documentVersionCache,
            IEnumerable <DocumentProcessedListener> documentProcessedListeners,
            ILanguageServer router,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentVersionCache == null)
            {
                throw new ArgumentNullException(nameof(documentVersionCache));
            }

            if (documentProcessedListeners == null)
            {
                throw new ArgumentNullException(nameof(documentProcessedListeners));
            }

            if (router == null)
            {
                throw new ArgumentNullException(nameof(router));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher       = foregroundDispatcher;
            _documentVersionCache       = documentVersionCache;
            _documentProcessedListeners = documentProcessedListeners;
            _router = router;
            _logger = loggerFactory.CreateLogger <BackgroundDocumentGenerator>();
            _work   = new Dictionary <string, DocumentSnapshot>(StringComparer.Ordinal);
        }
Esempio n. 22
0
        public RazorFormattingEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            RazorFormattingService razorFormattingService,
            IOptionsMonitor <RazorLSPOptions> optionsMonitor,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher is null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentResolver is null)
            {
                throw new ArgumentNullException(nameof(documentResolver));
            }

            if (razorFormattingService is null)
            {
                throw new ArgumentNullException(nameof(razorFormattingService));
            }

            if (optionsMonitor is null)
            {
                throw new ArgumentNullException(nameof(optionsMonitor));
            }

            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher   = foregroundDispatcher;
            _documentResolver       = documentResolver;
            _razorFormattingService = razorFormattingService;
            _optionsMonitor         = optionsMonitor;
            _logger = loggerFactory.CreateLogger <RazorFormattingEndpoint>();
        }
Esempio n. 23
0
        public RazorDocumentSynchronizationEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            RemoteTextLoaderFactory remoteTextLoaderFactory,
            RazorProjectService projectService,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentResolver == null)
            {
                throw new ArgumentNullException(nameof(documentResolver));
            }

            if (remoteTextLoaderFactory == null)
            {
                throw new ArgumentNullException(nameof(remoteTextLoaderFactory));
            }

            if (projectService == null)
            {
                throw new ArgumentNullException(nameof(projectService));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher    = foregroundDispatcher;
            _documentResolver        = documentResolver;
            _remoteTextLoaderFactory = remoteTextLoaderFactory;
            _projectService          = projectService;
            _logger = loggerFactory.CreateLogger <RazorDocumentSynchronizationEndpoint>();
        }
        public RazorProjectEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            RazorConfigurationResolver configurationResolver,
            RemoteTextLoaderFactory remoteTextLoaderFactory,
            RazorProjectService projectService,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (configurationResolver == null)
            {
                throw new ArgumentNullException(nameof(configurationResolver));
            }

            if (remoteTextLoaderFactory == null)
            {
                throw new ArgumentNullException(nameof(remoteTextLoaderFactory));
            }

            if (projectService == null)
            {
                throw new ArgumentNullException(nameof(projectService));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher    = foregroundDispatcher;
            _configurationResolver   = configurationResolver;
            _remoteTextLoaderFactory = remoteTextLoaderFactory;
            _projectService          = projectService;
            _logger = loggerFactory.CreateLogger <RazorProjectEndpoint>();
        }
Esempio n. 25
0
        public DefaultProjectSnapshotManager(
            ForegroundDispatcher foregroundDispatcher,
            ErrorReporter errorReporter,
            IEnumerable <ProjectSnapshotChangeTrigger> triggers,
            Workspace workspace)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (errorReporter == null)
            {
                throw new ArgumentNullException(nameof(errorReporter));
            }

            if (triggers == null)
            {
                throw new ArgumentNullException(nameof(triggers));
            }

            if (workspace == null)
            {
                throw new ArgumentNullException(nameof(workspace));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _errorReporter        = errorReporter;
            _triggers             = triggers.ToArray();
            Workspace             = workspace;

            _projects = new Dictionary <string, Entry>(FilePathComparer.Instance);

            for (var i = 0; i < _triggers.Length; i++)
            {
                _triggers[i].Initialize(this);
            }
        }
Esempio n. 26
0
        public RazorHoverEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            DocumentResolver documentResolver,
            RazorHoverInfoService hoverInfoService,
            ClientNotifierServiceBase languageServer,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher is null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (documentResolver is null)
            {
                throw new ArgumentNullException(nameof(documentResolver));
            }

            if (hoverInfoService is null)
            {
                throw new ArgumentNullException(nameof(hoverInfoService));
            }

            if (languageServer is null)
            {
                throw new ArgumentNullException(nameof(languageServer));
            }

            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _documentResolver     = documentResolver;
            _hoverInfoService     = hoverInfoService;
            _languageServer       = languageServer;
            _logger = loggerFactory.CreateLogger <RazorHoverEndpoint>();
        }
        public void DocumentOpened(uint cookie)
        {
            ForegroundDispatcher.AssertForegroundThread();

            lock (_lock)
            {
                // Casts avoid dynamic
                if ((object)(_runningDocumentTable.GetDocumentData(cookie)) is IVsTextBuffer vsTextBuffer)
                {
                    var filePath = _runningDocumentTable.GetDocumentMoniker(cookie);
                    if (!TryGetMatchingDocuments(filePath, out var documents))
                    {
                        // This isn't a document that we're interesting in.
                        return;
                    }

                    var textBuffer = _editorAdaptersFactory.GetDataBuffer(vsTextBuffer);
                    if (textBuffer == null)
                    {
                        // The text buffer has not been created yet, register to be notified when it is.
                        VsTextBufferDataEventsSink.Subscribe(vsTextBuffer, () =>
                        {
                            BufferLoaded(vsTextBuffer, filePath);
                        });

                        return;
                    }

                    // It's possible that events could be fired out of order and that this is a rename.
                    if (_documentsByCookie.ContainsKey(cookie))
                    {
                        DocumentClosed(cookie, exceptFilePath: filePath);
                    }

                    BufferLoaded(textBuffer, filePath, documents);
                }
            }
        }
Esempio n. 28
0
        public RazorProjectEndpoint(
            ForegroundDispatcher foregroundDispatcher,
            RazorProjectService projectService,
            ILoggerFactory loggerFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (projectService == null)
            {
                throw new ArgumentNullException(nameof(projectService));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _projectService       = projectService;
        }
Esempio n. 29
0
        public ProjectSnapshotWorkerQueue(ForegroundDispatcher foregroundDispatcher, DefaultProjectSnapshotManager projectManager, ProjectSnapshotWorker projectWorker)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (projectManager == null)
            {
                throw new ArgumentNullException(nameof(projectManager));
            }

            if (projectWorker == null)
            {
                throw new ArgumentNullException(nameof(projectWorker));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _projectManager       = projectManager;
            _projectWorker        = projectWorker;

            _projects = new Dictionary <string, ProjectSnapshotUpdateContext>(FilePathComparer.Instance);
        }
Esempio n. 30
0
        public ProjectSnapshotWorkerQueue(ForegroundDispatcher foregroundDispatcher, DefaultProjectSnapshotManager projectManager, ProjectSnapshotWorker projectWorker)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (projectManager == null)
            {
                throw new ArgumentNullException(nameof(projectManager));
            }

            if (projectWorker == null)
            {
                throw new ArgumentNullException(nameof(projectWorker));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _projectManager       = projectManager;
            _projectWorker        = projectWorker;

            _projects = new Dictionary <ProjectId, Project>();
        }