Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions ocaml-lsp-server/src/doc_to_md.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ let rec nestable_block_element_to_block
| Odoc_parser.Loc.{ value = `List (kind, style, xs); location } ->
let type' =
match kind with
| `Unordered -> `Unordered '*'
| `Unordered -> `Unordered '-'
| `Ordered -> `Ordered (1, '*')
in
let tight =
Expand Down Expand Up @@ -124,12 +124,12 @@ let rec nestable_block_element_to_block
let meta = loc_to_meta location in
Block.List (l, meta)
| Odoc_parser.Loc.
{ value = `Code_block (metadata, { value = code; location = _code_loc })
{ value = `Code_block (metadata, { value = code; location = code_loc })
; location
} ->
let info_string =
match metadata with
| None -> None
| None -> Some ("ocaml", loc_to_meta code_loc)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's right, can we assume that every ocamldoc code block is in ocaml?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that we default to ocaml when lang header is missing. See: https://ocaml.github.io/odoc/odoc_for_authors.html#ocaml_code_blocks

Also, I've added an explicit test case for this

| Some ({ value = lang; location = lang_log }, _env) ->
Some (lang, loc_to_meta lang_log)
in
Expand Down Expand Up @@ -252,7 +252,7 @@ let rec block_element_to_block
match block_element with
| Odoc_parser.Loc.{ value = `Heading (level, _, content); location } ->
let text = inline_element_list_to_inlines content in
let heading = Block.Heading.make ~level text in
let heading = Block.Heading.make ~level:(level+1) text in
let meta = loc_to_meta location in
Block.Heading (heading, meta)
| Odoc_parser.Loc.{ value = `Tag t; location } ->
Expand Down
30 changes: 15 additions & 15 deletions ocaml-lsp-server/test/e2e/__tests__/textDocument-signatureHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,58 +339,58 @@ describe_opt("textDocument/completion", () => {
kind: "markdown",
value: outdent`This is an example of a docstring that demonstrates various ocamldoc syntax features.

### Sections and Labels
#### Sections and Labels

We can create sections using

### Section title
#### Section title

and labels using

### Section title with label
#### Section title with label

### Links and Cross-references
#### Links and Cross-references

External links: [OCaml's official website](https://ocaml.org/)

### Inline Formatting
#### Inline Formatting

**Bold**, *Italic*, *Emphasize*, Superscript, Subscript, and \`inline code\`

### Text Alignment
#### Text Alignment

Centered text

Left-aligned text

Right-aligned text

### Lists
#### Lists

1.Ordered list item 1
2.Ordered list item 2

*Unordered list item 1
*Unordered list item 2
-Unordered list item 1
-Unordered list item 2

*Unordered list item 1
*Unordered list item 2
-Unordered list item 1
-Unordered list item 2

### Code Blocks
#### Code Blocks

\`\`\`
\`\`\`ocaml
let square x = x * x
let result = square 3
\`\`\`

### Verbatim
#### Verbatim

\`\`\`verb
This text will be displayed verbatim.
No formatting will be applied.
\`\`\`

### Module List
#### Module List

*Array
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module list are still broken

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, for some reason I thought that I should fix only commented stuff. 😅 I'll try to fix it asap.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is more involved. It didn't work previously so we can fix it later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I misunderstood the feature. The list is fixed now :)

*List
Expand Down