Skip to content
Merged
Changes from all 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
13 changes: 12 additions & 1 deletion src/requests/hover.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ function get_hover(b::StaticLint.Binding, documentation::String, server)
else
documentation
end
documentation = string(documentation, "```julia\n", Expr(b.val), "\n```\n")
documentation = string(documentation, "```julia\n", prettify_expr(Expr(b.val)), "\n```\n")
catch err
@error "get_hover failed to convert Expr" exception = (err, catch_backtrace())
throw(LSHoverError(string("get_hover failed to convert Expr")))
end
end
Expand All @@ -65,6 +66,16 @@ function get_hover(b::StaticLint.Binding, documentation::String, server)
return documentation
end

function prettify_expr(ex::Expr)
if ex.head === :kw && length(ex.args) == 2
string(ex.args[1], " = ", ex.args[2])
else
string(ex)
end
end

prettify_expr(ex) = string(ex)

# print(io, x::SymStore) methods are defined in SymbolServer
function get_hover(b::SymbolServer.SymStore, documentation::String, server)
if !isempty(b.doc)
Expand Down