Skip to content

Should standard attributes be handled by RA? #3941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jrvidal opened this issue Apr 11, 2020 · 1 comment · Fixed by #9138
Closed

Should standard attributes be handled by RA? #3941

jrvidal opened this issue Apr 11, 2020 · 1 comment · Fixed by #9138
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-actionable Someone could pick this issue up and work on it right now

Comments

@jrvidal
Copy link
Contributor

jrvidal commented Apr 11, 2020

This is sort of an open question/moonshot but I'm not sure whether there is something in the works for this.

By "handling attributes" I mean that the standard compiler attributes are understood by RA and we get:

  • Autocompletion when writing an attribute.
  • Some form of "Go To Definition" that would take you... to the reference?
@matklad
Copy link
Member

matklad commented Apr 11, 2020

Yes, they should be supported! Not sure about goto def, but, eg, hover can def link to the docs.

@matklad matklad added the E-unknown It's unclear if the issue is E-hard or E-easy without digging in label Apr 11, 2020
jrvidal added a commit to jrvidal/rust-analyzer that referenced this issue Apr 23, 2020
jrvidal added a commit to jrvidal/rust-analyzer that referenced this issue Apr 24, 2020
jrvidal added a commit to jrvidal/rust-analyzer that referenced this issue Apr 24, 2020
bors bot added a commit that referenced this issue Apr 24, 2020
4105: Adds attribute completions (#3941) r=matklad a=jrvidal

I've hacked together some basic completions for a few builtin attributes.

* I have no idea what `CompletionItemKind` we should set for them.
* There's plenty of fancy stuff we could do by detecting the item the attribute is being added to. Nothing of that here.
* Maybe we could complete as soon as you type `#` or `#!`?

I'm not sure what info exactly we can dump on `CompletionContext` and what we should query during the completion calculation itself. I've assumed adding an `is_attribute` field is OK, since it allows to discard the completion quickly if it doesn't apply. Later we inspect the AST to find out whether it is an inner attribute or not.

Co-authored-by: Roberto Vidal <[email protected]>
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 24, 2020
@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 27, 2021
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.


Co-authored-by: Lukas Wirth <[email protected]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.


Co-authored-by: Lukas Wirth <[email protected]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.


Co-authored-by: Lukas Wirth <[email protected]>
bors bot added a commit that referenced this issue Jun 4, 2021
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes #8857, fixes #3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.


Co-authored-by: Lukas Wirth <[email protected]>
@bors bors bot closed this as completed in 98395f2 Jun 4, 2021
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Jan 7, 2025
Replace set_last_error with set_last_error_and_return

Took care of the simple patterns. Other patterns involved setting an error and then using `write_int` or setting metadata and returning -1. Unsure if those are in the scope of this change

Looks like this has conflicts with rust-lang#3779, so I can update when how to handle that is decided.

Part of rust-lang/miri#3930.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants