Ejemplo n.º 1
0
        public static IRequestProgressObservable <SemanticTokensFullOrDeltaPartialResult, SemanticTokensFullOrDelta?> RequestSemanticTokensDelta(
            this ITextDocumentLanguageClient mediator, SemanticTokensDeltaParams @params, CancellationToken cancellationToken = default
            ) =>
        mediator.ProgressManager.MonitorUntil(
            @params, (partial, result) => {
            if (partial.IsDelta)
            {
                return(new SemanticTokensFullOrDelta(
                           new SemanticTokensDelta {
                    Edits = partial.Delta.Edits,
                    ResultId = result?.Delta?.ResultId ?? result?.Full?.ResultId
                }
                           ));
            }

            if (partial.IsFull)
            {
                return(new SemanticTokensFullOrDelta(
                           new SemanticTokens {
                    Data = partial.Full.Data,
                    ResultId = result?.Full?.ResultId ?? result?.Delta?.ResultId
                }
                           ));
            }

            return(new SemanticTokensFullOrDelta(new SemanticTokens()));
        }, cancellationToken
            );
Ejemplo n.º 2
0
        public override async Task <SemanticTokensFullOrDelta> Handle(SemanticTokensDeltaParams request,
                                                                      CancellationToken cancellationToken)
        {
            var result = await base.Handle(request, cancellationToken);

            return(result);
        }
Ejemplo n.º 3
0
        public SemanticTokensBuilder Edit(SemanticTokensDeltaParams @params)
        {
            if (@params.PreviousResultId == Id)
            {
                _prevData = Data;
            }

            return(new SemanticTokensBuilder(this, _legend));
        }
Ejemplo n.º 4
0
        public virtual async Task <SemanticTokensFullOrDelta> Handle(SemanticTokensDeltaParams request, CancellationToken cancellationToken)
        {
            var document = await GetSemanticTokensDocument(request, cancellationToken);

            var builder = document.Edit(request);

            await Tokenize(builder, request, cancellationToken);

            return(builder.Commit().GetSemanticTokensEdits());
        }
 public static IRequestProgressObservable <SemanticTokensFullOrDeltaPartialResult, SemanticTokensFullOrDelta?> RequestSemanticTokensDelta(
     this ITextDocumentLanguageClient mediator, SemanticTokensDeltaParams @params, CancellationToken cancellationToken = default
     ) =>
 mediator.ProgressManager.MonitorUntil(
     @params, (partial, result) => {
     if (partial.IsDelta)
     {
         return(new SemanticTokensFullOrDelta(
                    new SemanticTokensDelta {
             Edits = partial.Delta !.Edits,
        public async Task <SemanticTokensFullOrDelta?> Handle(SemanticTokensDeltaParams request, CancellationToken cancellationToken)
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var edits = await _semanticTokensInfoService.GetSemanticTokensEditsAsync(request.TextDocument, request.PreviousResultId, cancellationToken);

            return(edits);
        }
        public async Task <SemanticTokensFullOrDelta?> Handle(SemanticTokensDeltaParams request, CancellationToken cancellationToken)
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var codeDocument = await TryGetCodeDocumentAsync(request.TextDocument.Uri.GetAbsolutePath(), cancellationToken);

            if (codeDocument is null)
            {
                return(null);
            }

            var edits = _semanticTokensInfoService.GetSemanticTokensEdits(codeDocument, request.PreviousResultId);

            return(edits);
        }
Ejemplo n.º 8
0
        public Task <SumType <SemanticTokens, SemanticTokensDelta> > GetTextDocumentSemanticTokensEditsAsync(SemanticTokensDeltaParams semanticTokensEditsParams, CancellationToken cancellationToken)
        {
            Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called.");

            return(RequestDispatcher.ExecuteRequestAsync <SemanticTokensDeltaParams, SumType <SemanticTokens, SemanticTokensDelta> >(Queue, Methods.TextDocumentSemanticTokensFullDeltaName,
                                                                                                                                     semanticTokensEditsParams, _clientCapabilities, ClientName, cancellationToken));
        }