Skip to content

Add inlay hints for default arguments #130571

Open
@ilya-biryukov

Description

@ilya-biryukov

It would be great to show default arguments in various places through inlay hints.

Right now, only parameter names are shown in calls:
Image

It would definitely be great if one could also see the default arguments from declarations on the definition and use sites (comments below mark inlay hints I'm proposing to add):

void foo(int a = 10);
void foo(int a /* = 10*/) {
}

void test() {
  foo(/*10*/)
}

Going a bit further, we could also consider adding inlay hints for default arguments, although they look like a harder sell to me because I expect more noise (e.g. unique_ptr has a default deleter, vector has an allocator and unordered_map have hash defaults that are going to be popping up everywhere):

template <class T = int>
struct Foo {
};

Foo</*int*/> x;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions