Skip to content

Commit 9a9c0e1

Browse files
committed
Use symbol tags
1 parent e72c622 commit 9a9c0e1

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rust-analyzer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env_logger = { version = "0.7.1", default-features = false }
2020
itertools = "0.9.0"
2121
jod-thread = "0.1.0"
2222
log = "0.4.8"
23-
lsp-types = { version = "0.77.0", features = ["proposed"] }
23+
lsp-types = { version = "0.78.0", features = ["proposed"] }
2424
parking_lot = "0.11.0"
2525
pico-args = "0.3.1"
2626
rand = { version = "0.7.3", features = ["small_rng"] }

crates/rust-analyzer/src/handlers.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//! Protocol. The majority of requests are fulfilled by calling into the
33
//! `ra_ide` crate.
44
5+
#![allow(deprecated)]
6+
57
use std::{
68
io::Write as _,
79
process::{self, Stdio},
@@ -15,7 +17,7 @@ use lsp_types::{
1517
DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location,
1618
Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams,
1719
SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation,
18-
TextDocumentIdentifier, Url, WorkspaceEdit,
20+
SymbolTag, TextDocumentIdentifier, Url, WorkspaceEdit,
1921
};
2022
use ra_ide::{
2123
FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query,
@@ -253,10 +255,16 @@ pub(crate) fn handle_document_symbol(
253255
let mut parents: Vec<(DocumentSymbol, Option<usize>)> = Vec::new();
254256

255257
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+
256263
let doc_symbol = DocumentSymbol {
257264
name: symbol.label,
258265
detail: symbol.detail,
259266
kind: to_proto::symbol_kind(symbol.kind),
267+
tags: Some(tags),
260268
deprecated: Some(symbol.deprecated),
261269
range: to_proto::range(&line_index, symbol.node_range),
262270
selection_range: to_proto::range(&line_index, symbol.navigation_range),
@@ -296,9 +304,16 @@ pub(crate) fn handle_document_symbol(
296304
url: &Url,
297305
res: &mut Vec<SymbolInformation>,
298306
) {
307+
let mut tags = Vec::new();
308+
match symbol.deprecated {
309+
Some(true) => tags.push(SymbolTag::Deprecated),
310+
_ => {}
311+
}
312+
299313
res.push(SymbolInformation {
300314
name: symbol.name.clone(),
301315
kind: symbol.kind,
316+
tags: Some(tags),
302317
deprecated: symbol.deprecated,
303318
location: Location::new(url.clone(), symbol.range),
304319
container_name,
@@ -345,6 +360,7 @@ pub(crate) fn handle_workspace_symbol(
345360
let info = SymbolInformation {
346361
name: nav.name.to_string(),
347362
kind: to_proto::symbol_kind(nav.kind),
363+
tags: None,
348364
location: to_proto::location_from_nav(snap, nav)?,
349365
container_name,
350366
deprecated: None,

0 commit comments

Comments
 (0)