-
Notifications
You must be signed in to change notification settings - Fork 57
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
hover: remove spacing between type definition #619
hover: remove spacing between type definition #619
Conversation
Having a new line there is intentional for VSCode, but I do see the problem in neovim. We'll probably need to treat them differently. |
Fixed by 502d591 VSCode: Neovim: |
@@ -97,7 +97,7 @@ let stringifyCompletionItem c = | |||
| None -> null | |||
| Some doc -> stringifyMarkupContent doc) | |||
|
|||
let stringifyHover s = Printf.sprintf {|{"contents": "%s"}|} (Json.escape s) | |||
let stringifyHover value = Printf.sprintf {|{"contents": %s}|} (stringifyMarkupContent {kind = "markdown"; value}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use MarkupContent. MarkedString and MarkedString[] are depreacted.
That looks good. What about the dividers, would you like to test removing them completely in vim too? |
Neovim automatically adds dividers between code blocks even though it doesn't return dividers result = {
contents = {
kind = "markdown",
value = "```rescript\n(\n Belt.Array.t<Layer.t>,\n Layer.t => string,\n) => Belt.Array.t<string>\n```\n```rescript\ntype Belt.Array.t<'a> = array<'a>\n```\n\n```rescript\ntype Layer.t = Alface | Tomate
| Queijo | Cebola | Pao\n```\n\n\n\n `map(xs, f)`\n\n Returns a new array by calling `f` for each element of `xs` from the beginning to end.\n\n ```res example\n Belt.Array.map([1, 2], (x) => x + 1) == [3, 4]
\n ```\n"
}
} |
Dividers do indeed improve readability. |
e6a90df
to
600016e
Compare
@@ -100,12 +100,12 @@ let hoverWithExpandedTypes ~docstring ~file ~package ~supportsMarkdownLinks typ | |||
Markdown.goToDefinitionText ~env ~pos:loc.Warnings.loc_start | |||
else "" | |||
in | |||
"\n" ^ Markdown.spacing | |||
Markdown.divider ^ (if supportsMarkdownLinks then Markdown.spacing else "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably name supportsMarkdownLinks
something smarter now that it handles more cases, but that's a question for later.
@aspeddro ready to merge as soon as the tests are green again 👍 |
600016e
to
814a710
Compare
I don't know why the tests are failing, all the changes are committed. |
Can you resolve the merge conflict here too? I'll have a look at the tests tomorrow. |
Done |
3e95a89
to
66fa6b9
Compare
🙏 Tests ✅ |
Before:
Neovim LSP builtin:
VSCode:
After:
Neovim:
VSCode: