Skip to content

Don't provide inlay hints when passed name == function arg name#262

Draft
evanwporter wants to merge 2 commits into
hudson-trading:mainfrom
evanwporter:same-name-no-hint
Draft

Don't provide inlay hints when passed name == function arg name#262
evanwporter wants to merge 2 commits into
hudson-trading:mainfrom
evanwporter:same-name-no-hint

Conversation

@evanwporter

Copy link
Copy Markdown
Contributor

if a passed arg has the name as the function argument, then we don't provide a inlay hint

For example say we have a funtion:

function automatic logic do_something(logic a);

If we use this function usually the inlay hint would provide:

do_something(a: a);

Now because a == a. There's no hint:

do_something(a);

@evanwporter

Copy link
Copy Markdown
Contributor Author

I'm looking at making it more efficient by not comparing the string. Also I need to add tests.

@evanwporter

Copy link
Copy Markdown
Contributor Author

alright this should be good.

@evanwporter evanwporter marked this pull request as ready for review April 8, 2026 03:40

const auto name = def.parameters[paramIndex].name;
std::string passedArgName = paramSyntax->toString();
ltrim(passedArgName);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can check that it's an id token, and compare the raw text. We'd also want to check that it's not behind a macro loc as well, since there's an edge case with something like this

`def FOO bar

my_func(`FOO);

@evanwporter evanwporter Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

alright I'll try and make these changes before may XD


const auto name = ports[portIndex]->name;
std::string passedArgName = portSyntax->toString();
ltrim(passedArgName);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, also it's sort of repeat code that can be put in a lambda

break;
}

const auto name = def.parameters[paramIndex].name;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We only need one paramIndex++, could be in this expr or right after.

@AndrewNolte

Copy link
Copy Markdown
Collaborator

This needs a rebase/conflict fix now

…provide a inlay hint

For example say we have a funtion:

```
function automatic logic do_something(logic a);
```

If we use this function usually the inlay hint would provide:

```
do_something(a: a);
```

Now because `a == a`. There's no hint:

```
do_something(a);
```
@evanwporter evanwporter force-pushed the same-name-no-hint branch 2 times, most recently from 1532d19 to 9081e17 Compare June 3, 2026 18:48
add \n

cha

bump clang
@evanwporter evanwporter marked this pull request as draft June 4, 2026 04:52
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