Skip to content

Conversation

@oandrew
Copy link

@oandrew oandrew commented Jun 23, 2025

fixes #653

  • 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.net will also suggest useNetworkd.

quick video:

nixd.mov

@oandrew oandrew requested a review from inclyc as a code owner June 23, 2025 17:44
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.

Please fix regression tests.

oandrew added 3 commits June 24, 2025 17:59
Display all available completion options within the current attrset even if it's empty or there is no text under the cursor.
@oandrew oandrew force-pushed the completion-fixes branch from c34567c to 4cd9d17 Compare June 25, 2025 01:05
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.

Overall, I think:

  • The current approach also provides completion suggestions within comment content, which I believe is undesirable.
  • We should develop a parser that preserves the position of comments, so that we can check whether the location of the "completion" is inside a comment when performing it.

CHECK-NEXT: "result": {
CHECK-NEXT: "isIncomplete": false,
CHECK-NEXT: "items": []
CHECK-NEXT: "items": [
Copy link
Member

Choose a reason for hiding this comment

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

I think the previous version gave more accurate results because the current "completion" feature is essentially providing completions within the "comments," which might confuse users.

namespace {

constexpr int MaxItems = 30;
constexpr int MaxItems = 1000;
Copy link
Member

Choose a reason for hiding this comment

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

What is the motivation or necessity behind this?


const auto *Desc = AST->descend({Pos, Pos});
CheckDefault(Desc && Desc->children().empty());
CheckDefault(Desc);
Copy link
Member

Choose a reason for hiding this comment

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

This line of code previously protected us from providing code completions within "comments."

@bolives-hax
Copy link

Very nice

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.

Display full completion list when inside attribute set

3 participants