@@ -84,6 +84,7 @@ handle_request({initialize, Params}) ->
84
84
ok = els_config :initialize (RootUri , Capabilities , InitOptions , lsp_notification ),
85
85
{response , server_capabilities ()};
86
86
handle_request ({initialized , _Params }) ->
87
+ ok = check_version (),
87
88
RootUri = els_config :get (root_uri ),
88
89
NodeName = els_distribution_server :node_name (
89
90
<<" erlang_ls" >>,
@@ -109,6 +110,31 @@ handle_request({exit, #{status := Status}}) ->
109
110
% %==============================================================================
110
111
% % API
111
112
% %==============================================================================
113
+ -spec check_version () -> ok .
114
+ check_version () ->
115
+ RuntimeVersion = list_to_integer (erlang :system_info (otp_release )),
116
+ BuildVersion = ? OTP_RELEASE ,
117
+ case RuntimeVersion == BuildVersion of
118
+ true ->
119
+ ok ;
120
+ false ->
121
+ Message = els_utils :to_binary (
122
+ io_lib :format (
123
+ " Running Erlang/OTP ~p , but compiled with Erlang/OTP ~p .\n "
124
+ " If you experience issues, "
125
+ " please recompile Erlang LS using Erlang/OTP ~p ." ,
126
+ [RuntimeVersion , BuildVersion , RuntimeVersion ]
127
+ )
128
+ ),
129
+ ? LOG_WARNING (Message ),
130
+ els_server :send_notification (
131
+ <<" window/showMessage" >>,
132
+ #{
133
+ type => ? MESSAGE_TYPE_WARNING ,
134
+ message => Message
135
+ }
136
+ )
137
+ end .
112
138
113
139
% % @doc Give all available providers
114
140
-spec available_providers () -> [provider_id ()].
0 commit comments