@@ -13,10 +13,10 @@ use async_lsp::lsp_types::{
1313 FileOperationPatternKind , FileOperationRegistrationOptions , GotoDefinitionParams ,
1414 GotoDefinitionResponse , Hover , HoverContents , HoverParams , HoverProviderCapability ,
1515 InitializeParams , InitializeResult , Location , OneOf , PrepareRenameResponse , ProgressParams ,
16- ReferenceParams , RenameFilesParams , RenameOptions , RenameParams , ServerCapabilities , ServerInfo ,
17- TextDocumentPositionParams , TextDocumentSyncCapability , TextDocumentSyncKind , TextEdit , Url ,
18- WorkspaceEdit , WorkspaceFileOperationsServerCapabilities , WorkspaceFoldersServerCapabilities ,
19- WorkspaceServerCapabilities ,
16+ ReferenceParams , RenameFilesParams , RenameOptions , RenameParams , ServerCapabilities ,
17+ ServerInfo , TextDocumentPositionParams , TextDocumentSyncCapability , TextDocumentSyncKind ,
18+ TextEdit , Url , WorkspaceEdit , WorkspaceFileOperationsServerCapabilities ,
19+ WorkspaceFoldersServerCapabilities , WorkspaceServerCapabilities ,
2020} ;
2121use async_lsp:: { LanguageClient , LanguageServer , ResponseError } ;
2222use futures:: future:: BoxFuture ;
@@ -165,23 +165,16 @@ impl LanguageServer for ProtoLanguageServer {
165165 return Box :: pin ( async move { Ok ( None ) } ) ;
166166 } ;
167167
168- let comments = self
168+ let result = self
169169 . state
170170 . hover ( current_package_name. as_ref ( ) , identifier. as_ref ( ) ) ;
171171
172- let response = match comments. len ( ) {
173- 0 => None ,
174- 1 => Some ( Hover {
175- contents : HoverContents :: Scalar ( comments[ 0 ] . clone ( ) ) ,
176- range : None ,
177- } ) ,
178- 2 .. => Some ( Hover {
179- contents : HoverContents :: Array ( comments) ,
172+ Box :: pin ( async move {
173+ Ok ( result. map ( |r| Hover {
180174 range : None ,
181- } ) ,
182- } ;
183-
184- Box :: pin ( async move { Ok ( response) } )
175+ contents : HoverContents :: Markup ( r) ,
176+ } ) )
177+ } )
185178 }
186179 fn completion (
187180 & mut self ,
@@ -372,7 +365,7 @@ impl LanguageServer for ProtoLanguageServer {
372365 let response = self
373366 . configs
374367 . get_formatter_for_uri ( & uri)
375- . and_then ( |f| f. format_document ( content. as_str ( ) ) ) ;
368+ . and_then ( |f| f. format_document ( uri . path ( ) , content. as_str ( ) ) ) ;
376369
377370 Box :: pin ( async move { Ok ( response) } )
378371 }
@@ -387,7 +380,7 @@ impl LanguageServer for ProtoLanguageServer {
387380 let response = self
388381 . configs
389382 . get_formatter_for_uri ( & uri)
390- . and_then ( |f| f. format_document_range ( & params. range , content. as_str ( ) ) ) ;
383+ . and_then ( |f| f. format_document_range ( & params. range , uri . path ( ) , content. as_str ( ) ) ) ;
391384
392385 Box :: pin ( async move { Ok ( response) } )
393386 }
0 commit comments