diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 22 |
2 files changed, 22 insertions, 2 deletions
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 023c104d1..758aa1c5d 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -20,7 +20,7 @@ env_logger = { version = "0.7.1", default-features = false } | |||
20 | itertools = "0.9.0" | 20 | itertools = "0.9.0" |
21 | jod-thread = "0.1.0" | 21 | jod-thread = "0.1.0" |
22 | log = "0.4.8" | 22 | log = "0.4.8" |
23 | lsp-types = { version = "0.77.0", features = ["proposed"] } | 23 | lsp-types = { version = "0.78.0", features = ["proposed"] } |
24 | parking_lot = "0.11.0" | 24 | parking_lot = "0.11.0" |
25 | pico-args = "0.3.1" | 25 | pico-args = "0.3.1" |
26 | rand = { version = "0.7.3", features = ["small_rng"] } | 26 | rand = { version = "0.7.3", features = ["small_rng"] } |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index d880570d2..8d8c9442b 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -15,7 +15,7 @@ use lsp_types::{ | |||
15 | DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location, | 15 | DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location, |
16 | Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams, | 16 | Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams, |
17 | SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, | 17 | SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, |
18 | TextDocumentIdentifier, Url, WorkspaceEdit, | 18 | SymbolTag, TextDocumentIdentifier, Url, WorkspaceEdit, |
19 | }; | 19 | }; |
20 | use ra_ide::{ | 20 | use ra_ide::{ |
21 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, | 21 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, |
@@ -253,10 +253,17 @@ pub(crate) fn handle_document_symbol( | |||
253 | let mut parents: Vec<(DocumentSymbol, Option<usize>)> = Vec::new(); | 253 | let mut parents: Vec<(DocumentSymbol, Option<usize>)> = Vec::new(); |
254 | 254 | ||
255 | for symbol in snap.analysis.file_structure(file_id)? { | 255 | for symbol in snap.analysis.file_structure(file_id)? { |
256 | let mut tags = Vec::new(); | ||
257 | if symbol.deprecated { | ||
258 | tags.push(SymbolTag::Deprecated) | ||
259 | }; | ||
260 | |||
261 | #[allow(deprecated)] | ||
256 | let doc_symbol = DocumentSymbol { | 262 | let doc_symbol = DocumentSymbol { |
257 | name: symbol.label, | 263 | name: symbol.label, |
258 | detail: symbol.detail, | 264 | detail: symbol.detail, |
259 | kind: to_proto::symbol_kind(symbol.kind), | 265 | kind: to_proto::symbol_kind(symbol.kind), |
266 | tags: Some(tags), | ||
260 | deprecated: Some(symbol.deprecated), | 267 | deprecated: Some(symbol.deprecated), |
261 | range: to_proto::range(&line_index, symbol.node_range), | 268 | range: to_proto::range(&line_index, symbol.node_range), |
262 | selection_range: to_proto::range(&line_index, symbol.navigation_range), | 269 | selection_range: to_proto::range(&line_index, symbol.navigation_range), |
@@ -296,9 +303,19 @@ pub(crate) fn handle_document_symbol( | |||
296 | url: &Url, | 303 | url: &Url, |
297 | res: &mut Vec<SymbolInformation>, | 304 | res: &mut Vec<SymbolInformation>, |
298 | ) { | 305 | ) { |
306 | let mut tags = Vec::new(); | ||
307 | |||
308 | #[allow(deprecated)] | ||
309 | match symbol.deprecated { | ||
310 | Some(true) => tags.push(SymbolTag::Deprecated), | ||
311 | _ => {} | ||
312 | } | ||
313 | |||
314 | #[allow(deprecated)] | ||
299 | res.push(SymbolInformation { | 315 | res.push(SymbolInformation { |
300 | name: symbol.name.clone(), | 316 | name: symbol.name.clone(), |
301 | kind: symbol.kind, | 317 | kind: symbol.kind, |
318 | tags: Some(tags), | ||
302 | deprecated: symbol.deprecated, | 319 | deprecated: symbol.deprecated, |
303 | location: Location::new(url.clone(), symbol.range), | 320 | location: Location::new(url.clone(), symbol.range), |
304 | container_name, | 321 | container_name, |
@@ -342,9 +359,12 @@ pub(crate) fn handle_workspace_symbol( | |||
342 | let mut res = Vec::new(); | 359 | let mut res = Vec::new(); |
343 | for nav in snap.analysis.symbol_search(query)? { | 360 | for nav in snap.analysis.symbol_search(query)? { |
344 | let container_name = nav.container_name.as_ref().map(|v| v.to_string()); | 361 | let container_name = nav.container_name.as_ref().map(|v| v.to_string()); |
362 | |||
363 | #[allow(deprecated)] | ||
345 | let info = SymbolInformation { | 364 | let info = SymbolInformation { |
346 | name: nav.name.to_string(), | 365 | name: nav.name.to_string(), |
347 | kind: to_proto::symbol_kind(nav.kind), | 366 | kind: to_proto::symbol_kind(nav.kind), |
367 | tags: None, | ||
348 | location: to_proto::location_from_nav(snap, nav)?, | 368 | location: to_proto::location_from_nav(snap, nav)?, |
349 | container_name, | 369 | container_name, |
350 | deprecated: None, | 370 | deprecated: None, |