File tree Expand file tree Collapse file tree 2 files changed +33
-9
lines changed
apps/language_server/lib/language_server Expand file tree Collapse file tree 2 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,26 @@ defmodule ElixirLS.LanguageServer.DocLinks do
2929 end
3030
3131 def hex_docs_module_link ( module ) do
32- { app , vsn } = get_app ( module )
33- "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html"
32+ case get_app ( module ) do
33+ { app , vsn } ->
34+ "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html"
35+ nil -> nil
36+ end
3437 end
3538
3639 def hex_docs_function_link ( module , function , arity ) do
37- { app , vsn } = get_app ( module )
38- "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html##{ function } /#{ arity } "
40+ case get_app ( module ) do
41+ { app , vsn } ->
42+ "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html##{ function } /#{ arity } "
43+ nil -> nil
44+ end
3945 end
4046
4147 def hex_docs_type_link ( module , type , arity ) do
42- { app , vsn } = get_app ( module )
43- "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html#t:#{ type } /#{ arity } "
48+ case get_app ( module ) do
49+ { app , vsn } ->
50+ "#{ @ hex_base_url } /#{ app } /#{ vsn } /#{ inspect ( module ) } .html#t:#{ type } /#{ arity } "
51+ nil -> nil
52+ end
4453 end
4554end
Original file line number Diff line number Diff line change @@ -52,23 +52,38 @@ defmodule ElixirLS.LanguageServer.Providers.Hover do
5252
5353 defp build_module_link ( module ) do
5454 if ElixirSense.Core.Introspection . elixir_module? ( module ) do
55- "[View on hexdocs](#{ DocLinks . hex_docs_module_link ( module ) } )"
55+ url = DocLinks . hex_docs_module_link ( module )
56+ if url do
57+ "[View on hexdocs](#{ url } )\n \n "
58+ else
59+ ""
60+ end
5661 else
5762 ""
5863 end
5964 end
6065
6166 defp build_function_link ( module , function , arity ) do
6267 if ElixirSense.Core.Introspection . elixir_module? ( module ) do
63- "[View on hexdocs](#{ DocLinks . hex_docs_function_link ( module , function , arity ) } )"
68+ url = DocLinks . hex_docs_function_link ( module , function , arity )
69+ if url do
70+ "[View on hexdocs](#{ url } )\n \n "
71+ else
72+ ""
73+ end
6474 else
6575 ""
6676 end
6777 end
6878
6979 defp build_type_link ( module , type , arity ) do
7080 if module != nil and ElixirSense.Core.Introspection . elixir_module? ( module ) do
71- "[View on hexdocs](#{ DocLinks . hex_docs_type_link ( module , type , arity ) } )\n \n "
81+ url = DocLinks . hex_docs_type_link ( module , type , arity )
82+ if url do
83+ "[View on hexdocs](#{ url } )\n \n "
84+ else
85+ ""
86+ end
7287 else
7388 ""
7489 end
You can’t perform that action at this time.
0 commit comments