private static async Task <LSP.FoldingRange[]> RunGetFoldingRangeAsync(Solution solution) { var document = solution.Projects.First().Documents.First(); var request = new LSP.FoldingRangeParams() { TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath)) }; return(await GetLanguageServer(solution).GetFoldingRangeAsync(solution, request, new LSP.ClientCapabilities(), CancellationToken.None)); }
private static async Task <LSP.FoldingRange[]> RunGetFoldingRangeAsync(TestLspServer testLspServer) { var document = testLspServer.GetCurrentSolution().Projects.First().Documents.First(); var request = new LSP.FoldingRangeParams() { TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath)) }; return(await testLspServer.ExecuteRequestAsync <LSP.FoldingRangeParams, LSP.FoldingRange[]>(LSP.Methods.TextDocumentFoldingRangeName, request, CancellationToken.None)); }
private static async Task <LSP.FoldingRange[]> RunGetFoldingRangeAsync(Solution solution) { var document = solution.Projects.First().Documents.First(); var request = new LSP.FoldingRangeParams() { TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath)) }; var queue = CreateRequestQueue(solution); return(await GetLanguageServer(solution).ExecuteRequestAsync <LSP.FoldingRangeParams, LSP.FoldingRange[]>(queue, LSP.Methods.TextDocumentFoldingRangeName, request, new LSP.ClientCapabilities(), null, CancellationToken.None)); }
/// <summary> /// Answers a folding range request by returning all folding ranges in a given document. /// https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange /// </summary> /// <param name="solution">the solution containing the document.</param> /// <param name="request">the request document.</param> /// <param name="clientCapabilities">the client capabilities for the request.</param> /// <param name="cancellationToken">a cancellation token.</param> /// <returns>a list of folding ranges in the document.</returns> public Task <LSP.FoldingRange[]> GetFoldingRangeAsync(Solution solution, LSP.FoldingRangeParams request, LSP.ClientCapabilities clientCapabilities, CancellationToken cancellationToken) => ExecuteRequestAsync <LSP.FoldingRangeParams, LSP.FoldingRange[]>(LSP.Methods.TextDocumentFoldingRangeName, solution, request, clientCapabilities, cancellationToken);