Skip to content

Commit 862175e

Browse files
authored
Fix issue where doc comment with nested comments inside is not shown properly on hover. (#526)
* Add an example doc comment with code block See #522 * More tests in a separate file. * Add example with no nested comments. * Found the issue. * Remove PrepareUtils Might be the last file inherited from the original extension, which keeps on giving years later. * Update CHANGELOG.md
1 parent 1572f81 commit 862175e

File tree

5 files changed

+61
-46
lines changed

5 files changed

+61
-46
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
- Fix Incorrect semantic highlighting of `external` declarations https://github.com/rescript-lang/rescript-vscode/pull/517
2525

26+
- Fix issue where doc comment with nested comments inside is not shown properly on hover https://github.com/rescript-lang/rescript-vscode/pull/526
27+
2628
## v1.4.2
2729

2830
#### :bug: Bug Fix

analysis/src/PrepareUtils.ml

Lines changed: 0 additions & 45 deletions
This file was deleted.

analysis/src/ProcessAttributes.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let rec findDocAttribute attributes =
1414
};
1515
] )
1616
:: _ ->
17-
Some (PrepareUtils.cleanOffStars doc)
17+
Some doc
1818
| _ :: rest -> findDocAttribute rest
1919

2020
let rec findDeprecatedAttribute attributes =

analysis/tests/src/DocComments.res

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@ns.doc(" Doc comment with a triple-backquote example
2+
3+
```res example
4+
let a = 10
5+
/*
6+
* stuff
7+
*/
8+
```
9+
")
10+
let docComment1 = 12
11+
// ^hov
12+
13+
/**
14+
Doc comment with a triple-backquote example
15+
16+
```res example
17+
let a = 10
18+
/*
19+
* stuff
20+
*/
21+
```
22+
*/
23+
let docComment2 = 12
24+
// ^hov
25+
26+
27+
@ns.doc(" Doc comment with a triple-backquote example
28+
29+
```res example
30+
let a = 10
31+
let b = 20
32+
```
33+
")
34+
let docCommentNoNested1 = 12
35+
// ^hov
36+
37+
/**
38+
Doc comment with a triple-backquote example
39+
40+
```res example
41+
let a = 10
42+
let b = 20
43+
```
44+
*/
45+
let docCommentNoNested2 = 12
46+
// ^hov
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Hover src/DocComments.res 9:9
2+
{"contents": "```rescript\nint\n```\n\n Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n /*\\n * stuff\\n */\\n ```\\n"}
3+
4+
Hover src/DocComments.res 22:6
5+
{"contents": "```rescript\nint\n```\n\n\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n /*\n * stuff\n */\n ```\n"}
6+
7+
Hover src/DocComments.res 33:9
8+
{"contents": "```rescript\nint\n```\n\n Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n let b = 20\\n ```\\n"}
9+
10+
Hover src/DocComments.res 44:6
11+
{"contents": "```rescript\nint\n```\n\n\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n let b = 20\n ```\n"}
12+

0 commit comments

Comments
 (0)