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

[move-ide] Added on-hover for inlay type hints #17900

Merged
merged 2 commits into from
May 23, 2024

Conversation

awelc
Copy link
Contributor

@awelc awelc commented May 23, 2024

Description

Added on-hover when hovering over struct type hints:

image

Test plan

Verified that on-hover works for struct type hints

@awelc awelc requested a review from ronny-mysten as a code owner May 23, 2024 20:07
Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 9:22pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 9:22pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 9:22pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 9:22pm

/// are resolved (the main problem is that adding it enables a drop-down menu
/// containing options that are not supported for the type definition, such
/// as go-to-declaration, and which jump to weird locations in the file).
fn additional_hint_info(sp!(_, t): &N::Type, symbols: &Symbols) -> Option<InlayHintTooltip> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main part (the rest are some refactorings)

Some(serde_json::to_value(loc).unwrap())
},
);
}

pub fn def_ide_location(def_loc: &DefLoc, symbols: &Symbols) -> Location {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a strictly necessary one but I hope we will be able to ultimately support locations in inlay type hints for additional information to be displayed (that's why this was introduced in the first place).

@@ -136,6 +136,10 @@ pub struct DefLoc {
}

impl DefLoc {
pub fn new(fhash: FileHash, start: Position) -> Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also not strictly necessary (for the same reasons as described here) but using it instead of struct constructors made the code look nicer so I left it

Copy link
Contributor

@rvantonder rvantonder left a comment

Choose a reason for hiding this comment

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

Nice, thanks for chopping these up!

@awelc awelc merged commit 5a7780b into main May 23, 2024
48 checks passed
@awelc awelc deleted the aw/ide-inlay-type-hints-hover branch May 23, 2024 23:39
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.

2 participants