public async Task <Unit> Handle(AddDocumentParams request, CancellationToken cancellationToken)
        {
            _foregroundDispatcher.AssertBackgroundThread();

            var textLoader = _remoteTextLoaderFactory.Create(request.FilePath);
            await Task.Factory.StartNew(
                () => _projectService.AddDocument(request.FilePath, textLoader),
                CancellationToken.None,
                TaskCreationOptions.None,
                _foregroundDispatcher.ForegroundScheduler);

            return(Unit.Value);
        }
Example #2
0
        public async Task <Unit> Handle(DidCloseTextDocumentParams notification, CancellationToken token)
        {
            _foregroundDispatcher.AssertBackgroundThread();

            var textLoader = _remoteTextLoaderFactory.Create(notification.TextDocument.Uri.AbsolutePath);
            await Task.Factory.StartNew(
                () => _projectService.CloseDocument(notification.TextDocument.Uri.AbsolutePath, textLoader),
                CancellationToken.None,
                TaskCreationOptions.None,
                _foregroundDispatcher.ForegroundScheduler);

            return(Unit.Value);
        }