Skip to content

show what closing }s belong to for longer functions #7315

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
matthiaskrgr opened this issue Jan 17, 2021 · 1 comment · Fixed by #12244
Closed

show what closing }s belong to for longer functions #7315

matthiaskrgr opened this issue Jan 17, 2021 · 1 comment · Fixed by #12244
Assignees
Labels
A-ide general IDE features A-inlay-hints inlay/inline hints C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now

Comments

@matthiaskrgr
Copy link
Member

I've had a couple of situations already where I would have liked RA to print something to identify what function/method a closing } belongs to.

This could look like this

impl HasSource for Field {
    type Ast = FieldSource;
    fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
        let var = VariantId::from(self.parent);
        let src = var.child_source(db.upcast());
        let field_source = src.map(|it| match it[self.id].clone() {
            Either::Left(it) => FieldSource::Pos(it),
            Either::Right(it) => FieldSource::Named(it),
        });
        Some(field_source)
    } <fn source(self, &dyn HirDatabase)>
} <impl HasSource for Field>

This makes it easier to navigate code when functions are very long and users won't have to scroll up to the function body to check what the } belongs to.

The <..> text would be greyed out.

@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 18, 2021
@matklad
Copy link
Member

matklad commented Jan 18, 2021

cc @SomeoneToIgnore

this also in theory a job for breadcrumbs, but I like the inlay hints angle

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ide general IDE features A-inlay-hints inlay/inline hints C-feature Category: feature request 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.

5 participants