Skip to content

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

Closed
@matthiaskrgr

Description

@matthiaskrgr

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.

Metadata

Metadata

Labels

A-idegeneral IDE featuresA-inlay-hintsinlay/inline hintsC-featureCategory: feature requestS-actionableSomeone could pick this issue up and work on it right now

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions