@@ -18,7 +18,6 @@ defmodule Expert do
1818 GenLSP.Notifications.TextDocumentDidOpen ,
1919 GenLSP.Notifications.TextDocumentDidSave ,
2020 GenLSP.Notifications.Exit ,
21- GenLSP.Notifications.Initialized ,
2221 GenLSP.Requests.Shutdown
2322 ]
2423
@@ -47,13 +46,6 @@ defmodule Expert do
4746
4847 case State . initialize ( state , request ) do
4948 { :ok , response , state } ->
50- # TODO: this should be gated behind the dynamic registration in the initialization params
51- registrations = registrations ( )
52-
53- if nil != GenLSP . request ( lsp , registrations ) do
54- Logger . error ( "Failed to register capability" )
55- end
56-
5749 lsp = assign ( lsp , state: state )
5850 { :ok , response } = Expert.Protocol.Convert . to_lsp ( response )
5951
@@ -119,6 +111,16 @@ defmodule Expert do
119111 end
120112 end
121113
114+ def handle_notification ( % GenLSP.Notifications.Initialized { } , lsp ) do
115+ registrations = registrations ( )
116+
117+ if nil != GenLSP . request ( lsp , registrations ) do
118+ Logger . error ( "Failed to register capability" )
119+ end
120+
121+ { :noreply , lsp }
122+ end
123+
122124 def handle_notification ( % mod { } = notification , lsp ) when mod in @ server_specific_messages do
123125 with { :ok , notification } <- Convert . to_native ( notification ) ,
124126 { :ok , state } <- apply_to_state ( assigns ( lsp ) . state , notification ) do
0 commit comments