Skip to content

Add Inlay Hints version support for nested packages#713

Open
p32blo wants to merge 7 commits into
nix-community:mainfrom
p32blo:inlay-hints-expr-select
Open

Add Inlay Hints version support for nested packages#713
p32blo wants to merge 7 commits into
nix-community:mainfrom
p32blo:inlay-hints-expr-select

Conversation

@p32blo

@p32blo p32blo commented Aug 31, 2025

Copy link
Copy Markdown

This PR extends inlay hints support for packages that have dots ('.') in their name like nerd-fonts.fira-code.

Before

Screenshot 2025-08-31 at 18 24 26

After

Screenshot 2025-08-31 at 18 27 14

Bug Fixes

  • While implementing this I found that lambda variables where being considered as packages and fixed it by doing a VLA.query(Var) to check that the name is not a variable defined in the current scope
  • Also fixed Don't display version of lib #643 by never allowing the nixd::idioms::Lib to be an evaluated package name.

@p32blo p32blo requested a review from inclyc as a code owner August 31, 2025 17:47

@inclyc inclyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution! Can you add some regression tests for this new feature?

Comment thread nixd/lib/Controller/InlayHints.cpp Outdated
Comment thread nixd/lib/Controller/InlayHints.cpp Outdated
@p32blo p32blo force-pushed the inlay-hints-expr-select branch 2 times, most recently from 085cfa2 to 818ee11 Compare September 2, 2025 16:57
@p32blo

p32blo commented Sep 2, 2025

Copy link
Copy Markdown
Author

Hey, I've tried to update the PR with some tests. I'm not sure this is exactly what you ment, so let me know If there is any problem :)

Comment thread nixd/tools/nixd/test/inlay-hint/hello.md Outdated
Comment thread nixd/lib/Controller/InlayHints.cpp Outdated
Comment thread nixd/lib/Controller/InlayHints.cpp Outdated
Comment thread nixd/lib/Controller/InlayHints.cpp Outdated
Comment thread nixd/tools/nixd/test/inlay-hint/hello.md Outdated
@p32blo p32blo force-pushed the inlay-hints-expr-select branch from 818ee11 to 34b5cea Compare September 9, 2025 20:58
Co-authored-by: Yingchi Long <longyingchi24s@ict.ac.cn>
@p32blo p32blo force-pushed the inlay-hints-expr-select branch from 34b5cea to 6919c69 Compare September 9, 2025 21:17
@@ -0,0 +1,51 @@
# RUN: nixd --lit-test \
# RUN: --nixpkgs-expr="{ nerd-fonts.fira-code.version = \"3.4.0\"; }" \
# RUN: < %s

@inclyc inclyc Sep 12, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just made this hack code to show that nixd may crash in this case.

with pkgs; [ nerd-fonts. ] # user editing the expression

const auto &Sel = static_cast<const ExprSelect &>(*N);
Params P;
P.emplace_back(Sel.expr().src(Src));
for (const auto &Name : Sel.path()->names())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might be nullptr, in that case

@inclyc inclyc added the enhancement New feature or request label Dec 30, 2025
@inclyc inclyc force-pushed the main branch 2 times, most recently from ed5029e to 6707401 Compare January 2, 2026 12:54
@Malix-Labs

Malix-Labs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Could you please verify that #835 (comment) is in the scope of this PR too?

In which case it could be added to the PR description to close it automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't display version of lib

3 participants