Skip to content

Commit

Permalink
Fix compilation before Erlang/OTP 23
Browse files Browse the repository at this point in the history
  • Loading branch information
garazdawi committed Oct 5, 2021
1 parent 65291ec commit b352bec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/els_lsp/src/els_docs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ signature('remote', M, F, A) ->
%%
%% On modern systems (OTP 23+), Erlang has support for fetching documentation
%% from the chunk.
-ifdef(NATIVE_FORMAT).
-spec eep48_docs(function | type, atom(), atom(), non_neg_integer()) ->
{ok, string()} | {error, not_available}.
eep48_docs(Type, M, F, A) ->
Expand Down Expand Up @@ -209,6 +210,12 @@ get_edoc_chunk(M, Uri) ->
?LOG_ERROR("[edoc_chunk] load error", [E]),
error
end.
-else.
-spec eep48_docs(function | type, atom(), atom(), non_neg_integer()) ->
{error, not_available}.
eep48_docs(_Type, _M, _F, _A) ->
{error, not_available}.
-endif.

-spec specs(atom(), atom(), non_neg_integer()) ->
[els_markup_content:doc_entry()].
Expand Down
5 changes: 5 additions & 0 deletions apps/els_lsp/src/els_eep48_docs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
%% It is a copy of shell_docs.erl from the erlang/otp repo that
%% has been modified to emit markdown instead of shell.

-ifdef(OTP_RELEASE).
-if(?OTP_RELEASE >= 23).

-include_lib("kernel/include/eep48.hrl").

-export([render/2, render/3, render/4, render/5]).
Expand Down Expand Up @@ -866,3 +869,5 @@ nl({Chars, _Pos}) ->
nl(Chars);
nl(Chars) ->
{[Chars,"\n"],0}.

-endif.

0 comments on commit b352bec

Please sign in to comment.