Beispiel #1
0
        public override Task <Container <SelectionRange> > Handle(SelectionRangeParam request,
                                                                  CancellationToken cancellationToken)
        {
            var workDone = ProgressManager.WorkDone(request,
                                                    new WorkDoneProgressBegin {
                Message = "Begin getting selection ranges", Percentage = 0.0
            });
            var progress   = ProgressManager.For(request, cancellationToken);
            var allResults = new List <SelectionRange>();

            int progressPosition = 0;

            foreach (var position in request.Positions)
            {
                var editorData = DResolverWrapper.CreateEditorData(new HoverParams
                {
                    Position     = position,
                    TextDocument = request.TextDocument
                }, cancellationToken);
                allResults.Add(FindIdealSelectionRange(editorData));
                progress?.OnNext(new Container <SelectionRange>(allResults));
                workDone.OnNext(new WorkDoneProgressReport
                {
                    Percentage = ((double)++progressPosition / request.Positions.Count()) * 100
                });
            }

            progress?.OnCompleted();
            workDone.OnCompleted();
            return(Task.FromResult(progress != null
                ? new Container <SelectionRange>()
                : new Container <SelectionRange>(allResults)));
        }
 public override Task <Container <SelectionRange> > Handle(SelectionRangeParam request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken);
 public abstract Task <Container <SelectionRange> > Handle(SelectionRangeParam request, CancellationToken cancellationToken);