@@ -106,7 +106,7 @@ impl LSPServer {
106106impl LanguageServer for LSPServer {
107107 #[ allow( deprecated) ]
108108 #[ tracing:: instrument(
109- level = "trace " ,
109+ level = "info " ,
110110 skip_all,
111111 fields(
112112 root_uri = params. root_uri. as_ref( ) . map( display) ,
@@ -143,7 +143,7 @@ impl LanguageServer for LSPServer {
143143 Ok ( init)
144144 }
145145
146- #[ tracing:: instrument( level = "trace " , skip ( self ) ) ]
146+ #[ tracing:: instrument( level = "info " , skip_all ) ]
147147 async fn initialized ( & self , params : InitializedParams ) {
148148 let _ = params;
149149
@@ -163,11 +163,12 @@ impl LanguageServer for LSPServer {
163163 self . session . update_all_diagnostics ( ) . await ;
164164 }
165165
166+ #[ tracing:: instrument( level = "info" , skip_all) ]
166167 async fn shutdown ( & self ) -> LspResult < ( ) > {
167168 Ok ( ( ) )
168169 }
169170
170- #[ tracing:: instrument( level = "trace " , skip ( self ) ) ]
171+ #[ tracing:: instrument( level = "info " , skip_all ) ]
171172 async fn did_change_configuration ( & self , params : DidChangeConfigurationParams ) {
172173 let _ = params;
173174 self . session . load_workspace_settings ( ) . await ;
@@ -209,29 +210,41 @@ impl LanguageServer for LSPServer {
209210 }
210211 }
211212
213+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
212214 async fn did_open ( & self , params : DidOpenTextDocumentParams ) {
213215 handlers:: text_document:: did_open ( & self . session , params)
214216 . await
215217 . ok ( ) ;
216218 }
217219
220+ #[ tracing:: instrument( level = "trace" , skip( self , params) ) ]
218221 async fn did_change ( & self , params : DidChangeTextDocumentParams ) {
219- handlers:: text_document:: did_change ( & self . session , params)
220- . await
221- . ok ( ) ;
222+ if let Err ( e ) = handlers:: text_document:: did_change ( & self . session , params) . await {
223+ error ! ( "{}" , e ) ;
224+ } ;
222225 }
223226
227+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
224228 async fn did_save ( & self , params : DidSaveTextDocumentParams ) {
225229 // handlers::text_document::did_save(&self.session, params)
226230 // .await
227231 // .ok();
228232 }
229233
234+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
230235 async fn did_close ( & self , params : DidCloseTextDocumentParams ) {
231236 handlers:: text_document:: did_close ( & self . session , params)
232237 . await
233238 . ok ( ) ;
234239 }
240+
241+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
242+ async fn completion ( & self , params : CompletionParams ) -> LspResult < Option < CompletionResponse > > {
243+ match handlers:: completions:: get_completions ( & self . session , params) {
244+ Ok ( result) => LspResult :: Ok ( Some ( result) ) ,
245+ Err ( e) => LspResult :: Err ( into_lsp_error ( e) ) ,
246+ }
247+ }
235248}
236249
237250impl Drop for LSPServer {
@@ -379,6 +392,7 @@ impl ServerFactory {
379392 workspace_method ! ( builder, change_file) ;
380393 workspace_method ! ( builder, close_file) ;
381394 workspace_method ! ( builder, pull_diagnostics) ;
395+ workspace_method ! ( builder, get_completions) ;
382396
383397 let ( service, socket) = builder. finish ( ) ;
384398 ServerConnection { socket, service }
0 commit comments