Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/ide-completion/src/completions/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const fn attr(
macro_rules! attrs {
// attributes applicable to all items
[@ { item $($tt:tt)* } {$($acc:tt)*}] => {
attrs!(@ { $($tt)* } { $($acc)*, "deprecated", "doc", "dochidden", "docalias", "must_use", "no_mangle" })
attrs!(@ { $($tt)* } { $($acc)*, "deprecated", "doc", "dochidden", "docalias", "docinclude", "must_use", "no_mangle" })
};
// attributes applicable to all adts
[@ { adt $($tt:tt)* } {$($acc:tt)*}] => {
Expand Down Expand Up @@ -345,6 +345,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[
attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)),
attr(r#"doc(alias = "…")"#, Some("docalias"), Some(r#"doc(alias = "${0:docs}")"#)),
attr(r#"doc(hidden)"#, Some("dochidden"), Some(r#"doc(hidden)"#)),
attr(r#"doc = include_str!("…")"#, Some("docinclude"), Some(r#"doc = include_str!("$0")"#)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's useless to complete three dots, right? We should complete a snippet here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It completes tabstop, 'three dots' are just prompt

Some(r#"doc = include_str!("$0")"#)

This comment was marked as duplicate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry then.

attr("expect(…)", Some("expect"), Some("expect(${0:lint})")),
attr(
r#"export_name = "…""#,
Expand Down
23 changes: 23 additions & 0 deletions crates/ide-completion/src/tests/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct Foo(#[m$0] i32);
at diagnostic::do_not_recommend
at diagnostic::on_unimplemented
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -85,6 +86,7 @@ struct Foo;
at deprecated
at derive(…)
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -158,6 +160,7 @@ fn attr_on_source_file() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -189,6 +192,7 @@ fn attr_on_module() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -212,6 +216,7 @@ fn attr_on_module() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -238,6 +243,7 @@ fn attr_on_macro_rules() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -264,6 +270,7 @@ fn attr_on_macro_def() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -288,6 +295,7 @@ fn attr_on_extern_crate() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -313,6 +321,7 @@ fn attr_on_use() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -337,6 +346,7 @@ fn attr_on_type_alias() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -368,6 +378,7 @@ struct Foo;
at derive(…)
at derive_const macro derive_const
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -396,6 +407,7 @@ fn attr_on_enum() {
at deprecated
at derive(…)
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -422,6 +434,7 @@ fn attr_on_const() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -446,6 +459,7 @@ fn attr_on_static() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -476,6 +490,7 @@ fn attr_on_trait() {
at deprecated
at diagnostic::on_unimplemented
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -502,6 +517,7 @@ fn attr_on_impl() {
at deprecated
at diagnostic::do_not_recommend
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -522,6 +538,7 @@ fn attr_on_impl() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -548,6 +565,7 @@ fn attr_with_qualifier() {
at deprecated
at do_not_recommend
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -566,6 +584,7 @@ fn attr_with_qualifier() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -616,6 +635,7 @@ fn attr_on_extern_block() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand All @@ -637,6 +657,7 @@ fn attr_on_extern_block() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -682,6 +703,7 @@ fn attr_on_fn() {
at deny(…)
at deprecated
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down Expand Up @@ -724,6 +746,7 @@ fn attr_in_source_file_end() {
at diagnostic::do_not_recommend
at diagnostic::on_unimplemented
at doc = "…"
at doc = include_str!("…")
at doc(alias = "…")
at doc(hidden)
at expect(…)
Expand Down
Loading