Skip to content
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

Allow configuration of annotation location. #13221

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

mdx97
Copy link
Contributor

@mdx97 mdx97 commented Sep 12, 2022

I've added the ability to configure where lens annotations render relevant to the item they describe. Previously, these would render directly above the line the item is declared on. Now, there is the ability to render these annotations above the entire item (including doc comments, and attributes).

The names of the config options are up for debate, I did what seemed best to me but if anyone has better ideas let me know.

This is my first contribution so if I've missed anything please let me know.

Here's a preview of what the new option looks like:

Screen Shot 2022-09-11 at 10 39 51 PM

closes #13218

Previously, annotations would only appear above the name of an item (function signature, struct declaration, etc).

Now, rust-analyzer can be configured to show annotations either above the name or above the whole item (including doc comments and attributes).
@mdx97
Copy link
Contributor Author

mdx97 commented Sep 12, 2022

I see the build failed, I will look into it after work tomorrow.

@Veykril
Copy link
Member

Veykril commented Sep 12, 2022

You'll have to run cargo test -p rust-analyzer to rebuild the config pages

Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Not entirely sure about the above_whole_item name for the second variant, but I can't think of anything better either

crates/ide/src/annotations.rs Outdated Show resolved Hide resolved
crates/rust-analyzer/src/config.rs Outdated Show resolved Hide resolved
@Veykril
Copy link
Member

Veykril commented Sep 13, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Sep 13, 2022

📌 Commit f57c15f has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 13, 2022

⌛ Testing commit f57c15f with merge dbb8fed...

@bors
Copy link
Contributor

bors commented Sep 13, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing dbb8fed to master...

@bors bors merged commit dbb8fed into rust-lang:master Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow toggling code lens positions
4 participants