Skip to content

Conversation

@p32blo
Copy link

@p32blo p32blo commented Aug 31, 2025

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
Copy link
Member

@inclyc inclyc 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 your contribution! Can you add some regression tests for this new feature?

@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
Copy link
Author

p32blo commented Sep 2, 2025

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 :)

@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
Copy link
Member

@inclyc inclyc Sep 12, 2025

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
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

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.

Don't display version of lib

2 participants