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
29
29
end
30
30
31
31
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
34
37
end
35
38
36
39
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
39
45
end
40
46
41
47
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
44
53
end
45
54
end
Original file line number Diff line number Diff line change @@ -52,23 +52,38 @@ defmodule ElixirLS.LanguageServer.Providers.Hover do
52
52
53
53
defp build_module_link ( module ) do
54
54
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
56
61
else
57
62
""
58
63
end
59
64
end
60
65
61
66
defp build_function_link ( module , function , arity ) do
62
67
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
64
74
else
65
75
""
66
76
end
67
77
end
68
78
69
79
defp build_type_link ( module , type , arity ) do
70
80
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
72
87
else
73
88
""
74
89
end
You can’t perform that action at this time.
0 commit comments