2
2
//! Protocol. The majority of requests are fulfilled by calling into the
3
3
//! `ra_ide` crate.
4
4
5
+ #![ allow( deprecated) ]
6
+
5
7
use std:: {
6
8
io:: Write as _,
7
9
process:: { self , Stdio } ,
@@ -15,7 +17,7 @@ use lsp_types::{
15
17
DocumentHighlight , DocumentSymbol , FoldingRange , FoldingRangeParams , HoverContents , Location ,
16
18
Position , PrepareRenameResponse , Range , RenameParams , SemanticTokensParams ,
17
19
SemanticTokensRangeParams , SemanticTokensRangeResult , SemanticTokensResult , SymbolInformation ,
18
- TextDocumentIdentifier , Url , WorkspaceEdit ,
20
+ SymbolTag , TextDocumentIdentifier , Url , WorkspaceEdit ,
19
21
} ;
20
22
use ra_ide:: {
21
23
FileId , FilePosition , FileRange , HoverAction , HoverGotoTypeData , NavigationTarget , Query ,
@@ -253,10 +255,16 @@ pub(crate) fn handle_document_symbol(
253
255
let mut parents: Vec < ( DocumentSymbol , Option < usize > ) > = Vec :: new ( ) ;
254
256
255
257
for symbol in snap. analysis . file_structure ( file_id) ? {
258
+ let mut tags = Vec :: new ( ) ;
259
+ if symbol. deprecated {
260
+ tags. push ( SymbolTag :: Deprecated )
261
+ } ;
262
+
256
263
let doc_symbol = DocumentSymbol {
257
264
name : symbol. label ,
258
265
detail : symbol. detail ,
259
266
kind : to_proto:: symbol_kind ( symbol. kind ) ,
267
+ tags : Some ( tags) ,
260
268
deprecated : Some ( symbol. deprecated ) ,
261
269
range : to_proto:: range ( & line_index, symbol. node_range ) ,
262
270
selection_range : to_proto:: range ( & line_index, symbol. navigation_range ) ,
@@ -296,9 +304,16 @@ pub(crate) fn handle_document_symbol(
296
304
url : & Url ,
297
305
res : & mut Vec < SymbolInformation > ,
298
306
) {
307
+ let mut tags = Vec :: new ( ) ;
308
+ match symbol. deprecated {
309
+ Some ( true ) => tags. push ( SymbolTag :: Deprecated ) ,
310
+ _ => { }
311
+ }
312
+
299
313
res. push ( SymbolInformation {
300
314
name : symbol. name . clone ( ) ,
301
315
kind : symbol. kind ,
316
+ tags : Some ( tags) ,
302
317
deprecated : symbol. deprecated ,
303
318
location : Location :: new ( url. clone ( ) , symbol. range ) ,
304
319
container_name,
@@ -345,6 +360,7 @@ pub(crate) fn handle_workspace_symbol(
345
360
let info = SymbolInformation {
346
361
name : nav. name . to_string ( ) ,
347
362
kind : to_proto:: symbol_kind ( nav. kind ) ,
363
+ tags : None ,
348
364
location : to_proto:: location_from_nav ( snap, nav) ?,
349
365
container_name,
350
366
deprecated : None ,
0 commit comments