nixd
nixd copied to clipboard
Display full completion list when inside attribute set
Is your feature request related to a problem? Please describe.
In attribute sets, when triggering completion while writing dot-separated names, with the cursor directly after a dot, nixd lists all possible completion values, Eg. in configuration.nix:
programs.zsh./*cursor*/
The same does not happen when nesting them.
programs = {
zsh = {
/*cursor*/
};
};
no completion items appear until something is typed.
programs = {
zsh = {
e/*cursor*/ # suggests enable, enableAutosuggestions etc
};
};
Describe the solution you'd like
Triggering completion inside an attribute set within whitespace should give the same list as when writing the values with dots.
Describe alternatives you've considered
Not nesting attribute sets, which is less convenient for my preference.
Additional context
In attribute sets, when triggering completion while writing dot-separated names, with the cursor directly after a dot, nixd lists all possible completion values, Eg. in configuration.nix:
programs.zsh./cursor/
Wow, I was under the impression nixd just isn't capable of this kind of completion in general!
I'll be watching this issue hoping to switch back from nil.
this is pretty much a killer feature and what I think would attract much more attention. Oh and also it behaves the same way when using nvim-cmp as op seems to use helix
I've just done some quick development, and the main issue now is:
programs = {
zsh = {
/* | */
# ^ Assuming the cursor is here,
};
};
the current AST cannot determine whether it is inside a "comment body", which causes nixd to attempt "completion" within comments, and that is undesirable.
One could argue that if you were to open autocompletion in a comment body in this way, what you're saying is still the expected behavior.
In that case it would be great to have the same behavior for line comments.
Hi, I have the same "issue" with vscode. I was wondering if there was a configuration, to allow that. Any discovery?
I have a fix for this + couple other improvements here: https://github.com/oandrew/nixd/tree/completion-fixes
diff: https://github.com/nix-community/nixd/compare/main...oandrew:nixd:completion-fixes
- show completions when no text under cursor
- increase number of returned completions to 1000
- remove prefix filtering to let vscode do fuzzy matching i.e. typing
networking.netwill also suggestuseNetworkd.
Commit for this specific issue: https://github.com/nix-community/nixd/commit/6e3a54914459d0f7782a9244b6db5fcaab47c95e
quick video:
https://github.com/user-attachments/assets/8b3a61a6-b6c0-452c-8271-5ef2ae0df8d7
@oandrew do you want to create a PR for this?
Any updates on this? This would be an extremely appealing feature.
Any updates on this? This would be an extremely appealing feature.
There's already an open PR: https://github.com/nix-community/nixd/pull/698
There's already an open PR: #698
I'm new to the open source world. When will the PR be merged?
The comments must be addressed first.
Any updates on this? This would be an extremely appealing feature.
I agree it would allow me to use nixd to its full potential