aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/handlers.rs18
2 files changed, 18 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 }
20itertools = "0.9.0" 20itertools = "0.9.0"
21jod-thread = "0.1.0" 21jod-thread = "0.1.0"
22log = "0.4.8" 22log = "0.4.8"
23lsp-types = { version = "0.77.0", features = ["proposed"] } 23lsp-types = { version = "0.78.0", features = ["proposed"] }
24parking_lot = "0.11.0" 24parking_lot = "0.11.0"
25pico-args = "0.3.1" 25pico-args = "0.3.1"
26rand = { version = "0.7.3", features = ["small_rng"] } 26rand = { 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..2589002e7 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -2,6 +2,8 @@
2//! Protocol. The majority of requests are fulfilled by calling into the 2//! Protocol. The majority of requests are fulfilled by calling into the
3//! `ra_ide` crate. 3//! `ra_ide` crate.
4 4
5#![allow(deprecated)]
6
5use std::{ 7use std::{
6 io::Write as _, 8 io::Write as _,
7 process::{self, Stdio}, 9 process::{self, Stdio},
@@ -15,7 +17,7 @@ use lsp_types::{
15 DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location, 17 DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location,
16 Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams, 18 Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams,
17 SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, 19 SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation,
18 TextDocumentIdentifier, Url, WorkspaceEdit, 20 SymbolTag, TextDocumentIdentifier, Url, WorkspaceEdit,
19}; 21};
20use ra_ide::{ 22use ra_ide::{
21 FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, 23 FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query,
@@ -253,10 +255,16 @@ pub(crate) fn handle_document_symbol(
253 let mut parents: Vec<(DocumentSymbol, Option<usize>)> = Vec::new(); 255 let mut parents: Vec<(DocumentSymbol, Option<usize>)> = Vec::new();
254 256
255 for symbol in snap.analysis.file_structure(file_id)? { 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 let doc_symbol = DocumentSymbol { 263 let doc_symbol = DocumentSymbol {
257 name: symbol.label, 264 name: symbol.label,
258 detail: symbol.detail, 265 detail: symbol.detail,
259 kind: to_proto::symbol_kind(symbol.kind), 266 kind: to_proto::symbol_kind(symbol.kind),
267 tags: Some(tags),
260 deprecated: Some(symbol.deprecated), 268 deprecated: Some(symbol.deprecated),
261 range: to_proto::range(&line_index, symbol.node_range), 269 range: to_proto::range(&line_index, symbol.node_range),
262 selection_range: to_proto::range(&line_index, symbol.navigation_range), 270 selection_range: to_proto::range(&line_index, symbol.navigation_range),
@@ -296,9 +304,16 @@ pub(crate) fn handle_document_symbol(
296 url: &Url, 304 url: &Url,
297 res: &mut Vec<SymbolInformation>, 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 res.push(SymbolInformation { 313 res.push(SymbolInformation {
300 name: symbol.name.clone(), 314 name: symbol.name.clone(),
301 kind: symbol.kind, 315 kind: symbol.kind,
316 tags: Some(tags),
302 deprecated: symbol.deprecated, 317 deprecated: symbol.deprecated,
303 location: Location::new(url.clone(), symbol.range), 318 location: Location::new(url.clone(), symbol.range),
304 container_name, 319 container_name,
@@ -345,6 +360,7 @@ pub(crate) fn handle_workspace_symbol(
345 let info = SymbolInformation { 360 let info = SymbolInformation {
346 name: nav.name.to_string(), 361 name: nav.name.to_string(),
347 kind: to_proto::symbol_kind(nav.kind), 362 kind: to_proto::symbol_kind(nav.kind),
363 tags: None,
348 location: to_proto::location_from_nav(snap, nav)?, 364 location: to_proto::location_from_nav(snap, nav)?,
349 container_name, 365 container_name,
350 deprecated: None, 366 deprecated: None,