Skip to content

feat: adds hover hint to ".." in record pattern #13638

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

Merged
merged 10 commits into from
Nov 25, 2022

Conversation

kartva
Copy link
Contributor

@kartva kartva commented Nov 19, 2022

Hovering on the "rest" pattern in struct destructuring,

struct Baz {
    a: u32,
    b: u32,
    c: u32,
    d: u32
}

let Baz { a, b, ..$0} = Baz { a: 1, b: 2, c: 3, d: 4 };

shows:

.., c: u32, d: u32

Currently only works with struct patterns.

image

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2022
@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2022
@kartva
Copy link
Contributor Author

kartva commented Nov 19, 2022

Huh, this is weird. Now, the Run Extension (Debug Build) (rust-analyzer) VSCode action launches a window which shows the following error:

Cannot activate rust-analyzer extension: Language client is not ready yet when handling experimental/serverStatus

And then trying to start r-a gives this error:

_a.isRunning is not a function

And sometimes

command 'rust-analyzer.startServer' not found

The weirdest thing is that I stashed my changes and retried, but it still isn't working. Did a recent VSCode update break stuff?

@Veykril
Copy link
Member

Veykril commented Nov 19, 2022

You might need to update your vscode, we recently bumped the minimum version i think

@kartva
Copy link
Contributor Author

kartva commented Nov 19, 2022

Even weirder: I'm using the latest version (v1.73.1)

change struct_rest_pat to guarentee a HoverResult

Move token and node matching out of struct_rest_pat into hover
@kartva kartva requested a review from Veykril November 19, 2022 15:57
@kartva
Copy link
Contributor Author

kartva commented Nov 19, 2022

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 19, 2022
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.

Would be good to add a test or two

@@ -87,7 +87,7 @@ pub struct HoverResult {
// Shows additional information, like the type of an expression or the documentation for a definition when "focusing" code.
// Focusing is usually hovering with a mouse, but can also be triggered with a shortcut.
//
// image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917a-11eb-9f88-3dbc27320c95.gif[]
Copy link
Member

Choose a reason for hiding this comment

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

The [] should stay 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.

I'll do that, but is there any reasoning that I'm missing? Which syntax is image::? I don't think it's a Markdown thing.

Copy link
Member

Choose a reason for hiding this comment

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

It's Asciidoc

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2022
@kartva
Copy link
Contributor Author

kartva commented Nov 25, 2022

Is there a reason that the hover.rs file is separate from the hover folder which contains the test and render modules? Wouldn't it be better to have it moved as hover/mod.rs?

@kartva
Copy link
Contributor Author

kartva commented Nov 25, 2022

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 25, 2022
@kartva kartva requested a review from Veykril November 25, 2022 06:57
@Veykril
Copy link
Member

Veykril commented Nov 25, 2022

hover/mod.rs is the old style of modules, we prefer using the new one.

@Veykril
Copy link
Member

Veykril commented Nov 25, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Nov 25, 2022

📌 Commit a26aef9 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 25, 2022

⌛ Testing commit a26aef9 with merge 6918009...

@bors
Copy link
Contributor

bors commented Nov 25, 2022

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

@bors bors merged commit 6918009 into rust-lang:master Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants