8000 Feat: Inlay hints on the end of let/attrset bindings by leana8959 · Pull Request #170 · oxalica/nil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feat: Inlay hints on the end of let/attrset bindings #170

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

Merged
merged 22 commits into from
Jun 16, 2025

Conversation

leana8959
Copy link
Contributor

Attempt to implement #166.

I haven't figured out the best way to match on the ast.
It would be nice to match on the shape { attrName = <expr> ; }, where we display attrName right after <expr> or the semicolon.

@leana8959
Copy link
Contributor Author

I think what's left to do is the detection of "what's a trivial expression" and hide those, so the hints don't get annoying.

Here are some ideas, what do you think?

  • Use a configurable setting of how many lines the expression spans
  • Detect how nested the attrset is
  • Simply check whether the ; is on the same line as the attribute name

Here's an example of how it looks at the moment:
image

@leana8959 leana8959 marked this pull request as ready for review June 14, 2025 17:04
@leana8959
Copy link
Contributor Author

I added a very simple heuristic to detect if an expression is "trivial" and the hint should not be shown.
image

Copy link
Owner
@oxalica oxalica left a comment

Choose a reason for hiding this comment

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

Thanks for the work! The approach looks good to me.

@oxalica oxalica changed the title Feat: Inlay hints Feat: Inlay hints on the end of let/attrset bindings Jun 15, 2025
@oxalica oxalica added C-feature Catagory: feature A-lsp Area: LSP conformance issues and missing features A-diagnostics Area: diagnostics / error reporting labels Jun 15, 2025
Copy link
Owner
@oxalica oxalica left a comment

Choose a reason for hiding this comment

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

The logic looks good to me now. Just the CI failure needs to be fixed.

@leana8959
Copy link
Contributor Author
leana8959 commented Jun 16, 2025

Yep, I just figured out how to run that locally. Sorry about that!
Should be all good now.

@oxalica oxalica merged commit 870a4b1 into oxalica:main Jun 16, 2025
10 checks passed
@oxalica
Copy link
Owner
oxalica commented Jun 16, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: diagnostics / error reporting A-lsp Area: LSP conformance issues and missing features C-feature Catagory: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0