public override Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { RhetosDocument rhetosDocument; // Visual Studio may issue hover before DidOpen if hover happens before solution is fully loaded try { rhetosDocument = rhetosWorkspace.GetRhetosDocument(request.TextDocument.Uri); } catch (InvalidOperationException) { log.LogWarning($"Trying to resolve hover on document that is not opened '{request.TextDocument.Uri}'."); return(Task.FromResult <Hover>(null)); } var descInfo = rhetosDocument.GetHoverDescriptionAtPosition(request.Position.ToLineChr()); if (string.IsNullOrEmpty(descInfo.description)) { return(Task.FromResult <Hover>(null)); } var response = new Hover() { Range = new Range(descInfo.startPosition.ToPosition(), descInfo.endPosition.ToPosition()), Contents = new MarkedStringsOrMarkupContent(descInfo.description) }; return(Task.FromResult(response)); }
public override Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var result = this.symbolResolver.ResolveSymbol(request.TextDocument.Uri, request.Position); if (result == null) { return(Task.FromResult(new Hover())); } var markdown = GetMarkdown(result); if (markdown == null) { return(Task.FromResult(new Hover())); } return(Task.FromResult <Hover>(new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkupContent { Kind = MarkupKind.Markdown, Value = markdown }), Range = PositionHelper.GetNameRange(result.Context.LineStarts, result.Origin) })); }
public async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { return(await Task.Run(() => { var hoverRanges = _languageServer.LastParse?.ScriptFromUri(request.TextDocument.Uri.ToUri())?.GetHoverRanges(); if (hoverRanges == null || hoverRanges.Length == 0) { return new Hover(); } HoverRange chosen = hoverRanges .Where(hoverRange => hoverRange.Range.IsInside(request.Position)) .OrderBy(hoverRange => hoverRange.Range) .FirstOrDefault(); if (chosen == null) { return new Hover(); } return new Hover() { Range = chosen.Range, Contents = chosen.Content }; })); }
public Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var file = WorkspaceManager.Instance.GetOrCreateByUri(request.TextDocument.Uri.ToUri()); var nodeAtLine = file.Nodes?[(int)request.Position.Line]; if (Debugger.IsAttached && nodeAtLine != null) { return(Task.FromResult(new Hover { Range = nodeAtLine.ContentRange, Contents = new MarkedStringsOrMarkupContent(new MarkupContent { Kind = MarkupKind.Markdown, Value = $@"```js{"\n"}node.type = {nodeAtLine.GetType().Name};{"\n"}{JsonConvert.SerializeObject(nodeAtLine, new JsonSerializerSettings { Converters = new List<JsonConverter> {new StringEnumConverter {NamingStrategy = new CamelCaseNamingStrategy()}}, ContractResolver = new NoFileContractResolver(), Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore })}{"\n"}```" }) })); } return(Task.FromResult(new Hover())); }
public async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var hoverRanges = _languageServer.LastParse?.ScriptFromUri(request.TextDocument.Uri.ToUri())?.GetHoverRanges(); if (hoverRanges == null || hoverRanges.Length == 0) { return(new Hover()); } HoverRange chosen = hoverRanges .Where(hoverRange => hoverRange.Range.IsInside(request.Position)) .OrderBy(hoverRange => hoverRange.Range) .FirstOrDefault(); if (chosen == null) { return(new Hover()); } return(new Hover() { Range = chosen.Range, Contents = new MarkedStringsOrMarkupContent(new MarkupContent() { Kind = MarkupKind.Markdown, Value = chosen.Content }) }); }
public async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { ScriptFile scriptFile = _workspaceService.GetFile( request.TextDocument.Uri.ToString()); SymbolDetails symbolDetails = await _symbolsService.FindSymbolDetailsAtLocationAsync( scriptFile, (int)request.Position.Line + 1, (int)request.Position.Character + 1); List <MarkedString> symbolInfo = new List <MarkedString>(); Range symbolRange = null; if (symbolDetails != null) { symbolInfo.Add(new MarkedString("PowerShell", symbolDetails.DisplayString)); if (!string.IsNullOrEmpty(symbolDetails.Documentation)) { symbolInfo.Add(new MarkedString("markdown", symbolDetails.Documentation)); } symbolRange = GetRangeFromScriptRegion(symbolDetails.SymbolReference.ScriptRegion); } return(new Hover { Contents = new MarkedStringsOrMarkupContent(symbolInfo), Range = symbolRange }); }
public override Task <Hover?> Handle(HoverParams request, CancellationToken cancellationToken) { var node = Workspace.GetNodeAt(request.TextDocument.Uri, request.Position); var lines = new List <string>(); int size; SourceSpan span; switch (node) { case PortReference portRef: if (portRef.Port.BitSize == 1) { lines.Add($"### {portRef.PortInfo.Target} index {portRef.PortInfo.StartIndex}"); } else { lines.Add($"### {portRef.PortInfo.Target} index {portRef.PortInfo.StartIndex} to {portRef.PortInfo.StartIndex + portRef.Port.BitSize - 1}"); } size = portRef.BitSize; span = portRef.Span; break; case Reference @ref: size = @ref.BitSize; span = @ref.Span; break; case Expression expr: size = expr.BitSize; span = expr.Span; break; case DeclareLocalStatement local: size = local.Local.BitSize; span = local.Span; break; default: return(Task.FromResult(null as Hover)); } if (size != 0) { lines.Add($"Size: `{size}` bits"); } return(Task.FromResult <Hover?>(new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkupContent { Kind = MarkupKind.Markdown, Value = string.Join("\n---\n", lines) }), Range = span.ToRange() })); }
private static string?GetMarkdown(HoverParams request, SymbolResolutionResult result) { // all of the generated markdown includes the language id to avoid VS code rendering // with multiple borders switch (result.Symbol) { case ImportedNamespaceSymbol import: return(CodeBlockWithDescription( $"import {import.Name}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), import.DeclaringImport))); case ParameterSymbol parameter: return(CodeBlockWithDescription( $"param {parameter.Name}: {parameter.Type}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), parameter.DeclaringParameter))); case VariableSymbol variable: return(CodeBlockWithDescription($"var {variable.Name}: {variable.Type}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), variable.DeclaringVariable))); case ResourceSymbol resource: return(CodeBlockWithDescription( $"resource {resource.Name}\n{resource.Type}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), resource.DeclaringResource))); case ModuleSymbol module: var filePath = SyntaxHelper.TryGetModulePath(module.DeclaringModule, out _); if (filePath != null) { return(CodeBlockWithDescription($"module {module.Name}\n'{filePath}'", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), module.DeclaringModule))); } return(CodeBlockWithDescription($"module {module.Name}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), module.DeclaringModule))); case OutputSymbol output: return(CodeBlockWithDescription( $"output {output.Name}: {output.Type}", TryGetDescription(result.Context.Compilation.GetEntrypointSemanticModel(), output.DeclaringOutput))); case BuiltInNamespaceSymbol builtInNamespace: return(CodeBlock($"{builtInNamespace.Name} namespace")); case FunctionSymbol function when result.Origin is FunctionCallSyntaxBase functionCall: // it's not possible for a non-function call syntax to resolve to a function symbol // but this simplifies the checks return(GetFunctionMarkdown(function, functionCall, result.Context.Compilation.GetEntrypointSemanticModel())); case PropertySymbol property: if (GetModuleParameterOrOutputDescription(request, result, $"{property.Name}: {property.Type}", out var codeBlock)) { return(codeBlock); } return(CodeBlockWithDescription($"{property.Name}: {property.Type}", property.Description)); case LocalVariableSymbol local: return(CodeBlock($"{local.Name}: {local.Type}")); default: return(null); } }
public TextDocumentHoverResponse TextDocumentHover(HoverParams hoverParams) { return(new TextDocumentHoverResponse { Contents = new MarkupContent { Kind = MarkupKind.Markdown, Value = $"textDocument/hover at position ({hoverParams.Position.Line}, {hoverParams.Position.Character}) with `markdown`", } }); }
public Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var hash = Hash.StringHash(request.TextDocument.Uri.GetFileSystemPath()); var ptr = TreeSitter.Hover(hash, request.Position.Line, request.Position.Character); var str = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(ptr); var hover = new Hover(); if (str != null) { hover.Contents = new MarkedStringsOrMarkupContent(str); } return(Task.FromResult(hover)); }
public Hover TextDocumentHover(HoverParams param) { var path = Converters.PathFromUri(param.TextDocument.Uri); var position = Converters.SourcePositionFromPosition(param.Position); if (_documentContents.TryGetValue(path, out var code)) { var parseResult = _repl.ParseUntilSourceLocation(code, position); var markdown = parseResult.GetMarkdownDisplay(); return(new Hover(new MarkupContent(MarkupKind.Markdown, markdown))); } return(null); }
public async Task unimplemented_lsp_handlers_return_404(Language language, string markupCode) { // something that's a valid LSP method, just not for the given kernel var methodName = "textDocument/hover"; MarkupTestFile.GetLineAndColumn(markupCode, out var code, out var line, out var character); var request = new HoverParams( TextDocument.FromDocumentContents(code), new Lsp.Position(line, character)); var response = await GetServer(language).HttpClient.PostObjectAsJsonAsync($"/lsp/{methodName}", request); response.StatusCode.Should().Be(HttpStatusCode.NotFound); var content = await response.Content.ReadAsStringAsync(); content.Should().StartWith($"method '{methodName}' not found on kernel '{language.LanguageName()}'"); }
public async Task <Hover> Handle(HoverParams request, CancellationToken token) { var(document, position) = _workspace.GetLogicalDocument(request); var providerCoordinatorFactory = _workspace.GetGlobalService <IQuickInfoProviderCoordinatorFactory>(); var providerCoordinator = providerCoordinatorFactory.CreateCoordinator(document); var(item, _) = await providerCoordinator.GetItemAsync(document, position, token); if (item != null) { var symbolInfo = new List <MarkupContent>(); Range symbolRange; var markdownText = string.Empty; switch (item.Content) { case QuickInfoDisplayContent c: markdownText += $"``` {document.Language}\n{c.MainDescription.GetFullText()}\n```\n"; if (!c.Documentation.IsEmpty) { markdownText += c.Documentation.GetFullText(); } break; default: throw new ArgumentOutOfRangeException(); } symbolRange = Helpers.ToRange(document, item.TextSpan); return(new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkupContent { Kind = MarkupKind.Markdown, Value = markdownText }), Range = symbolRange }); } else { return(null); } }
public async override Task <Hover?> Handle(HoverParams request, CancellationToken cancellationToken) { logger.LogTrace("received hover request for {Document}", request.TextDocument); var document = await documents.GetDocumentAsync(request.TextDocument); if (document == null) { logger.LogWarning("the document {Document} is not loaded", request.TextDocument); return(null); } if (!document.SymbolTable.TryGetSymbolAt(request.Position, out var symbol)) { logger.LogDebug("no symbol was found at {Position} in {Document}", request.Position, request.TextDocument); return(null); } return(CreateHover(symbol, cancellationToken)); }
public async Task lsp_textDocument_hover_returns_expected_result(Language language, string code, int line, int character, string expected) { using var _ = new AssertionScope(); var request = new HoverParams( TextDocument.FromDocumentContents(code), new Lsp.Position(line, character)); var response = await GetServer(language).HttpClient.PostObjectAsJsonAsync("/lsp/textDocument/hover", request); await response.ShouldSucceed(); var responseJson = await response.Content.ReadAsStringAsync(); var hoverResponse = LspDeserializeFromString <HoverResponse>(responseJson); hoverResponse.Contents.Kind.Should().Be(Lsp.MarkupKind.Markdown); hoverResponse.Contents.Value.Should().Be(expected); }
public async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var emptyHover = new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkedString[] { }), }; var documentPath = DocumentUri.GetFileSystemPath(request.TextDocument.Uri); if (string.IsNullOrEmpty(documentPath)) { return(emptyHover); } var(rootScope, tc) = buffers.GetScope(documentPath); if (rootScope == null) { return(emptyHover); } var scope = GetCurrentScope(rootScope, (int)request.Position.Character, (int)request.Position.Line, documentPath); var pos = (int)request.Position.Character; var line = (int)request.Position.Line; var node = FindNode(scope, pos, line, documentPath); if (node == null) { return(emptyHover); } if (node is AST.VariableReference vr) { var ov = node.scope.GetVar(vr.variableName, node.token); FrontendType nt; nt = tc.GetNodeType(node); if (nt is FrontendSumType st) { nt = st.types[vr.overloadedIdx]; } return(new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkedString($"{nt}")) }); } return(emptyHover); }
public async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { _log.LogInformation(string.Format(Resources.LoggingMessages.request_handle, _method)); try { var manager = _workspaceManager.GetFileRepository(request.TextDocument.Uri).SymbolTableManager; var uri = request.TextDocument.Uri; var line = (int)request.Position.Line + 1; var col = (int)request.Position.Character + 1; IHoverProvider provider = new HoverProvider(manager); return(await Task.Run(() => provider.GetHoverInformation(uri, line, col), cancellationToken)); } catch (Exception e) { HandleError(string.Format(Resources.LoggingMessages.request_error, _method), e); return(null); } }
public void HoverParams_has_well_formed_deserialization() { var json = @"{ ""textDocument"": { ""uri"": ""document-uri"" }, ""position"":{ ""line"": 1, ""character"": 2 } }"; var jObject = JObject.Parse(json); var actual = jObject.ToObject <HoverParams>(); var expected = new HoverParams( new TextDocument("document-uri"), new Position(1, 2)); actual.Should().BeEquivalentTo(expected); }
public async override Task <Hover> Handle(HoverParams request, CancellationToken token) { var omnisharpRequest = new TypeLookupRequest() { FileName = Helpers.FromUri(request.TextDocument.Uri), Column = Convert.ToInt32(request.Position.Character), Line = Convert.ToInt32(request.Position.Line), IncludeDocumentation = true }; var omnisharpResponse = await _definitionHandler.Handle(omnisharpRequest); return(new Hover() { // TODO: Range? We don't currently have that! // Range = Contents = new MarkedStringsOrMarkupContent(new Container <MarkedString>(Helpers.EscapeMarkdown(omnisharpResponse.Type), Helpers.EscapeMarkdown(omnisharpResponse.Documentation))) }); }
public override Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var editorData = DResolverWrapper.CreateEditorData(request, cancellationToken); var resolvedHoveredTypes = LooseResolution.ResolveTypeLoosely(editorData, out LooseResolution.NodeResolutionAttempt resolutionAttempt, out ISyntaxRegion syntaxRegion, true); var markup = string.Join(Environment.NewLine + Environment.NewLine, AmbiguousType.TryDissolve(resolvedHoveredTypes) .Where(t => t != null) .Select(t => TooltipMarkupGen.CreateSignatureMarkdown(t))); return(Task.FromResult(new Hover { Contents = new MarkedStringsOrMarkupContent(new MarkupContent { Kind = MarkupKind.Markdown, Value = markup }), Range = syntaxRegion.ToRange() })); }
public override Task <Hover?> Handle(HoverParams request, CancellationToken cancellationToken) { _logger.LogTrace("received hover request for {Document}", request.TextDocument); DafnyDocument?textDocument; if (!_documents.TryGetDocument(request.TextDocument, out textDocument)) { _logger.LogWarning("the document {Document} is not loaded", request.TextDocument); return(Task.FromResult <Hover?>(null)); } ILocalizableSymbol?symbol; if (!textDocument.SymbolTable.TryGetSymbolAt(request.Position, out symbol)) { _logger.LogDebug("no symbol was found at {Position} in {Document}", request.Position, request.TextDocument); return(Task.FromResult <Hover?>(null)); } return(Task.FromResult <Hover?>(CreateHover(symbol, cancellationToken))); }
public override async Task <Hover> Handle(HoverParams request, CancellationToken token) { var omnisharpRequest = new QuickInfoRequest() { FileName = Helpers.FromUri(request.TextDocument.Uri), Column = Convert.ToInt32(request.Position.Character), Line = Convert.ToInt32(request.Position.Line), }; var omnisharpResponse = await _definitionHandler.Handle(omnisharpRequest); return(new Hover() { // TODO: Range? We don't currently have that! // Range = Contents = new MarkedStringsOrMarkupContent(new MarkupContent() { Value = omnisharpResponse.Markdown, Kind = MarkupKind.Markdown }) }); }
public Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { var doc = bufferManager.GetBuffer(request.TextDocument.Uri.AbsolutePath); if (doc == null) { return(Task.FromResult <Hover>(null)); } var symbol = doc.GetWordRangeAtPosition(request.Position); var v = documentsManager.LookupSymbol(symbol); if (v == null) { return(Task.FromResult <Hover>(null)); } return(Task.FromResult(new Hover { Contents = new MarkedStringsOrMarkupContent(GetSymbolDocumentation(v)) })); }
public async Task <HoverModel> Handle(HoverParams request, CancellationToken cancellationToken) { if (request is null) { throw new ArgumentNullException(nameof(request)); } var document = await Task.Factory.StartNew(() => { _documentResolver.TryResolveDocument(request.TextDocument.Uri.AbsolutePath, out var documentSnapshot); return(documentSnapshot); }, cancellationToken, TaskCreationOptions.None, _foregroundDispatcher.ForegroundScheduler); if (document is null) { return(null); } var codeDocument = await document.GetGeneratedOutputAsync(); if (codeDocument.IsUnsupported()) { return(null); } var tagHelperDocumentContext = codeDocument.GetTagHelperContext(); var sourceText = await document.GetTextAsync(); var linePosition = new LinePosition((int)request.Position.Line, (int)request.Position.Character); var hostDocumentIndex = sourceText.Lines.GetPosition(linePosition); var location = new SourceSpan(hostDocumentIndex, (int)request.Position.Line, (int)request.Position.Character, 0); var hoverItem = _hoverInfoService.GetHoverInfo(codeDocument, location); _logger.LogTrace($"Found hover info items."); return(hoverItem); }
public async Task <HoverModel> Handle(HoverParams request, CancellationToken cancellationToken) { if (request is null) { throw new ArgumentNullException(nameof(request)); } var document = await _projectSnapshotManagerDispatcher.RunOnDispatcherThreadAsync(() => { _documentResolver.TryResolveDocument(request.TextDocument.Uri.GetAbsoluteOrUNCPath(), out var documentSnapshot); return(documentSnapshot); }, cancellationToken).ConfigureAwait(false); if (document is null) { return(null); } var codeDocument = await document.GetGeneratedOutputAsync(); if (codeDocument.IsUnsupported()) { return(null); } var sourceText = await document.GetTextAsync(); var linePosition = new LinePosition((int)request.Position.Line, (int)request.Position.Character); var hostDocumentIndex = sourceText.Lines.GetPosition(linePosition); var location = new SourceLocation(hostDocumentIndex, (int)request.Position.Line, (int)request.Position.Character); var clientCapabilities = _languageServer.ClientSettings.Capabilities; var hoverItem = _hoverInfoService.GetHoverInfo(codeDocument, location, clientCapabilities); _logger.LogTrace($"Found hover info items."); return(hoverItem); }
public override Task <Hover?> Handle(HoverParams request, CancellationToken cancellationToken) { var result = this.symbolResolver.ResolveSymbol(request.TextDocument.Uri, request.Position); if (result == null) { return(Task.FromResult <Hover?>(null)); } var markdown = GetMarkdown(request, result); if (markdown == null) { return(Task.FromResult <Hover?>(null)); } return(Task.FromResult <Hover?>(new Hover { Contents = markdown, Range = PositionHelper.GetNameRange(result.Context.LineStarts, result.Origin) })); }
public override async Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { _logger.LogDebug("Hover request canceled for file: {0}", request.TextDocument.Uri); return(null); } ScriptFile scriptFile = _workspaceService.GetFile(request.TextDocument.Uri); SymbolDetails symbolDetails = await _symbolsService.FindSymbolDetailsAtLocationAsync( scriptFile, request.Position.Line + 1, request.Position.Character + 1).ConfigureAwait(false); if (symbolDetails == null) { return(null); } List <MarkedString> symbolInfo = new List <MarkedString>(); symbolInfo.Add(new MarkedString("PowerShell", symbolDetails.DisplayString)); if (!string.IsNullOrEmpty(symbolDetails.Documentation)) { symbolInfo.Add(new MarkedString("markdown", symbolDetails.Documentation)); } Range symbolRange = GetRangeFromScriptRegion(symbolDetails.SymbolReference.ScriptRegion); return(new Hover { Contents = new MarkedStringsOrMarkupContent(symbolInfo), Range = symbolRange }); }
IHover IWorker.Hover(string absFilename, long line, long column) { if ((line < 0) || (column < 0)) { return(null); } Sender.ResponseResult result; { var param = new HoverParams(); var sourceUri = new Uri(absFilename); param.position.line = (uint)line; param.position.character = (uint)column; param.textDocument.uri = sourceUri.AbsoluteUri; var id = client_.Send.TextDocumentHover(param); result = client_.QueryResponse(id, millisecondsTimeout: defaultTimeout); if ((ResponseIsCorrect(result) == false) || (result.item == null)) { return(null); } } return(new HoverImpl((Hover)result.item)); }
public Task <Hover> Handle(HoverParams request, CancellationToken cancellationToken) { try { var scriptFile = _projectManager.GetScriptForFilePath(request.TextDocument.Uri.ToFilePath()); if (scriptFile == null) { return(Task.FromResult <Hover>(null)); } var identifier = scriptFile.Node.GetDescendantNodeOfTypeAtPosition <IdentifierNode>(request.Position.ToPosition()); if (identifier == null) { return(Task.FromResult <Hover>(null)); } var symbol = identifier.GetDeclaredOrReferencedSymbol(); if (symbol == null) { return(Task.FromResult <Hover>(null)); } var displayText = new DisplayTextEmitter().GetDisplayText(symbol); return(Task.FromResult(new Hover() { Contents = new MarkedStringsOrMarkupContent(DisplayTextToMarkupContent(displayText)), Range = identifier.Range.ToRange() })); } catch (Exception e) { _logger.LogWarning(e, "Error while handling request."); } return(Task.FromResult <Hover>(null)); }
private static MarkedStringsOrMarkupContent?GetMarkdown(HoverParams request, SymbolResolutionResult result) { // all of the generated markdown includes the language id to avoid VS code rendering // with multiple borders switch (result.Symbol) { case ImportedNamespaceSymbol import: return(WithMarkdown(CodeBlockWithDescription( $"import {import.Name}", TryGetDescriptionMarkdown(result, import)))); case ParameterSymbol parameter: return(WithMarkdown(CodeBlockWithDescription( $"param {parameter.Name}: {parameter.Type}", TryGetDescriptionMarkdown(result, parameter)))); case VariableSymbol variable: return(WithMarkdown(CodeBlockWithDescription($"var {variable.Name}: {variable.Type}", TryGetDescriptionMarkdown(result, variable)))); case ResourceSymbol resource: var docsSuffix = TryGetTypeDocumentationLink(resource) is { } typeDocsLink ? $"[View Type Documentation]({typeDocsLink})" : ""; var description = TryGetDescriptionMarkdown(result, resource); return(WithMarkdown(CodeBlockWithDescription( $"resource {resource.Name} {(resource.Type is ResourceType ? $"'{resource.Type}'" : resource.Type)}", description is { } ? $"{description}\n{docsSuffix}" : docsSuffix)));