aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2021-01-18 22:02:59 +0000
committerKirill Bulatov <[email protected]>2021-01-18 22:04:24 +0000
commitcc663a7b0c1fc813c58be8b8d84772c52f736d26 (patch)
tree7a0ac7d2a8502199dcabd7def9b5b31aed82b479 /crates/completion
parentbf889bcf3be44720ca1c26fccec0374dfc7f3763 (diff)
Consider rustc_deprecated attr when checking for deprecation
Diffstat (limited to 'crates/completion')
-rw-r--r--crates/completion/src/render.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs
index 4b3c9702a..dbb30d233 100644
--- a/crates/completion/src/render.rs
+++ b/crates/completion/src/render.rs
@@ -87,7 +87,8 @@ impl<'a> RenderContext<'a> {
87 } 87 }
88 88
89 fn is_deprecated(&self, node: impl HasAttrs) -> bool { 89 fn is_deprecated(&self, node: impl HasAttrs) -> bool {
90 node.attrs(self.db()).by_key("deprecated").exists() 90 let attrs = node.attrs(self.db());
91 attrs.by_key("deprecated").exists() || attrs.by_key("rustc_deprecated").exists()
91 } 92 }
92 93
93 fn docs(&self, node: impl HasAttrs) -> Option<Documentation> { 94 fn docs(&self, node: impl HasAttrs) -> Option<Documentation> {
@@ -485,7 +486,7 @@ fn main() { let _: m::Spam = S$0 }
485 r#" 486 r#"
486#[deprecated] 487#[deprecated]
487fn something_deprecated() {} 488fn something_deprecated() {}
488#[deprecated(since = "1.0.0")] 489#[rustc_deprecated(since = "1.0.0")]
489fn something_else_deprecated() {} 490fn something_else_deprecated() {}
490 491
491fn main() { som$0 } 492fn main() { som$0 }
@@ -494,8 +495,8 @@ fn main() { som$0 }
494 [ 495 [
495 CompletionItem { 496 CompletionItem {
496 label: "main()", 497 label: "main()",
497 source_range: 121..124, 498 source_range: 127..130,
498 delete: 121..124, 499 delete: 127..130,
499 insert: "main()$0", 500 insert: "main()$0",
500 kind: Function, 501 kind: Function,
501 lookup: "main", 502 lookup: "main",
@@ -503,8 +504,8 @@ fn main() { som$0 }
503 }, 504 },
504 CompletionItem { 505 CompletionItem {
505 label: "something_deprecated()", 506 label: "something_deprecated()",
506 source_range: 121..124, 507 source_range: 127..130,
507 delete: 121..124, 508 delete: 127..130,
508 insert: "something_deprecated()$0", 509 insert: "something_deprecated()$0",
509 kind: Function, 510 kind: Function,
510 lookup: "something_deprecated", 511 lookup: "something_deprecated",
@@ -513,8 +514,8 @@ fn main() { som$0 }
513 }, 514 },
514 CompletionItem { 515 CompletionItem {
515 label: "something_else_deprecated()", 516 label: "something_else_deprecated()",
516 source_range: 121..124, 517 source_range: 127..130,
517 delete: 121..124, 518 delete: 127..130,
518 insert: "something_else_deprecated()$0", 519 insert: "something_else_deprecated()$0",
519 kind: Function, 520 kind: Function,
520 lookup: "something_else_deprecated", 521 lookup: "something_else_deprecated",