Skip to content

Commit

Permalink
do not crash if metadata cannot be rendered to markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed May 7, 2024
1 parent c480ca9 commit 427a6b2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/language_server/lib/language_server/markdown_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ defmodule ElixirLS.LanguageServer.MarkdownUtils do
"**Equivalent** #{name}/#{arity}"
end

defp get_metadata_entry_md({:deprecated, text}) do
defp get_metadata_entry_md({:deprecated, text}) when is_binary(text) do
"**Deprecated** #{text}"
end

defp get_metadata_entry_md({:since, text}) do
defp get_metadata_entry_md({:since, text}) when is_binary(text) do
"**Since** #{text}"
end

defp get_metadata_entry_md({:group, text}) do
defp get_metadata_entry_md({:group, text}) when is_binary(text) do
"**Group** #{text}"
end

Expand All @@ -102,15 +102,15 @@ defmodule ElixirLS.LanguageServer.MarkdownUtils do
"**Built-in**"
end

defp get_metadata_entry_md({:implementing, module}) do
defp get_metadata_entry_md({:implementing, module}) when is_atom(module) do
"**Implementing behaviour** #{inspect(module)}"
end

defp get_metadata_entry_md({:implementing_module_app, app}) do
defp get_metadata_entry_md({:implementing_module_app, app}) when is_atom(app) do
"**Behaviour defined in application** #{to_string(app)}"
end

defp get_metadata_entry_md({:app, app}) do
defp get_metadata_entry_md({:app, app}) when is_atom(app) do
"**Application** #{to_string(app)}"
end

Expand All @@ -132,7 +132,7 @@ defmodule ElixirLS.LanguageServer.MarkdownUtils do

defp get_metadata_entry_md({:defaults, _}), do: nil

defp get_metadata_entry_md({:delegate_to, {m, f, a}}) do
defp get_metadata_entry_md({:delegate_to, {m, f, a}}) when is_atom(m) and is_atom(f) and is_integer(a) do
"**Delegates to** #{inspect(m)}.#{f}/#{a}"
end

Expand Down

0 comments on commit 427a6b2

Please sign in to comment.