Beispiel #1
0
        private static async Task <object[]> RunGetDocumentSymbolsAsync(
            TestLspServer testLspServer,
            bool hierarchicalSupport
            )
        {
            var document = testLspServer.GetCurrentSolution().Projects.First().Documents.First();
            var request  = new LSP.DocumentSymbolParams
            {
                TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath))
            };

            var clientCapabilities = new LSP.ClientCapabilities()
            {
                TextDocument = new LSP.TextDocumentClientCapabilities()
                {
                    DocumentSymbol = new LSP.DocumentSymbolSetting()
                    {
                        HierarchicalDocumentSymbolSupport = hierarchicalSupport
                    }
                }
            };

            return(await testLspServer.ExecuteRequestAsync <LSP.DocumentSymbolParams, object[]>(
                       LSP.Methods.TextDocumentDocumentSymbolName,
                       request,
                       clientCapabilities,
                       null,
                       CancellationToken.None
                       ));
        }
Beispiel #2
0
        private static async Task <TReturn> RunGetDocumentSymbolsAsync <TReturn>(TestLspServer testLspServer)
        {
            var document = testLspServer.GetCurrentSolution().Projects.First().Documents.First();
            var request  = new LSP.DocumentSymbolParams
            {
                TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath))
            };

            return(await testLspServer.ExecuteRequestAsync <LSP.DocumentSymbolParams, TReturn>(LSP.Methods.TextDocumentDocumentSymbolName,
                                                                                               request, CancellationToken.None));
        }
Beispiel #3
0
        private static async Task <object[]> RunGetDocumentSymbolsAsync(Solution solution, bool hierarchicalSupport)
        {
            var document = solution.Projects.First().Documents.First();
            var request  = new LSP.DocumentSymbolParams
            {
                TextDocument = CreateTextDocumentIdentifier(new Uri(document.FilePath))
            };

            var clientCapabilities = new LSP.ClientCapabilities()
            {
                TextDocument = new LSP.TextDocumentClientCapabilities()
                {
                    DocumentSymbol = new LSP.DocumentSymbolSetting()
                    {
                        HierarchicalDocumentSymbolSupport = hierarchicalSupport
                    }
                }
            };

            return(await GetLanguageServer(solution).GetDocumentSymbolsAsync(solution, request, clientCapabilities, CancellationToken.None));
        }
Beispiel #4
0
 /// <summary>
 /// Answers a document symbols request by returning a list of symbols in the document.
 /// https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol
 /// </summary>
 /// <param name="solution">the solution containing the document.</param>
 /// <param name="request">the document to get symbols from.</param>
 /// <param name="clientCapabilities">the client capabilities for the request.</param>
 /// <param name="cancellationToken">a cancellation token.</param>
 /// <returns>a list of symbols in the document.</returns>
 public Task <object[]> GetDocumentSymbolsAsync(Solution solution, LSP.DocumentSymbolParams request, LSP.ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
 => ExecuteRequestAsync <LSP.DocumentSymbolParams, object[]>(LSP.Methods.TextDocumentDocumentSymbolName, solution, request, clientCapabilities, cancellationToken);
Beispiel #5
0
 public Task <object> InvokeTextDocumentSymbolsAsync(LSP.DocumentSymbolParams request, CancellationToken cancellationToken)
 => InvokeWithParametersAsync <object>("textDocument/documentSymbol", request, cancellationToken);