Skip to content

Commit

Permalink
Display text of references in doc strings (#1166)
Browse files Browse the repository at this point in the history
* Display text of references
  • Loading branch information
AurelienSaue committed Jul 28, 2023
1 parent cfd6cd7 commit b6c9142
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Unreleased

## Features

- Display text of references in doc strings (#1166)

# 1.16.2

## Fixes
Expand Down
7 changes: 5 additions & 2 deletions ocaml-lsp-server/src/doc_to_md.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ let rec inline_element_to_inline
let text = inline_element_list_to_inlines inlines in
let meta = loc_to_meta location in
style_inline ~meta style text
| { value = `Reference (_kind, _ref, _inlines); location = _location } ->
| { value = `Reference (kind, ref, inlines); location } -> (
(* TODO: add support for references *)
Inline.Break (Inline.Break.make `Hard, Meta.none)
let meta = loc_to_meta location in
match kind with
| `Simple -> Inline.Code_span (Inline.Code_span.of_string ref.value, meta)
| `With_text -> inline_element_list_to_inlines inlines)
| { value = `Link (link, inlines); location } ->
let text = inline_element_list_to_inlines inlines in
let ref =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ describe_opt("textDocument/completion", () => {
External links: {{:https://ocaml.org/} OCaml's official website}
Cross-references: {!List.length} {{!List.length} Replacement text}
{3 Inline Formatting}
{b Bold}, {i Italic}, {e Emphasize}, {^ Superscript}, {_ Subscript}, and [inline code]
Expand Down Expand Up @@ -358,6 +360,8 @@ describe_opt("textDocument/completion", () => {
External links: [OCaml's official website](https://ocaml.org/)
Cross-references: \`List.length\` Replacement text
#### Inline Formatting
**Bold**, *Italic*, *Emphasize*, Superscript, Subscript, and \`inline code\`
Expand Down

0 comments on commit b6c9142

Please sign in to comment.