Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display text of references in doc strings #1166

Merged
merged 5 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 6 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,13 @@ 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
begin match kind with
| `Simple -> Inline.Code_span (Inline.Code_span.of_string ref.value, meta)
| `With_text -> inline_element_list_to_inlines inlines
end
| { 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
Loading